Skip to content

Instantly share code, notes, and snippets.

View Mhdi-kr's full-sized avatar

Mahdi Karimi Mhdi-kr

View GitHub Profile
@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active May 13, 2024 14:38
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@jonnyjava
jonnyjava / 97_Things_Every_Programmer_Should_Know.md
Last active November 27, 2023 22:16
97 Things Every Programmer Should Know: Collective Wisdom from the Experts

97 Things Every Programmer Should Know: Collective Wisdom from the Experts

  1. Act with Prudence

    • Pay off technical debt as soon as possible. It would be imprudent to do otherwise.
  2. Apply Functional Programming Principles

  3. Ask "What Would the User Do?" (You Are Not the User)

    • Spending an hour watching users is more informative than spending a day guessing what they want.
@ClemRz
ClemRz / readme.md
Last active November 19, 2023 16:11
How to pass a callback function as an argument (Arduino, C++)

How to pass a callback function as an argument (Arduino, C++)

Arduino Uno:

bool myCallback(int value) {
  // here your custom logic
  return status;
}
@SKempin
SKempin / Git Subtree basics.md
Last active May 16, 2024 20:38
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 17, 2024 19:04
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@fiorix
fiorix / groupcache.go
Last active February 6, 2024 10:39
Simple groupcache example
// Simple groupcache example: https://github.com/golang/groupcache
// Running 3 instances:
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081
// Testing:
// curl localhost:8080/color?name=red
package main
import (
@mondain
mondain / public-stun-list.txt
Last active May 15, 2024 02:39
Public STUN server list
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
@joepie91
joepie91 / vpn.md
Last active May 18, 2024 02:43
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.