This file contains 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 time | |
import sys | |
ms = int(sys.argv[1]) if len(sys.argv) > 1 else 250 | |
words, start = 0, time.time() | |
print "\n"*2 | |
try: | |
for line in sys.stdin: |
This file contains 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
------------------------------------------------------------------------------------------ | |
-- A formalization of the Cheryl's birtday problem; using Haskell/SBV | |
-- | |
-- See: http://www.nytimes.com/2015/04/15/science/a-math-problem-from-singapore-goes-viral-when-is-cheryls-birthday.html | |
-- | |
-- By Levent Erkok, This file is in the public domain. Use it as you wish! | |
-- | |
-- NB. Thanks to Amit Goel for suggesting the formalization strategy used in here. | |
------------------------------------------------------------------------------------------ |
This file contains 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
## Yacc is dead - Ruby edition (recognizer only) | |
# Pretty much a direct port of the recognizer from: | |
# http://matt.might.net/articles/parsing-with-derivatives/code/dparse.rkt | |
# | |
# Requires 1.9 | |
# gem install lazy | |
require 'lazy' | |
include Lazy::Methods |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
# | |
# simple wl generator | |
# | |
# @author: starenka | |
# @email: 'moc]tod[liamg].T.E[0aknerats'[::-1] | |
# @version: 1.0 | |
# @since 1/1/11 | |
# @requires python 2.6 |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
# | |
# @author: starenka | |
# @email: 'moc]tod[liamg].T.E[0aknerats'[::-1] | |
# @version: 1.0 | |
# @since 2/14/11 | |
# @depends DJC | |
import random, time, sys, datetime |
This file contains 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
#!/bin/bash | |
echo -n "{\"version\": \"1.1.0\",\"host\": \"maps.google.com\",\"request_address\": true,\"address_language\": \"en_GB\", \"wifi_towers\": [`iwlist scan 2> /dev/null | tr -d '\n' | sed -e 's/Cell [0-9]* - Address: \([0-9A-Z:]*\)[^C]*Channel:\([0-9]*\)[^S]*Signal level=\([0-9-]*\) dBm[^E]*E[^E]*ESSID:"\([^"]*\)"/\{"mac_address": "\1","signal_strength": \3,"age": 0,"channel": \2,"ssid": "\4"}/g' -e 's/[^{]*{/{/' -e 's/}[^{]*{/},{/g' -e 's/\}[^}]*$/\}/' `]}" | curl -s -X POST -d @/dev/fd/0 http://www.google.com/loc/json | |
# TIP: run with sudo for improved accuracy since iwlist can then provide more than the active hotspot |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import datetime | |
from pyquery import PyQuery as pq | |
doc = pq(url='http://www.jinakrajina.cz/cz/poledni-menu') | |
noms = doc.find('td > p') | |
print '\n%s'%noms[0].text_content()[2:] | |
for i,nom in enumerate(noms[1:-1:2],1): | |
print '[%d] %s'%(i,nom.text_content().strip()) |
This file contains 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
module Data.Cellular where | |
import Data.Monoid | |
import Data.Function.Memoize | |
newtype Cellular g a = Cellular { delta :: (g -> a) -> a } | |
step :: Monoid g => Cellular g a -> (g -> a) -> (g -> a) | |
step (Cellular d) init g = d (init . (g <>)) |
This file contains 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
module realize where | |
open import Relation.Nullary | |
import Data.Empty as E | |
open import Data.Product | |
open import Data.Sum | |
open import Data.Nat | |
data Term : Set where | |
var : ℕ → Term | |
lam : Term → Term |
This file contains 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 | |
import time | |
from pyquery import PyQuery as pq | |
while True: | |
def to_float(text): | |
return float(text.text.replace(',', '.')) | |
doc = pq(url='http://www.volby.cz/pls/prez2013/pe2?xjazyk=CZ') | |
OlderNewer