Skip to content

Instantly share code, notes, and snippets.

@punchagan
punchagan / fetch_gh_issues.py
Created August 15, 2013 12:59
Simple Issue fetching from GitHub
import github
import codecs
from getpass import getpass
passwd = getpass()
gh = github.Github('punchagan', passwd)
o2b = gh.get_repo('punchagan/org2blog')
open_issues = list(o2b.get_issues(state='open'))
@punchagan
punchagan / nikola-tag-completion.el
Last active December 23, 2015 11:29
Tag completion for Nikola in emacs
;; Get tags used in the nikola site, using the tags plugin.
(defun nikola-tags-get ()
"Get the current tags in the site, given the site path."
(let* ((nikola-command
"/home/punchagan/.virtualenvs/ultimatesport/bin/nikola")
(nikola-site (file-name-directory
(directory-file-name
(file-name-directory
(or (buffer-file-name (current-buffer)) "/")))))
(tags (shell-command-to-string
@punchagan
punchagan / avg_pore_dia.py
Created October 13, 2013 13:13
A simple script to calculate average pore diameter.
""" A simple script to calculate average pore diameter.
Written for Ayush on 13th Oct 2013.
Usage: python avg_pore_dia.py </dir/containing/pore-files>
This script assumes that the pore files are .txt files. Point the
script to a directory containing all your pore files, and it should
print out the average pore diameter from all the files.
@punchagan
punchagan / import-links-as-posts.py
Last active December 25, 2015 11:39
Scripts to import blog from o-blog to Nikola.
@punchagan
punchagan / practice.dot
Last active January 2, 2016 00:29
Practice Sessions flow chart
digraph {
label="Ideas for practice for 1 or 2 players."
labelloc="top"
node[shape="box", style="rounded"]
start; end;
node[shape="box", style="solid"]
wait2;condition;find_pole;kung_fu;yes_lying;usual;
node[shape="parallelogram", style=""]
@punchagan
punchagan / backend_fogbugz.py
Created January 16, 2014 15:02
GTG Backend for FogBugz
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
@punchagan
punchagan / org-column-new-row.el
Last active June 2, 2016 05:43
org-columns add row
(org-defkey org-columns-map "N" 'pc/org-columns-new-row)
(defun pc/org-columns-new-row (&optional key)
"Allow adding a new row."
(interactive)
(save-excursion
(save-restriction
(org-beginning-of-line)
(org-with-silent-modifications
(org-insert-heading)
@punchagan
punchagan / video-loopback
Created March 29, 2014 18:05
Brighter video, thanks to video loopback and gstreamer
#!/bin/bash
MODULE=v4l2loopback
if grep -q $MODULE /proc/modules;
then
echo $MODULE already loaded
else
echo loading $MODULE
sudo modprobe $MODULE
@punchagan
punchagan / *scratch*.el
Created June 21, 2016 20:54
Org drill related code
(defun my/org-drill (tag)
(interactive "MTag: ")
(let ((org-drill-tag tag))
(call-interactively #'org-drill)))
@punchagan
punchagan / elfeed-url-bookmarklet.js
Created June 11, 2016 13:25
Elfeed org-capture bookmarklet
javascript:(function(){
var url_element =
document.querySelector('link[type="application/rss+xml"]') ||
document.querySelector('link[type="application/atom+xml"]') ||
location;
var url = url_element.href;
location.href = 'org-protocol://capture://L/'+
encodeURIComponent(url)+'/'+
encodeURIComponent(document.title);
})();