Skip to content

Instantly share code, notes, and snippets.

@punchagan
punchagan / gist:836799
Created February 21, 2011 08:07
Archive DONE items to datetree based on CLOSED time
(defadvice org-archive-subtree
(around org-archive-subtree-to-data-tree activate)
"org-archive-subtree to date-tree"
(if (org-entry-is-done-p)
(let* ((dct (decode-time
(org-time-string-to-time
(cdar (org-entry-properties nil 'special "CLOSED")))))
(y (nth 5 dct))
(m (nth 4 dct))
(d (nth 3 dct))
@punchagan
punchagan / pidgin-countdown.sh
Created March 28, 2011 11:28
Update pidgin status message periodically with a countdown timer.
#!/bin/bash
upto=`date -d "Mar 30 14:30" +%s`
text="to go!"
while true; do
now=`date +%s`
count=`expr $upto - $now`
hours=`expr $count / 3600`
minutes=`expr $count % 3600 / 60`
@punchagan
punchagan / qotd.sh
Created November 29, 2011 18:13
Pick a random image from a directory and annotate the text message onto it.
#!/bin/bash
# Usage ./qotd.sh "This is sample text"
# Depends
# - Gnome2/3
# - ImageMagick
# TODO
# - Add intelligent font color selection
@punchagan
punchagan / customize.sh
Created January 19, 2012 17:09
Ubuntu Customization Script (custom package list for education/children)
#!/bin/sh
# Links to pages listing interesting packages
# https://help.ubuntu.com/community/UbuntuScience
# http://www.lifehack.org/articles/technology/linux-for-children.html
# http://www.edubuntu.org/news/11.10-release (get package list?)
@punchagan
punchagan / android_lock.py
Created June 3, 2012 12:56
Calculate possible combinations of Android pattern lock
##############################################################################
# R - Red, B- Blue, G-Green
# We name vertices as follows:
# R B R
# B G B
# R B R
##############################################################################
@punchagan
punchagan / test.md
Created July 20, 2012 14:09
Testing gist.io for source code support

Test Code here

for i in range(10):
    print i

No support for code blocks. gist.io should really be using github's markdown!

@punchagan
punchagan / scroll.el
Created October 5, 2012 14:11
Normal scrolling for emacs
(defun bhanu/scroll-up (&optional num)
"Scroll up num number of lines."
(interactive "p")
(scroll-down num)
(previous-line num))
(defun bhanu/scroll-down (&optional num)
"Scroll down num number of lines."
(interactive "p")
(scroll-up num)
@punchagan
punchagan / issue_plot.py
Last active October 11, 2015 16:38
Simple script to plot Github turn around time
#!/usr/bin/env python
from github import Github
from datetime import datetime
from pylab import plot, show, figure, legend, title, ylabel
def set_repo_name(repo_name, username):
if '/' in repo_name:
return repo_name
else:
return "%s/%s" %(username, repo_name)
@punchagan
punchagan / gh_to_csv.py
Created October 18, 2012 05:26
Github issues to a CSV file.
#!/usr/bin/env python
# Written for an import to Pivotal Tracker
from github import Github
FMT = 'Story,Labels,Story Type,Created at,Requested By,Owned By,Description,Comment'
PT_GH_map = {
'story': 'title',
'labels': 'labels',
'story type': 'type',
@punchagan
punchagan / gh-ipynb.user.js
Last active October 8, 2017 00:02
GitHub IPynb rendering
// ==UserScript==
// @name GitHub IPynb rendering
// @namespace ghipynb
// @version 0.3.1
// @description Renders raw IPython notebooks on GitHub using nbviewer and Frames!
// @license WTFPL
// @match *://*.github.com/*
// @match *://github.com/*
// @match *://gist.github.com/*
// @grant none