{{ message }}

Instantly share code, notes, and snippets.

🦉
Someone here is possessed by an owl. Who?

🦉
Someone here is possessed by an owl. Who?
Created Aug 16, 2011
View gist:1149737
 We actually need more words, as entropy of the words is less than characters. Suppose there is about 50000 words (There is 301 000 main entries in OED). Than 50000^x > 94^13 => x => 5.5 So i would say that "balloons are very nice" < "@\$XsBv2JMc473" Also entropy of word like "are" is almost zero, so predictable.
Created Aug 9, 2012
Keulii
View maybe.cc
 // works with clang++ bundled with xcode 4.4 // clang++ -std=c++11 -stdlib=libc++ maybe.cc -o maybe #include #include // didn't realize how to make this a class to hide members template struct maybe { // private:
Created Sep 25, 2012
Viikkotehtävä 1
View viikko1.hs
 {- 110 viikkovisa #1 --------------------------- Piirretään ruutupaperille numeroita myötäpäivään "ympyrään" alkaen vasemmasta yläkulmasta: 1 ... 1 2 ...
Created Sep 27, 2012
Testit vs Proof
View Take.md

```import Prelude hiding (take)

import Test.QuickCheck

take :: Int -> [a] -> [a]
take _ []     = []
take 0 _      = []```
Created Sep 28, 2012
Viikkotehtävän neliöhuijauksen todistus!
View Vikko1.v
 Theorem plus_comm : forall (n m : nat), n + m = m + n. Proof. intros n. induction n as [| n']. (* case n = 0 *) intros m. rewrite <- plus_n_O. rewrite -> plus_O_n. trivial. (* case n = S n' *) intros m. rewrite <- plus_n_Sm. rewrite -> plus_Sn_m. apply eq_S. apply IHn'. Qed.
Created Oct 8, 2012
lrevl l <-> pal l
View gist:3853458
 Require Export Poly. Inductive pal {X:Type} : list X -> Prop := | pal_nil : pal nil | pal_singleton : forall x:X, pal [x] | pal_cons_snoc : forall (x:X) (l : list X), pal l -> pal (x :: snoc l x). Inductive lrevl {X:Type} : list X -> Prop := | pal_lrevl : forall (l : list X), l = rev l -> lrevl l.
Created Oct 30, 2012
Docopt.hs - parsing command line options <=> matching a regexp
View Docopt.hs
 module Docopt where import System.Environment (getArgs) import Regexp data DocoptResult = DocoptCommand Bool | DocoptPositionalArg (Maybe String) | DocoptRepatableArg [String] | DocoptFlag Bool
Created Nov 1, 2012
View gist:3994045
`% cat test2.py`
```"""
Usage:
test2.py [options] <file>...

Options:```
Created Nov 1, 2012
View gist:3994121
`% cat tar.py`
```"""
Usage:
tar [-c] [options] <files>...
tar [-r | -u] -f ARCHIEVE [options] <files>...
tar [-t | -x] [options] [<patterns>...]```
Last active Dec 12, 2015
How to do transactions with indexedDb using promises?
View getExample.js
 // Using moreUsable.js style indexedDB.open(DBNAME, DBVERSION, DBSCHEMA) .then(function(connection) { return connection.transaction(["table1"]) // undefined -> readonly, state undefined also .then(function(obj) { return obj.transaction.get(obj.state, "table1", "foo"); }) .then(function(obj) { return obj.state; });