This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: http://stackoverflow.com/questions/15182496/why-does-this-code-print-hello-world?newsletter=1&nlcode=83359%7c512e | |
System.out.println(randomString(-229985452) + " " + randomString(-147909649)); | |
public static String randomString(int i) | |
{ | |
Random ran = new Random(i); | |
StringBuilder sb = new StringBuilder(); | |
for (int n = 0; ; n++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def compare_with_ties(a, b): | |
diff = cmp(a, b) | |
return diff if diff else random.choice([-1, 1]) | |
a = {'a': 1, 'b': 2, 'c': 1, 'd':2, 'e': 1} | |
print "Initial dictionary:\n", str(a.iteritems()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def compare_with_ties(a, b): | |
diff = cmp(a, b) | |
return diff if diff else random.choice([-1, 1]) | |
a = {'a': 1, 'b': 2, 'c': 1, 'd':2, 'e': 1} | |
print "Initial dictionary:\n", str(a.iteritems()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /Applications && curl http://www.ninjamonkeysoftware.com/slate/versions/slate-latest.tar.gz | tar -xz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if all(u in POST for u in ('skill', 'description')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx -V 2>&1 | tr -- - '\n' | grep _module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/14721406/pythonic-way-to-determine-whether-not-null-list-entries-are-continuous?newsletter=1&nlcode=83359%7c512e | |
from itertools import groupby | |
def contiguous(seq): | |
return sum(1 for k,g in groupby(seq, lambda x: x is not None) if k) == 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from optparse import OptionParser | |
from collections import defaultdict | |
def run(inputWord): | |
a, states = open("avtomat.txt") ,defaultdict(list) | |
state, final= a.readline().split()[1:],a.readline().split()[1:] | |
[states[(i.split()[0], i.split()[1])].append(i.split()[3]) for i in a] | |
for letter in inputWord: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
down vote accepted | |
From http://erikvold.com/blog/index.cfm/2010/6/14/using-jquery-with-a-user-script | |
// ==UserScript== | |
// @name jQuery For Chrome (A Cross Browser Example) | |
// @namespace jQueryForChromeExample | |
// @include * | |
// @author Erik Vergobbi Vold & Tyler G. Hicks-Wright |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quicksort(lst, left=0, right=None): | |
if right is None: | |
right = len(lst) - 1 | |
l = left | |
r = right | |
if l <= r: | |
mid = lst[(left+right)/2] | |
while l <= r: | |
while l <= right and lst[l] < mid: | |
l += 1 |