Skip to content

Instantly share code, notes, and snippets.

View munhitsu's full-sized avatar

Mateusz Łapsa-Malawski munhitsu

  • cr3.io
  • London, UK
View GitHub Profile
@munhitsu
munhitsu / gist:1034761
Created June 19, 2011 21:11
python 2.7 (*.dmg) uninstall from OSX
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | cut -d " " -f 18 | xargs -IM sudo rm /usr/local/bin/M
echo based on http://stackoverflow.com/questions/3819449/how-to-uninstall-python-2-7-on-a-mac-os-x-10-6-4
@munhitsu
munhitsu / gist:1034876
Last active November 29, 2020 09:10
python 2.7.5 install on OSX (10.8+) using brew (pip, easy_install, virtualenv, virtualenvwrapper)
# In case you had some strange python installation
# NOTE: .pydistutils.cfg seems to be not compatible with brew install python
# areas I needed to clean before installation
# clean up ~/Library/Python
# clean up .local
# preconditions:
# xcode with command line tools installed
xcode-select --install
@munhitsu
munhitsu / gist:1034897
Created June 19, 2011 23:25
10.6: Completely Disable Virtual Memory in Snow Leopard
#source: http://hints.macworld.com/article.php?story=201106020948369
#disable
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
#enable
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
@munhitsu
munhitsu / gist:1276768
Created October 10, 2011 22:29
buildout.cfg for gevent & libevent
[buildout]
extensions = buildout.dumppickedversions
parts =
libevent
gevent
[gevent]
recipe = zc.recipe.egg:custom
include-dirs = ${libevent:location}/include
library-dirs = ${libevent:location}/lib
@munhitsu
munhitsu / buildout-haystack.cfg
Created October 31, 2011 22:22
django-haystack xapian buildout recipe
[django-haystack]
location = django-haystack
recipe = zerokspot.recipe.git
repository = https://github.com/toastdriven/django-haystack.git
[xapian-haystack]
location = xapian-haystack
recipe = zerokspot.recipe.git
repository = https://github.com/notanumber/xapian-haystack.git
@munhitsu
munhitsu / wsgi_simple_server_post.py
Created January 12, 2012 15:48
Simple WSGI application that handles POST - for testing/debuging of PROXY
from wsgiref.util import setup_testing_defaults, FileWrapper
from wsgiref.simple_server import make_server
import sys
from pprint import pprint
# A relatively simple WSGI application. It's going to print out the
# environment dictionary after being updated by setup_testing_defaults
def simple_app(environ, start_response):
setup_testing_defaults(environ)
@munhitsu
munhitsu / gist:2417488
Created April 19, 2012 00:14
osm-bright-mac-quickstart
# extended version of
#
# http://mapbox.com/tilemill/docs/guides/osm-bright-mac-quickstart/
#
# install PostgreSQL (fresh)
brew install postgresql
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
@munhitsu
munhitsu / gist:3938829
Created October 23, 2012 13:45
augeas/augtool + puppet update /etc/hosts file
$puppetmaster_ip = '8.8.8.8'
augeas { "puppetmaster_in_hosts_append":
context => "/files/etc/hosts",
changes => [
"set 01/ipaddr '${puppetmaster_ip}'",
"set 01/canonical puppet",
],
onlyif => "match *[ipaddr = '${puppetmaster_ip}'] size == 0"
} -> augeas { "puppetmaster_in_hosts_update":
@munhitsu
munhitsu / gist:4153696
Created November 27, 2012 11:13
to dump Xvfb buffer to png file
setup DISPLAY accordingly i.e.
export DISPLAY=:0
import -window root file.png
@munhitsu
munhitsu / gist:4162619
Created November 28, 2012 17:15
ipython within lettuce context
# from: http://matelakat.blogspot.co.uk/2012/03/lettuce-and-ipython-interactive-shell.html
#
@step(u'And give me IPython')
def and_continue_here(step):
import IPython
import sys
shell = IPython.InteractiveShell()
ip = IPython.core.ipapi.get()
p = IPython.core.debugger.Pdb(ip.colors)
p.reset()