Skip to content

Instantly share code, notes, and snippets.

View kdheepak's full-sized avatar

Dheepak Krishnamurthy kdheepak

View GitHub Profile
# Change prefix key to `
unbind C-b
set -g prefix `
bind-key ` send-prefix
bind-key C-a set-option -g prefix C-a
bind-key C-b set-option -g prefix `
# we might need ` at some point, allow switching
bind-key C-a set-option -g prefix C-a
# Better Logging Format
## Author : Dheepak Krishnamurthy
## License : MIT
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter('%(asctime)s - [%(module)s(%(lineno)d)] - "%(name)s".%(levelname)s - %(message)s', "%Y-%m-%d %H:%M:%S")
ch.setFormatter(formatter)
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
@kdheepak
kdheepak / Py_Macro_PyCall.ipynb
Created August 30, 2017 08:09
A @py macro for Python-like syntax in Julia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | Where-Object {
$_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID")
} | Select-Object -ExpandProperty PSChildName
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# set -o errexit
# set -o pipefail
# set -o nounset
def __repr__(self):
return '<%s.%s object at %s>' % (
self.__class__.__module__,
self.__class__.__name__,
hex(id(self))
)
@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()