Skip to content

Instantly share code, notes, and snippets.

View dedan's full-sized avatar

Stephan Gabler dedan

View GitHub Profile
@dedan
dedan / run_background.py
Created October 12, 2011 13:01
senna server
import subprocess
import sys
import time
try:
p = subprocess.Popen([sys.executable, '-m', 'Pyro4.naming'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
time.sleep(5)
@dedan
dedan / life
Created December 3, 2011 10:01
session2
#!/usr/bin/env python
# encoding: utf-8
class Life(object):
"""docstring for Life"""
def __init__(self, init=None):
super(Life, self).__init__()
self.cells = init
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@saketkc
saketkc / python_slideshare_api.py
Created June 6, 2012 09:55
Python file for slideShare API
import urllib, urllib2
import time
import sha
import sys
import mimetools, mimetypes
from cStringIO import StringIO
from BeautifulSoup import BeautifulSoup
class Callable:
def __init__(self, anycallable):
@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@deeplook
deeplook / ipython_object_graphs.py
Last active December 12, 2015 06:39
An experimental extension for an IPython magic command to show object graphs.
"""
An experimental extension for an IPython magic command to show object graphs.
Strongly based on tkf's code for the extension itself
and mine for turning a Python namespace into a GraphViz DOT source:
- https://github.com/tkf/ipython-hierarchymagic
- http://pypi.python.org/pypi/pyrels/0.1.1
Read respective copyrights there!
@wrr
wrr / index.html
Last active May 14, 2019 00:27
Random walk illustrated with D3.
<!DOCTYPE html>
<!-- By Jan Wrobel. See it working at:
http://mixedbit.org/blog/2013/02/10/random_walk_illustrated_with_d3.html
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Random walk</title>
@nova77
nova77 / clip_magic.py
Last active February 12, 2025 16:48
copy to clipboard ipython magic
"""
Add copy to clipboard from IPython!
To install, just copy it to your profile/startup directory, typically:
~/.ipython/profile_default/startup/
Example usage:
%clip hello world
# will store "hello world"
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 24, 2025 01:16
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results