I hereby claim:
- I am miikka on github.
- I am miikka (https://keybase.io/miikka) on keybase.
- I have a public key whose fingerprint is 0753 C3DA 748E DA91 AAB1 E35E 8005 E0EB BCB7 E306
To claim this, I am signing this object:
| #!/bin/sh | |
| # Etsitään tiedostot hakemistosta foo ja siirretään ne hakemistoon bar | |
| find foo -type f -exec mv {} bar \; | |
| # Vaihtoehtoinen tapa, joka lienee nopeampi jos on paljon tiedostoja: | |
| find foo -type f -print0 | xargs -0 -n 25 mv -t bar | |
| # Tiedostot on siirrety pois foosta, poistetaan foo | |
| rm -r foo |
| #!/usr/bin/env python | |
| import fnmatch | |
| from ftplib import FTP | |
| import os | |
| import sys | |
| class Downloader(object): | |
| destdir = '.' | |
| pattern = '*' |
| % cabal install hledger-web | |
| Resolving dependencies... | |
| Configuring hledger-web-0.22.1... | |
| Building hledger-web-0.22.1... | |
| Preprocessing library hledger-web-0.22.1... | |
| Application.hs:31:7: | |
| warning: missing terminating ' character [-Winvalid-pp-token] | |
| -- Don't forget to add new modules to your cabal file! | |
| ^ |
| var x = cos * sideHexOffset - sin * (vertHexOffest + sideVertHexOffset); | |
| var y = cos * (sideVertHexOffset + vertHexOffest) + sin * sideHexOffset; | |
| #!/bin/bash | |
| # Intearctively select one of the recent branches and checkout it. | |
| set -e | |
| git rev-parse --is-inside-work-tree >/dev/null | |
| git checkout $(git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | fzf -q "$*") |
I hereby claim:
To claim this, I am signing this object:
| """A sketch of parser combinators for Python. | |
| I wanted to parse a recursive list of words with Python-like syntax, for | |
| example: | |
| [foo, [bar, baz], quux] | |
| Using an external library would have been too hard and complicated. | |
| Unfortunately this didn't end up being very beautiful, either. Check out the | |
| definition of wordlist(). Ugh. |
| """This is a sketch of implementing pattern matching of lists. | |
| """ | |
| from collections import namedtuple | |
| # Destructuring lists | |
| # | |
| # In a destructuring pattern: | |
| # | |
| # * V('foo') matches a value and assigns it to foo |
See also: http://en.wikipedia.org/wiki/Moralistic_therapeutic_deism
| import inspect | |
| DONE_ONCE = set() | |
| def only_once(): | |
| """Use as a generator to run a block only once.""" | |
| frame = inspect.stack()[1] | |
| # frame is (frame object, path, line, ...) | |
| key = (frame[1], frame[2]) |