Skip to content

Instantly share code, notes, and snippets.

@keyan
keyan / timelapse.zsh
Last active August 29, 2015 14:15 — forked from jamak/timelapse.zsh
#! /bin/zsh
TIME=$1
FNAME=$2
# if [[ $# != 3]] then;
# echo "USAGE: $0 time_interval filename"
# exit 2
# fi
if [[ -f $FNAME ]]; then

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

@keyan
keyan / sudo_sync.sh
Created November 19, 2015 20:12
No password sudo file transfer
rsync --rsync-path="sudo rsync" <LOCALFILE> USER@SERVER2:/root
@keyan
keyan / du_largest_dirs
Last active December 17, 2015 17:46
Find biggest files on unix
for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11
@keyan
keyan / nginx.md
Created December 18, 2015 01:00
NGINX master process death while workers continue to run

Find list of processes and connections: lsof -i

Kill worker processes sudo pkill nginx

Restart nginx sudo service nginx restart

Good logs to check:

Keybase proof

I hereby claim:

  • I am keyan on github.
  • I am keyan (https://keybase.io/keyan) on keybase.
  • I have a public key whose fingerprint is A21E A921 67E1 590D E6B0 A8B1 5044 7512 A692 A558

To claim this, I am signing this object:

how do I make git stop looking for changes in a file?

$ git update-index --assume-unchanged

@keyan
keyan / System Design.md
Created April 18, 2016 03:05 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Interview Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@keyan
keyan / gist:407e3d1090a11b9f4f30d48c81bf1141
Created June 23, 2016 18:25
Rook standard deck variant rules
Rook - Standard Deck Variant
Step One: Beginning
First, the simple and straightforward stuff, for completeness.
The four players should sit around a card table or suitable substitute, partners sitting across from each other. Deal out the first 52 cards, placing the 53rd face down in the center. (Each person should now have 13 cards. Duh.) Arrange your cards in suit order without telling any other player what you have. (Don't worry about what the joker (or "rook") means just yet.) Now we are ready to bid.
Step Two: Bidding
After the cards are dealt, players bid for the right to call trump. Starting with the player to the left of the dealer and going around clockwise, each player either makes a bid, or passes. A player who passes may not re-enter the bidding. This process continues until three players have passed; the fourth is the winner of the bid. The winner gets to call trump (but not just yet! First, I must explain bidding a bit more).
@keyan
keyan / gist:3b8835b65309607ff0d70e10a27235ae
Created July 20, 2016 23:36
MySQL -- order all active queries by time
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Time;