Skip to content

Instantly share code, notes, and snippets.

View nibrahim's full-sized avatar

Noufal Ibrahim nibrahim

View GitHub Profile
@nibrahim
nibrahim / home.geojson
Created January 27, 2017 09:40 — forked from geohacker/home.geojson
I've finally arrived in Bangalore
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nibrahim
nibrahim / line-length-sort.el
Created October 22, 2010 10:34
Sort lines by length
(defun sort-lines-by-length (b e)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region b e)
(let ((items (sort
(split-string
(buffer-substring (point-min) (point-max)) "[\n]")
(lambda(x y) (< (length x) (length y)))))
)
@nibrahim
nibrahim / accounts-budget.dat
Last active February 25, 2016 17:53
Ledger sample input with budget
;-*-ledger-*-
~ Monthly
Expenses:Rent 5000 Rs
Expenses:Groceries 3500 Rs
Expenses:Domestic 4000 Rs
Expenses:Electricity 1500 Rs
Expenses:Entertainment 2000 Rs
Expenses:Food 1000 Rs
Expenses:Fitness 500 Rs
Expenses:Hosting 2500 Rs
@nibrahim
nibrahim / story.ni
Created February 24, 2016 04:36
Kraal's release
"Kraal's release" by "Noufal Ibrahim"
The story genre is "Horror".
Release along with an interpreter.
Release along with cover art ("A ring").
when play begins:
display the boxed quotation "The oldest and strongest emotion of mankind is fear.
@nibrahim
nibrahim / gist:8450759
Created January 16, 2014 06:43
Build when project changes
watch_build () {
while inotifywait -r -e modify $*
do
make
done
}
@nibrahim
nibrahim / Runs
Created August 19, 2013 04:40
gcc failing to give warnings
# With gcc
noufal@sanitarium% CFLAGS=-Wall make foo
cc -Wall foo.c -o foo
# With clang
noufal@sanitarium% CFLAGS=-Wall CC==clang make foo
/home/noufal/local/bin//clang -Wall foo.c -o foo
foo.c:7:9: warning: variable 'iters' is uninitialized when used here [-Wuninitialized]
while(iters++ <= 100) {
@nibrahim
nibrahim / Shell functions
Last active December 20, 2015 10:59
Git repository visualisation.
showrepo () {
img=$(tempfile -s.png)
~/bin/showrepo.rb $1 | dot -Tpng > $img
echo $img
qiv $img
}
showdag () {
img=$(tempfile -s.png)
@nibrahim
nibrahim / accounts.dat
Last active November 7, 2015 12:42
Sample ledger input file
2015/11/01 Initial balance
Assets:Business 50000 Rs
Assets:Savings 15000 Rs
; Some amount still there on the credit card
Liabilities:CC -2500 Rs
Equity
2015/11/01 Personal Salary
; I give myself a fixed amount of money at the beginning
@nibrahim
nibrahim / python-stop-here.el
Created December 14, 2011 07:31
Creating pdb breaks in a python file
(defun nkv/stop-here (pos)
(interactive "d")
(let (
(trace-command "import pdb; pdb.set_trace()")
)
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(search-forward trace-command nil t)
@nibrahim
nibrahim / pygments-pygame.py
Created January 9, 2011 20:40
Using pygments to highlight code for use in pygame
#!/usr/bin/env python
import pygame
from pygame.locals import *
from pygame.color import Color
from pygments.lexers import PythonLexer
from pygments.styles.emacs import EmacsStyle