Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@newgiin
newgiin / toptags.py
Created March 25, 2014 01:25
Test artist.gettoptags last.fm service
import time
import json
import urllib2
while True:
url = 'http://ws.audioscrobbler.com/2.0/?method=artist.gettoptags&artist=Example&api_key=24836bd9d7043e3c0bc65aa801ba8821&format=json'
res = json.load(urllib2.urlopen(url))
if 'toptags' not in res:
print res # should never get here!
time.sleep(.2)
@newgiin
newgiin / flashproxy.diff
Created January 18, 2014 18:35
Diff between my flashproxy.js and that served on http://crypto.stanford.edu/flashproxy/embed.html.
69c69
< var DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL = DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL || 60.0;
---
> var DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL = DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL || 5.0;
472a473,485
> /*
> * A FlashProxy.
> *
> * start() starts the FlashProxy.
> *
let g:ophigh_color = "#F92672"
" Copyright (C) 2011 by Strahinja Markovic
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to deal
" in the Software without restriction, including without limitation the rights
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
" copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
@newgiin
newgiin / sublime.vim
Created September 6, 2013 19:43
A modified Monokai vim colorscheme that emulates the Monokai in Sublime Text 2.
" Vim color file
" Original: Damien Gombault <desintegr@gmail.com>
" WWW: http://desintegr.googlecode.com/svn/config/vim/colors/monokai.vim
" Forked by: Andrew Nguyen <atnguyen4@gmail.com>
" Last Change: 2013 Aug 6
" Version: 0.2.0
set background=dark
hi clear
@newgiin
newgiin / .vimrc
Last active December 22, 2015 11:58
vim configs
colorscheme sublime
set guifont=Consolas:h11:cANSI
set nobackup
set expandtab
set tabstop=4
set nu
set cursorline
@newgiin
newgiin / Sublime_Monokai.xml
Last active June 29, 2018 20:43
This theme emulates the Monokai theme found in the Sublime Text 2 editor. Must enable global-{font, fontsize, bold} and global background colour.
<?xml version="1.0" encoding="Windows-1252" ?>
<!--
Notepad++ Custom Style
Style name: Sublime Monokai
Author: Andrew Nguyen, Joni Eskelinen
Date: 2009-04-06 (last changed 2013-08-29)
Languages: php, html, css, xml, javascript, python, sql, c, c++,
assembly, bash, batch, lua at least for detail. Everything else more or less...
Info: Using Joni Eskelinin's Obsidian theme as a base, this theme
import sys
import re
import shutil
f = open(sys.argv[1], 'r')
buf_file = open('probs/temp.py', 'w')
prob_pat = re.compile('^def (e_[0-9]+)\(\):')
e_name = ''
in_e = False
@newgiin
newgiin / dp.py
Last active December 17, 2015 16:29
Some solutions for some dynamic programming problems.
def build_adj_matrix(arr):
"""
Returns an adjacency matrix where elements a_0..a_i
, where i < j, are considered adjacent to a_j if
a_i < a_j.
"""
result = {}
for i in xrange(len(arr)):
result[i] = []
for j in xrange(i):