Skip to content

Instantly share code, notes, and snippets.

View kdheepak's full-sized avatar

Dheepak Krishnamurthy kdheepak

View GitHub Profile
@kdheepak
kdheepak / bokeh_linked_hovertool.py
Last active February 27, 2017 19:35
Custom HoverTool for linked hover tooltips
# Author : Dheepak Krishnamurthy
# License : BSD 3 Clause
# Title : Custom HoverTool for linked hover tooltips
# Based on example from Bokeh Docs
from bokeh.io import output_notebook, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.models import HoverTool, CustomJS
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import (bytes, str, open, super, range, zip, round, input, int, pow)
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()
@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__':
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
sleep 1
clear
done
while true; do
git --no-pager diff --cached
sleep 1
clear
done