Skip to content

Instantly share code, notes, and snippets.

@lakshmankumar12
lakshmankumar12 / inotifyexec.py
Created April 21, 2016 17:07 — forked from wernight/inotifyexec.py
inotifywait helper that executes a command on file change (for Linux, put it in ~/bin/)
#!/usr/bin/env python
"""Use inotify to watch a directory and execute a command on file change.
Watch for any file change below current directory (using inotify via pyinotify)
and execute the given command on file change.
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done`
has many issues which are fixed by this tools:
* If your editor creates a backup before writing the file, it'll trigger multiple times.
* If your directory structure is deep, it'll have to reinitialize inotify after each change.
@lakshmankumar12
lakshmankumar12 / add_key.py
Created April 21, 2016 20:25
Quick script to listen and add others public key (No longer used)
#!/usr/local/bin/python2.7
import socket
import re
def is_valid_key(data):
m = re.search(r'^ssh-rsa \S+ \S+$',data)
if m:
return True
else:

Case of Ants

Two Ants

Say A1 and A2 are respectively at a distance a and b away from the end of rods like this

             A1             A2
@lakshmankumar12
lakshmankumar12 / color_print.py
Created October 21, 2016 21:32
Quickly print all possible 16-color combo's in a linux terminal
#!/usr/bin/python
from __future__ import print_function
CSI="\x1B["
reset=CSI+"m"
colorsf = { "black" : 30, "red" : 31, "green" : 32, "yellow" : 33, "blue" : 34, "magenta" : 35, "cyan" : 36, "white" : 37}
colorsg = { "black" : 40, "red" : 41, "green" : 42, "yellow" : 43, "blue" : 44, "magenta" : 45, "cyan" : 46, "white" : 47}
diff --git a/bashrc.local b/bashrc.local
index 1f6827b..a916c23 100644
--- a/bashrc.local
+++ b/bashrc.local
@@ -1,5 +1,5 @@
export [email protected]
-alias ls='ls --color -F'
+alias ls='gls --color -F'
alias grep='egrep --color'
alias gitnp='git --no-pager'
diff --git a/gitconfig b/gitconfig
index 6f5bf4d..0f94f5b 100644
--- a/gitconfig
+++ b/gitconfig
@@ -22,7 +22,7 @@
tool = meld
renameLimit = 25000
[push]
- default = upstream
diff --git a/lakshman.vim b/lakshman.vim
index 49199bf..c0e1d99 100755
--- a/lakshman.vim
+++ b/lakshman.vim
@@ -254,17 +254,17 @@ endfunction
" functions
-nmap gGG <Esc>:call PanosTags("../tags_f")<CR>
@lakshmankumar12
lakshmankumar12 / nvim-terminal-edit.py
Last active October 19, 2020 04:04 — forked from tarruda/nvim-terminal-edit.py
Edit file in host Neovim instance from a :terminal buffer
#!/usr/bin/env python2.7
"""Edit a file in the host nvim instance."""
from __future__ import print_function
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
diff --git a/autoload/airline/themes/solarized.vim b/autoload/airline/themes/solarized.vim
index b88e1a4..76447a9 100644
--- a/autoload/airline/themes/solarized.vim
+++ b/autoload/airline/themes/solarized.vim
@@ -194,6 +194,21 @@ function! airline#themes#solarized#refresh()
let g:airline#themes#solarized#palette.replace_modified.airline_warning =
\ g:airline#themes#solarized#palette.normal.airline_warning
+ let g:airline#themes#solarized#palette.terminal = airline#themes#generate_color_map(
+ \ [s:R1[0].g, s:R1[1].g, s:R1[0].t, s:R1[1].t, s:R1[2]],
#!/usr/bin/python
from __future__ import print_function
import re
import sys
import json
import collections
import os
try: