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)
# found this from Armin R. on Twitter, what a beautiful gem ;) | |
import ctypes | |
from types import DictProxyType, MethodType | |
# figure out side of _Py_ssize_t | |
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'): | |
_Py_ssize_t = ctypes.c_int64 | |
else: | |
_Py_ssize_t = ctypes.c_int |
// 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> |
-- > :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. |
# 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 |
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)
// 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 + ")" | |
} |
echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap |
// 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 + ")" | |
} |
#/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 |
# 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)): |