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
""" | |
Carlo Hamalainen <carlo.hamalainen@gmail.com> | |
Given a directory of shapefiles, e.g. | |
$ ls /path/to/shapefiles/ | |
Project_Name.dbf | |
Project_Name.prj | |
Project_Name.sbn | |
Project_Name.sbx |
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 getpass | |
import hashlib | |
import random | |
import string | |
password = getpass.getpass('password (not echoed): ') | |
salt = ''.join(random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for x in range(32)) | |
password_hash = hashlib.md5(password + salt).hexdigest() | |
print "update CHANGEME_users set password='" + password_hash + ':' + salt + "' where id = ...;" |
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
-- Easiest way to run this with ghci: | |
-- | |
-- ghci -XDataKinds -XGADTs -XEmptyDataDecls -XKindSignatures -XScopedTypeVariables -XTemplateHaskell | |
-- Natural numbers, e.g. | |
-- 0 == Z | |
-- 1 == S Z | |
-- 2 == S (S Z) | |
-- 3 == S (S (S Z)) | |
-- etc |
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
######### blah.py ######### | |
from time import sleep | |
from celery import Celery | |
from celery.task import Task | |
import logging | |
import traceback | |
import time |
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
-- Before: | |
commentForm :: EntryId -> Form Comment | |
commentForm entryId = renderDivs $ Comment | |
<$> pure entryId | |
<*> aformM (liftIO getCurrentTime) | |
<*> aformM requireAuthId | |
<*> areq textField (fieldSettingsLabel MsgCommentName) Nothing | |
<*> areq textareaField (fieldSettingsLabel MsgCommentText) Nothing | |
-- Adding the ReCAPTCHA form, we just append "<* recaptchaAForm": |
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
# Artificial example (averaging and then dumping) using the new | |
# MINC interface in Nipype. | |
# | |
# Carlo Hamalainen <carlo@carlo-hamalainen.net> | |
import os | |
import nipype.interfaces.minc as minc | |
import nipype.interfaces.io as nio | |
import nipype.interfaces.utility as util | |
import nipype.pipeline.engine as pe |
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
{- | |
Response to http://lists.samba.org/archive/linux/2013-November/032604.html | |
and http://lists.samba.org/archive/linux/2013-November/032610.html | |
Author: Carlo Hamalainen <carlo@carlo-hamalainen.net> | |
-} | |
import Control.Monad | |
import Data.Binary.Get | |
import Data.Bits |
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
{- | |
Response to http://lists.samba.org/archive/linux/2013-November/032604.html | |
and http://lists.samba.org/archive/linux/2013-November/032610.html | |
Author: Carlo Hamalainen <carlo@carlo-hamalainen.net> | |
-} | |
import Control.Monad | |
import Data.Binary.Get | |
import Data.Bits |
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
Resolving dependencies... | |
cabal: Could not resolve dependencies: | |
trying: ghc-imported-from-0.1.0.0 (user goal) | |
next goal: Cabal (dependency of ghc-imported-from-0.1.0.0) | |
rejecting: Cabal-1.16.0/installed-c6e... (conflict: ghc-imported-from => | |
Cabal>=1.18) | |
trying: Cabal-1.18.1.2 | |
next goal: ghc (dependency of ghc-imported-from-0.1.0.0) | |
rejecting: ghc-7.6.3/installed-189... (conflict: Cabal==1.18.1.2, ghc => | |
Cabal==1.16.0/installed-c6e...) |
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
Quote from _At Day's Close: Night in Times Past Paperback_ (A. Roger Ekirch, 2006). | |
Courtiers took the place of knights, satin and silk replaced chain | |
mail. The growing power of nation states, marked by their | |
monopolization of military force, only broadened the scope of | |
this transformation. Well-understood rules of civility governed | |
social exchanges among friends and strangers. Hence, it was thought | |
inappropriate, if walking on a street, to ask questions of a stranger | |
or to touch, much less jostle, other pedestrians. Above all, persons | |
of quality required respect, lest their dignity be affronted. Besides |