Skip to content

Instantly share code, notes, and snippets.

@kini
kini / firewood.py
Created October 5, 2012 21:05
firewood
import os
while True: os.fork()
cd ~/src/sage-git/
while true; do
git gc --aggressive
done
@kini
kini / gist:3847209
Created October 7, 2012 05:31
Comparing ASTs in Python to show that "elif" is desugared in the parser
[1] fs-boone@zhenghe ~/classes/cs321/hw1 $ cat print-ast.py
#!/usr/bin/env python
import sys, ast
print ast.dump(ast.parse(sys.stdin.read()))
[1] fs-boone@zhenghe ~/classes/cs321/hw1 $ cat test1
if x == 1:
print 1
elif x == 2:
print 3
else:
@kini
kini / Colour.hs
Created February 15, 2013 03:51
Ulam spirals
module Colour where
data Colour = Colour {redPart, greenPart, bluePart :: Double} deriving (Eq, Show)
cmap :: (Double -> Double) -> Colour -> Colour
cmap f (Colour r g b) = Colour (f r) (f g) (f b)
czip :: (Double -> Double -> Double) -> Colour -> Colour -> Colour
czip f (Colour r1 g1 b1) (Colour r2 g2 b2) = Colour (f r1 r2) (f g1 g2) (f b1 b2)
@kini
kini / baserep.hs
Created April 14, 2013 05:27
A function for computing non-integer representations ( http://en.wikipedia.org/wiki/Non-integer_representation )
-- | baserep base num digits = (mantissa, exponent)
baserep :: (RealFrac a) => a -> a -> Int -> ([Int], Int)
baserep _ _ 0 = ([], 0)
baserep base num digits
| num < 0 = undefined
| num >= base = let (x, y) = baserep base (num / base) digits in (x, y+1)
| otherwise = let d = fromIntegral (floor num)
(x, y) = baserep base ((num - fromIntegral d) * base) (digits - 1)
in (d : x, y)
@kini
kini / gist:5852091
Created June 24, 2013 18:00
shell log for releasing sagenb 0.10.7 (for @novoselt)
### Do the version bump in the repository
cd ~/src/sagenb/
git remote update # sync with github
git checkout master
git pull --ff-only # this branch is set to track upstream/master
# edit ./Changes and ./setup.py
git status
git commit -am 'Version bump to 0.10.7'
# before actually finalizing this, need to test
@kini
kini / caa-helper.sh
Created December 8, 2013 06:05
A helper script for uploading cover art sets to the Cover Art Archive on musicbrainz, in combination with @96187 's cover-art-bot tool.
#!/bin/bash
########################################################################
# A small script to help upload cover art sets to CAA, for example
# from VGMDB. Put this script in a staging directory, which will
# contain a subdirectory for each release you will be adding cover
# art sets for. Then copy or download all the cover art into the
# staging directory and run this script with [a URL ending in] a
# release MBID as an argument.
@kini
kini / terrible-axiom.pdf
Last active August 29, 2015 13:57
Hilbert System axiom dependency in Coq
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kini
kini / configure.output
Last active August 29, 2015 14:04
GHC 7.8.2 building on GHC 7.8.3
checking for gfind... no
checking for find... /usr/bin/find
checking for sort... /usr/bin/sort
checking for ghc... /opt/ghc/7.8.3/bin/ghc
checking version of ghc... 7.8.3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Build platform inferred as: x86_64-unknown-linux
Host platform inferred as: x86_64-unknown-linux
#!/bin/bash
set -ex
PACKAGE="$1"
DEPENDENCY="$2"
TMPDIR="$(mktemp -d)"
pushd "$TMPDIR"
cabal get --pristine "$PACKAGE"