Skip to content

Instantly share code, notes, and snippets.

View peterhil's full-sized avatar

Peter H. peterhil

View GitHub Profile
@peterhil
peterhil / about.zsh
Created July 12, 2015 14:49
Grep man pages by sections
#!/usr/bin/env zsh
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 by Peter Hillerström
# License: MIT License
# This can be sourced from zsh dotfiles. If you don't care about other
# functions than `about`, put them inside the about function.
# Output can be piped to GNU `fmt -s` command for nice formatting.
about() {
@peterhil
peterhil / fb_cleanup.rb
Created September 13, 2015 14:08
Clean up a Facebook chat from https://www.facebook.com/messages/
#!/usr/bin/env ruby
# coding: utf-8
#
# Clean up a Facebook chat
#
# Usage:
# 1) copy a chat from https://www.facebook.com/messages/, paste into new file `chat.md`.
# 2) ruby fb_cleanup.rb chat.md
#
# Author: Peter Hillerström (peterhil)
@peterhil
peterhil / darcs over AFP file share
Created November 18, 2010 18:15
darcs get seemed to not work when the target directory was on an AppleTalk file share
No sources from which to fetch file `0000000435-9dbf0aa970c3dccdee318b939b66c350d6198f48b74209c9f8c74bd35f7a2b6b'
Writing pristine 81 done, 16 queued. 0000000293-9489cf57162d20b12ec3503f2803a03b20f9ac31b3786c0beea660d167d839db
thisrepo:/Volumes/peterhil/Programming/Lisp/_Web/_Frameworks/UnCommonWeb/ucw-core_0
cache:/Users/peterhil/.darcs/cache
Couldn't fetch `0000000435-9dbf0aa970c3dccdee318b939b66c350d6198f48b74209c9f8c74bd35f7a2b6b'
in subdir pristine.hashed from sources:
thisrepo:/Volumes/peterhil/Programming/Lisp/_Web/_Frameworks/UnCommonWeb/ucw-core_0
cache:/Users/peterhil/.darcs/cache
@peterhil
peterhil / LICENSE.txt
Created May 22, 2011 15:21 — forked from 140bytes/LICENSE.txt
140byt.es -- Functional programming: map a function to arguments
Copyright (c) 2011 Peter Hillerström, http://peter.vasb.fi/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@peterhil
peterhil / LICENSE.txt
Created May 23, 2011 21:46 — forked from 140bytes/LICENSE.txt
140byt.es -- Partial function application
Copyright (c) 2011 Peter Hillerström, http://peter.vasb.fi/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@peterhil
peterhil / range.js
Created May 24, 2011 01:31
A perfect range function
// JavaScript Range Function
// © 2006 Matthias Miller (originally written March 29, 2006)
// © 2010-2011 Peter Hillerström (modified 20.10.2010)
// Feel free to use it under the BSD license.
// Version: 0.1 Matthias Miller (originally written March 29, 2006)
// Version: 0.2 Peter Hillerström (modified October 20, 2010)
// Version: 0.3 Peter Hillerström (rewritten on May 24, 2011)
@peterhil
peterhil / trie.lisp
Created July 16, 2011 19:59
Weighted Suffix Trie
;;; -*- coding: utf-8; mode: Lisp; syntax: ANSI-Common-Lisp -*-
;;;
;;; -------------------------------------------------------------------------
;;; Twist - P-TRIE - probability trie (with branch widths)
;;; -------------------------------------------------------------------------
;;;
;;; Copyright (c) 2010 Peter Hillerström
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining a
;;; a copy of this software and associated documentation files (the "Software"),
@peterhil
peterhil / mandel.py
Created November 17, 2012 11:37 — forked from ChrisBeaumont/mandel.py
interactive Mandelbrot numba example
"""From the numba examples
(https://github.com/numba/numba/blob/master/examples/mandel.py),
but tweaked to recalculate on the fly as the viewport changes"""
from numba import autojit
import numpy as np
from pylab import imshow, jet, show, ion
import matplotlib.pyplot as plt
@autojit
@peterhil
peterhil / dabblet.css
Last active December 16, 2015 17:49
Circular Menu
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */
@peterhil
peterhil / grep.py
Created November 6, 2013 08:32
Simple grep with Python
#!/usr/bin/env python
"""Usage: grep.py regexp file"""
import re, sys
if len(sys.argv) < 3:
print(__doc__)
exit(1)
regexp = re.compile(sys.argv[1]);