Skip to content

Instantly share code, notes, and snippets.

View nibrahim's full-sized avatar

Noufal Ibrahim nibrahim

View GitHub Profile
@nibrahim
nibrahim / calligraphy.txt
Last active August 29, 2015 14:01
Calligraphy tools
Fountain pens:
- Sheaffer calligraphy set
- Parker calligraphy set
Nib holders
- Speedball
- Cretacolour
Nibs
- Speedball

Non linear functions

Recap

  • Functions f(x) = x^2 f(x) = sin(x) f(x) = x + 5 f(x) = 2x
  • Iteration of functions f(x) = x^2
@nibrahim
nibrahim / edit.el
Created April 13, 2010 06:49
Emacs/Zsh snippet to open files an jump to a specific line
(require 'server)
(server-start)
(defun nkv-find-file-and-jump (spec)
(interactive "s")
(let ((f (car (split-string spec ":")))
(l (cadr (split-string spec ":"))))
(find-file f)
(if l (goto-line (string-to-int l)))))
@nibrahim
nibrahim / gist:466899
Created July 7, 2010 16:19
Pomodoro timer as similar to the online focus booster as a shell script
function alarm() {
# First argument is the number of minutes spent on work (one pomodoro)
# Second argument is the rest time.
# I usually invoke this as alarm 30 5 (work for 30 minutes, rest for 5)
work_time=$(echo "$1*60" | bc)
rest_time=$(echo "$2*60" | bc)
( mpg123 --loop -1 ~/scratch/clock-ticking-4.mp3 > /dev/null 2>&1 &
mpg123pid=$!
(sleep ${work_time} &&
kill $mpg123pid &&
@nibrahim
nibrahim / nkv-session.el
Created August 3, 2010 18:18
Poor mans session management for Emacs
; Cheap and dirty session management for Emacs.
; Add the location of this file to your load-path,
; Do a (require 'nkv-session) in your .emacs
; Then hit f9 to load up your session files.
; While you work, if you want to remember a file, hit f9 in the buffer.
; If you want to remember all the current open buffers, you can simply call nkv/session-save-current-buffers
; Whenever you want to save, call nkv/save-session.
; Or you can add nkv/save-session to kill-emacs-hook to save the session upon quit automatically.
; Next time, hit f9 to reload your files.
;
@nibrahim
nibrahim / pycon-plugin-presentation.tex
Created October 22, 2010 09:19
Code samples in beamer
\documentclass {beamer}
\usepackage{graphics}
\usepackage{listings}
\usetheme{Berkeley}
\title {Plugin frameworks}
\subtitle {3 approaches to designing plugin APIs}
@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
@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 / 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 / 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)