Skip to content

Instantly share code, notes, and snippets.

@frdmn
frdmn / osx-10-10-virtualbox.md
Last active February 22, 2022 08:39
Install OS X 10.10 Yosemite in VirtualBox
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
def main():
import datetime
class _(monkey(int)):
#/bin/bash
echo "Packages needed for installation:"
echo "zlib1g-dev g++"
echo
echo "You can install it on debian-based distros with command:"
echo "apt-get install zlib1g-dev g++"
echo
if [ -z "$VIRTUAL_ENV" ]; then
@folone
folone / kind.scala
Last active February 20, 2018 22:18 — forked from eed3si9n/kind.scala
// Updated for Scala 2.10.0.
def kind[A: scala.reflect.runtime.universe.TypeTag](a: A): String = {
import scala.reflect.runtime.universe._
def typeKind(sig: Type): String = sig match {
case PolyType(params, resultType) =>
(params map { p =>
typeKind(p.typeSignature) match {
case "*" => "*"
case s => "(" + s + ")"
}
@lancew
lancew / gist:4001624
Created November 2, 2012 14:19
xmonad natural scrolling
echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap
@eed3si9n
eed3si9n / kind.scala
Created September 3, 2012 16:40
calculates a type's kind
// requires Scala 2.10.0-M7
def kind[A: scala.reflect.TypeTag]: String = {
import scala.reflect.runtime.universe._
def typeKind(sig: Type): String = sig match {
case PolyType(params, resultType) =>
(params map { p =>
typeKind(p.typeSignature) match {
case "*" => "*"
case s => "(" + s + ")"
}
@waylan
waylan / subprocess_pipe.md
Created April 10, 2012 19:12
Writing to a python subprocess pipe

Here's a few things I tried to write output to a python subprocess pipe.

from subprocess import Popen, PIPE

p = Popen('less', stdin=PIPE)
for x in xrange(100):
    p.communicate('Line number %d.\n' % x)
@lucasallan
lucasallan / install_postgis_osx.sh
Created September 6, 2011 21:03 — forked from klebervirgilio/install_postgis_osx.sh
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@igstan
igstan / oo.hs
Created March 19, 2011 17:03
A simple object system in Haskell
-- > :load oo.hs
-- [1 of 1] Compiling Main ( oo.hs, interpreted )
-- Ok, modules loaded: Main.
-- > :main
-- Hello, World
-- > :t (newGreeter "Hi, " |> sayHello)
-- (newGreeter "Hi, " |> sayHello) :: String -> IO ()
-- This would be an `interface` in Java.
@jeetsukumaran
jeetsukumaran / custom_iterator.cpp
Created February 18, 2010 02:33
Sample C++/STL custom iterator
// Sample custom iterator.
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558)
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>