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 random import choice | |
import unittest | |
''' | |
test: python -m unittest luckydeuce.py | |
run: python luckydeuce.py | |
ref: http://thedailywtf.com/articles/introducing-the-lucky-deuce | |
ref: https://en.wikipedia.org/wiki/Roulette#Roulette_wheel_number_sequence | |
''' |
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
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-54-generic] (local build) | |
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org | |
=== START OF INFORMATION SECTION === | |
Model Family: Seagate Momentus Thin | |
Device Model: ST320LT007-9ZV142 | |
Serial Number: W0Q46EXJ | |
LU WWN Device Id: 5 000c50 0496506cc | |
Firmware Version: 0004LVM1 | |
User Capacity: 320,072,933,376 bytes [320 GB] |
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
# ex: set ts=2: | |
# | |
# Copyright Ryan Flynn <parseerror@gmail.com> | |
# Released under Public Domain. Use it! Credit would be nice. | |
# | |
# IdealHumanRandomIterator - select "random" members of a population, favoring | |
# those least-recently selected, to appease silly humans who hate repeats | |
# | |
# Abstract: | |
# given a decently-sized set of items (say, 100 famous quotes), an |
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 List | |
import Data.List (intercalate) | |
data WordHGram = WordGram [(Char,Int)] | |
instance Show WordHGram where | |
show w = intercalate "," [ [c] ++ ":" ++ show(n) | (c,n) <- w ] |
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
<?php | |
# ex: set ts=4 et: | |
# dal#php GoogleGuy | |
# http://www.srwebstudio.com/applications/uptime/ | |
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
int cmp_vec128(const void *va, const void *vb) { | |
#if defined(__amd64) && defined(__SSE2__) && defined(__GNUC__) | |
/* | |
* 128-bit SSE2 compare | |
* if *va == *vb |
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
-- 15:47 <@comcor> I want to pull all records in english where there isn't a value available in ru | |
-- 15:47 <@comcor> but when there is a value in ru, I only want the ru | |
create table foo(id int, lang text); | |
insert into foo values(1,'en'); | |
insert into foo values(2,'ru'); | |
insert into foo values(3,'en'); | |
insert into foo values(3,'ru'); | |
select id,lang from foo; | |
select "desc",x.id,x.lang from (select id,lang from foo order by id,lang desc)as x group by id; |
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
#!/usr/bin/env python | |
# ex: set ts=4 et: | |
# calculate the most common phrases in text | |
# use: python common-phrase.py < /usr/share/dict/words |