Skip to content

Instantly share code, notes, and snippets.

Three steps to debug any problem

1. Define and reproduce the problem reliably

  • Make sure you know exactly what data or outcome is wrong
  • Make sure you can make that happen on demand

2. Methodically print out (or otherwise inspect) the relevant data at each step going backwards from where the error is

  • Keep doing this until you reach a point where the data matches your expectations
@dfkoh
dfkoh / git_show_merge.sh
Created January 6, 2017 13:05
Find out if a merge commit had merge conflicts
#!/usr/bin/env bash
base_commit=$1
first_parent=$(git cat-file -p $base_commit | grep 'parent' | cut -d' ' -f2 | sed -n '1p')
second_parent=$(git cat-file -p $base_commit | grep 'parent' | cut -d' ' -f2 | sed -n '2p')
merge_base=$(git merge-base $first_parent $second_parent )
if git merge-tree $merge_base $first_parent $second_parent | grep '<<<<<<< .our'; then
#!/usr/bin/env python3
"""
Automatically runs on the first post in on the /r/redditchi subreddit.
Install praw ('pip install praw') in order to use this script.
Needs an updated list to give the in-game name of each claimant, otherwise it
defaults to reddit names. Will report any conflicts that it finds.
"""
import re

Keybase proof

I hereby claim:

  • I am dfkoh on github.
  • I am david (https://keybase.io/david) on keybase.
  • I have a public key ASCwiSKOzfQSNvZPOpFR5UjAyMrqAPwL1JrYn0NInw-nQAo

To claim this, I am signing this object:

import sys
# M=int(next(s))+1
# j=Z=M*M-M
# S=s.read(Z)
# P=0
# b=[0]*3
# I need N+1 more than N
N = int(sys.stdin.readline())
function color_ctrl256()
{
attr=$1
echo -ne "\033[38;5;${1}m"
}
echo "256 COLOR"
j=0
while [ "$j" -lt 256 ]; do