Skip to content

Instantly share code, notes, and snippets.

View kra3's full-sized avatar
🤠
I may be slow to respond.

Arun Karunagath kra3

🤠
I may be slow to respond.
View GitHub Profile
@kra3
kra3 / eq.preset
Created March 26, 2014 12:11
Audacious presets: ~/.config/audacious/eq.preset
[Presets]
Preset0=Classical
Preset1=Club
Preset2=Dance
Preset3=Flat
Preset4=Live
Preset5=Laptop Speakers/Headphone
Preset6=Rock
Preset7=Pop
{
"always_show_minimap_viewport": true,
"bold_folder_labels": false,
"caret_style": "phase",
"color_scheme": "Packages/User/Alpenglow (SublimePythonIDE).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Fira Code",
"font_size": 9,
"heighlight_line": true,
"heighlight_modified_tabs": true,
@kra3
kra3 / gist:7629466
Last active December 29, 2015 06:29
Compiling vim from source
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial checkinstall
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
@kra3
kra3 / gist:7398564
Created November 10, 2013 13:54
Prefix expressions [ * + 2 3 4 ]
import itertools
def do_calc(expr):
stack = []
for t in expr:
if t == '+': stack[-2:] = [stack[-1] + stack[-2]]
elif t == '*': stack[-2:] = [stack[-1] * stack[-2]]
elif t == '/': stack[-2:] = [stack[-1] / stack[-2]]
else: stack.append(t)
return stack[0]
@kra3
kra3 / gist:7398532
Created November 10, 2013 13:51
Decimal To Binary
if __name__ == "__main__":
import sys
file = open(sys.argv[1], 'r')
for i in file.read().split('\n'):
if i:
print bin(int(i))[2:]
@kra3
kra3 / gist:7398471
Last active December 27, 2015 22:19
#Multi-word Queries
#Triple Gold Star
#For this question, your goal is to modify the search engine to be able to
#handle multi-word queries. To do this, we need to make two main changes:
# 1. Modify the index to keep track of not only the URL, but the position
# within that page where a word appears.
#Spelling Correction
#Double Gold Star
#For this question, your goal is to build a step towards a spelling corrector,
#similarly to the way Google used to respond,
# "Did you mean: audacity"
@kra3
kra3 / gist:7398443
Last active December 27, 2015 22:19
#Reachability
#Single Gold Star
#Define a procedure, reachable(graph, node), that takes as input a graph and a
#starting node, and returns a list of all the nodes in the graph that can be
#reached by following zero or more edges starting from node. The input graph is
#represented as a Dictionary where each node in the graph is a key in the
#Dictionary, and the value associated with a key is a list of the nodes that the
#key node is connected to. The nodes in the returned list may appear in any
@kra3
kra3 / gist:7398352
Created November 10, 2013 13:35
udacity
#Same Structure
#Define a procedure, same_structure, that takes two inputs. It should output
#True if the lists contain the same elements in the same structure, and False
#otherwise. Two values, p and q have the same structure if:
# Neither p or q is a list.
# Both p and q are lists, they have the same number of elements, and each
# element of p has the same structure as the corresponding element of q.