Skip to content

Instantly share code, notes, and snippets.

@typedt
typedt / .ghci
Last active August 5, 2017 21:13 — forked from pera/.ghci
GHCi dot file
-- You need to install IPPrint and HsColour with cabal to use this config.
-- If you find all the loading messages anoying you may want to set an alias:
-- alias ghci="ghci -v0"
-- Or if you are using stack ghci:
-- alias ghci="stack --silent ghci --ghci-options -v0"
-- use color Cyan, with imported modules in bold
:set prompt "\n\ESC[1;36m%s\n\ESC[0;36m\STXλ> \ESC[m\STX"
-- if ghci >= v7.8.1 for multiline support:
@typedt
typedt / python_challenge_05.py
Created August 19, 2014 23:36
Solution to Problem 5 of PythonChallenge.com
#! /usr/bin/env python
# Using pickle to unpickle banner.p
import pickle
from __future__ import print_function
from operator import add
def draw_segment(t):
k, v = t
return k * v
@typedt
typedt / python_challenge_01.py
Created August 17, 2014 11:12
Solution to Problem 1 of PythonChallenge.com
#!/usr/bin/env python
s = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
def make_rotation(i):
def rotate(x):
if x.isalpha():
shift = i if ord(x) + i < 123 else i - 26
return chr(ord(x) + shift)
else: