Skip to content

Instantly share code, notes, and snippets.

View ihatemodels's full-sized avatar
💊

Gergin Darakov ihatemodels

💊
  • Quickbase
  • Sofia Bulgaria
  • 07:09 (UTC +02:00)
View GitHub Profile
@ihatemodels
ihatemodels / work-with-multiple-github-accounts.md
Created December 12, 2022 17:06 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
package main
import (
"os/exec"
"syscall"
)
// Helper method for executing cmd commands (does not open cmd window).
func executeCommand(cmd string, args ...string) (string, error) {
var out []byte
@ihatemodels
ihatemodels / main.go
Created March 2, 2020 10:26 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@ihatemodels
ihatemodels / sakoku_ufw.sh
Created March 1, 2020 22:50 — forked from gotodeploy/sakoku_ufw.sh
UFW blocks for Asian countries except Japan
#!/bin/sh
# UFW blocks for Asian countries except Japan
# Based on http://www.wizcrafts.net/chinese-iptables-blocklist.html
# Cambodia (KH)
ufw deny from 114.134.184.0/21
# Chinese (CN) IP addresses follow:
ufw deny from 1.68.0.0/14
ufw deny from 1.80.0.0/13
@ihatemodels
ihatemodels / block_china_ufw.sh
Created March 1, 2020 22:49 — forked from lewg/block_china_ufw.sh
UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
#!/bin/sh
# UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
# Based on http://www.wizcrafts.net/chinese-iptables-blocklist.html
# Cambodia (KH)
ufw deny from 114.134.184.0/21 to any port 22
# Chinese (CN) IP addresses follow:
ufw deny from 1.192.0.0/13 to any port 22
ufw deny from 1.202.0.0/15 to any port 22
@ihatemodels
ihatemodels / git-cheat.md
Last active September 19, 2019 09:59
git cheatsheat

Before you get started with Git, you need to understand some important terms

Branch

Branches represent specific versions of a repository that “branch out” from your main project. Branches allow you to keep track of experimental changes you make to repositories and revert to older versions.

Commit

A commit represents a specific point in your project’s history. Use the commit command in conjunction with the git add command to let git know which changes you wish to save to the local repository. Note that commits are not automatically sent to the remote server.

@ihatemodels
ihatemodels / bubble-sort.py
Created September 13, 2019 18:37
Python sorting algorithms
'''Bubble sort is the one usually taught in introductory CS
classes since it clearly demonstrates how sort works while
being simple and easy to understand. Bubble sort steps through
the list and compares adjacent pairs of elements. The elements
are swapped if they are in the wrong order. The pass through the
unsorted portion of the list is repeated until the list is sorted.
Because Bubble sort repeatedly passes through the unsorted part
of the list, it has a worst case complexity of O(n²).'''
def bubble_sort(arr):