Skip to content

Instantly share code, notes, and snippets.

View prafulfillment's full-sized avatar
🐶
Speaking to 🐶 & 🐬

praful mathur prafulfillment

🐶
Speaking to 🐶 & 🐬
View GitHub Profile
@prafulfillment
prafulfillment / fibonacci_number.py
Last active December 9, 2015 23:18
Fibonacci Number methods w/timing
import timeit
#import sys
# Implementation:
def matmult(A, B):
# multiplies 2x2 matrix
def val(i, j):
return (A[i][0] * B[0][j]) + (A[i][1] * B[1][j])
return ((val(0, 0), val(0, 1)),
@prafulfillment
prafulfillment / docopt_httpie
Created February 5, 2013 03:26
Trying to implement HTTPie's CLI with docopt.
#!/usr/bin/env python
"""
usage: http [METHOD] <URL> [REQUEST ITEM [REQUEST ITEM ...]]
HTTPie - cURL for humans. <http://httpie.org>
Positional arguments:
These arguments come after any flags and in the order they are listed
here. Only URL is required.
@prafulfillment
prafulfillment / test_fib
Last active December 12, 2015 06:59
Testing out various versions of nested & unnested of fibonacci
fibonacci_memo
0.268512010574
fibonacci_memo_nested
11.6659519672
Diff: 11.3974399567
Ratio: 43.4466672172
----------------------------------------
@prafulfillment
prafulfillment / arandr.md
Last active December 14, 2015 13:09
Quick fix that deals with resolutions such as '900_59.90' that xrandr produces.

Arandr Fix

Fixing the arandr issue which depended on all modes to have a <width>x<height> name.

Bug report

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507521

Bugs / Caveats

Changes while running are not caught.

  • Versions before 0.1.7 depended on all modes to have a x name (see debian bug #507521); if ARandR does not start up, please install the latest version. (On different bugtrackers, this is called the ValueError / "1080p" / "1024x768i" problem).
  • See TODO for planned features.
" ===================================================
" P R A F U L ' S V I M R C
" ===================================================
" ================ Vundle ======================
" Setting up Vundle - the vim plugin bundler
let iCanHazVundle=1
let vundle_readme=expand('~/.vim/bundle/vundle/README.md')
# set your user tokens as enivornment variables, such as ~/.secrets
# See the README for examples.
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
! escape = caps_lock; caps_lock = control_l; control_l = escape
!keycode 37 = Control_L
!keycode 66 = Caps_Lock
!keycode 9 = Escape
!remove Lock = Caps_Lock
!add Lock = Escape
!remove Control = Control_L
!add Control = Caps_Lock
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
#set -g default-terminal screen-256color
set -g default-terminal "screen-256color"
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
@prafulfillment
prafulfillment / apply_sabotage.py
Last active December 15, 2015 01:48
Testing out pytest.
import pytest
######### CONSTANTS #########
TIMEOUT = 10
######### TEST #########
@pytest.mark.timeout(TIMEOUT)
def test_func(assert_stmt, func_to_test, apply_penalties):
# Track global vars
@prafulfillment
prafulfillment / tollbooth_out_osm
Created April 2, 2013 23:35
How does lat/lon work in OSM?
id | lat | lon | tags
------------+-----------+------------+------------------------------------------------------------
356727456 | 471488295 | -861308679 | {barrier,toll_booth}
356742659 | 471231474 | -859785100 | {barrier,toll_booth}
356894354 | 471719801 | -861979645 | {barrier,toll_booth}
356894449 | 471652531 | -861890538 | {barrier,toll_booth}
356898029 | 472134064 | -862510737 | {barrier,toll_booth}
356898417 | 472324101 | -862721481 | {barrier,toll_booth}
440262751 | 438468665 | -848306075 | {barrier,toll_booth}
443801422 | 450912481 | -863370725 | {barrier,toll_booth}