Skip to content

Instantly share code, notes, and snippets.

#!/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
-- 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;
int cmp_vec128(const void *va, const void *vb) {
#if defined(__amd64) && defined(__SSE2__) && defined(__GNUC__)
/*
* 128-bit SSE2 compare
* if *va == *vb
<?php
# ex: set ts=4 et:
# dal#php GoogleGuy
# http://www.srwebstudio.com/applications/uptime/
import List
import Data.List (intercalate)
data WordHGram = WordGram [(Char,Int)]
instance Show WordHGram where
show w = intercalate "," [ [c] ++ ":" ++ show(n) | (c,n) <- w ]
# 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
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]
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
'''