Skip to content

Instantly share code, notes, and snippets.

View kdheepak's full-sized avatar

Dheepak Krishnamurthy kdheepak

View GitHub Profile
@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__':
@kdheepak
kdheepak / plot.py
Created September 2, 2016 15:51
Thread Safe Matplotlib
from matplotlib.figure import Figure
fig = Figure(figsize = (3, 3))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
@kdheepak
kdheepak / zmq_server.m
Created June 29, 2016 14:32
MATLAB ZMQ Server
% Author : Dheepak Krishnamurthy
% License : BSD 3 Clause
import org.zeromq.ZMQ;
ctx = zmq.Ctx();
socket = ctx.createSocket(ZMQ.REP);
socket.bind('tcp://127.0.0.1:7575');
ls = 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
lsa = 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, %cN>%C(reset)%C(bold yellow)%d%C(reset)' --all
kill -9 $(lsof -t -i PORTNUMBER)
@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):
@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 / 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:

while true; do
git --no-pager diff --cached
sleep 1
clear
done
while true; do
git --no-pager diff
sleep 1
clear
done