Skip to content

Instantly share code, notes, and snippets.

View swapi's full-sized avatar
🏊‍♂️
Swimming

Swapnil swapi

🏊‍♂️
Swimming
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@swapi
swapi / All About VIM.md
Last active August 29, 2015 14:14
VIM Session

All About VIM

  1. History

    ex -> vi -> vim -> (gvim/macvim) -> neovim
  2. Modes - normal (ESC), editing (insert, i), visual

  3. Language

    a. Movement - h, j, k, l, w, b, e, ^, 0, $, gg, G, number powerd movement b. Editing Start - i, a, I, A, o, O c. Text operations - y, p, d, yank-register, r, . verb-motion d. Misc - f, F, %, *, #
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
#run this in bash. somehow the wildcards dont work on zsh
#for nemo file manager instead of nautilus
sudo add-apt-repository ppa:noobslab/mint
#for latest git.
sudo apt-add-repository ppa:git-core/ppa
#for gnome-shell... cos unity will suck up all your memory
#plus https://extensions.gnome.org/ !!!
@swapi
swapi / .vimrc
Created February 5, 2014 05:49
VIMRC file
set gfn=Courier_New
set nobackup
filetype plugin indent on " required!
set laststatus=2 " Always show the statusline
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
set mouse=a
set tabstop=4
@swapi
swapi / Automata.txt
Created November 24, 2013 20:08
Automata
I have personally enjoyed several Aha! moments from studying basic automata theory. NFAs and DFAs form a microcosm for theoretical computer science as a whole.
Does Non-determinism Lead to Efficiency? There are standard examples where the minimal deterministic automaton for a language is exponentially larger than a minimal non-deterministic automaton. Understanding this difference for Turing machines is at the core of (theoretical) computer science. NFAs and DFAs provide the simplest example I know where you can explicitly see the strict gap between determinism and non-determinism.
Computability != Complexity. NFAs and DFAs both represent regular languages and are equivalent in what they compute. They differ in how they compute.
Machines Refine Languages. This is a different take on what we compute and how we compute. You can think of computable languages (and functions) as defining an equivalence class of automata. This is a fundamental perspective change in TCS, where we focus not just on the what, but the
@swapi
swapi / checker.sh
Last active December 27, 2015 03:09
Waiting for the Nexus 5
#!/bin/sh
while [ true ]; do
found=`curl --no-progress-bar "https://play.google.com/store/devices/details/Nexus_5_32GB_Black?id=nexus_5_black_32gb" 2> /dev/null | grep "Coming soon" | wc -l`
if [ $found -eq "0" ]; then
python ~/gcsms.py send
if [ $? -eq 0 ]; then
break
else
python ~/gcsms.py send
fi
@swapi
swapi / large_sum
Created October 11, 2013 19:15
Max Consecutive Sum
def large_sum(el):
class _helper:
large_pos = len(el)
current_pos = len(el)
large = []
current = []
h = _helper()
def _large_sum(_el, pos):
if pos == len(_el) - 1:
h.large_pos -= 1
@swapi
swapi / .bash_profile
Created August 13, 2013 13:00
Bash PS1
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u@\h:\w\$(parse_git_branch) $ "
@swapi
swapi / vlcrc.py
Created July 5, 2013 19:29
VLC Remote Control for Pebble Watch
#Dependency:
#-libpebble with other required libs (e.g. lightblue etc)
#-py-vlcclient (https://github.com/DerMitch/py-vlcclient.git)
#it is assumed that pebble is already paired.
from vlcclient import VLCClient
import pebble as libpebble
import sys
import time