Skip to content

Instantly share code, notes, and snippets.

View kdheepak's full-sized avatar

Dheepak Krishnamurthy kdheepak

View GitHub Profile
@kdheepak
kdheepak / EmacsClient.app
Last active August 29, 2015 14:25
Applescript for EmacsClient.app
on run {input}
try
set emacs_client_path to "usr/local/bin/"
set pathtofile to quoted form of POSIX path of input
set frameVisible to do shell script emacs_client_path & "emacsclient -e '(<= 2 (length (visible-frame-list)))'"
if frameVisible is "t" then
do shell script emacs_client_path & "emacsclient -n " & pathtofile
else
-- there is a not a visible frame, launch one
@kdheepak
kdheepak / git-loglive
Created September 15, 2015 14:57 — forked from tlberglund/git-loglive
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all $*
sleep 1
done
while true; do
git --no-pager diff --cached
sleep 1
clear
done
while true; do
git --no-pager diff
sleep 1
clear
done
@kdheepak
kdheepak / GIF-Screencast-OSX.md
Created November 6, 2015 18:40 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@kdheepak
kdheepak / README.rst
Created December 4, 2015 18:38 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@kdheepak
kdheepak / clear-port.py
Created December 21, 2015 06:47
Clear port
#!/usr/bin/env python
import sys
import subprocess
def find_pid(port):
pid = subprocess.call(['lsof', '-t', '-i', ":{}".format(port)])
return(pid)
def kill_all(list_of_ports):
kill -9 $(lsof -t -i PORTNUMBER)
@kdheepak
kdheepak / prettypandocjson.py
Created October 8, 2016 18:03
pretty print pandoc json output
#! /usr/bin/env python
import sys
import json
def main(arg):
print(json.dumps(json.loads(arg), indent=2))
if __name__ == '__main__':
import inspect
def kwargs2args(f):
argspec = inspect.getargspec(f)
no_arg_only = len(argspec.defaults) - len(argspec.args)
defaults = { argspec.args[no_arg_only+i]: d for i, d in enumerate(argspec.defaults)}
def function(*args, **kwargs):
old_args = list(argspec.args)
new_args = list()