Skip to content

Instantly share code, notes, and snippets.

@simonw
simonw / recover_source_code.md
Last active June 21, 2024 00:11
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@Bouke
Bouke / gist:11261620
Last active August 3, 2023 01:46
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@kigster
kigster / gist:4751844
Last active August 1, 2020 23:46
PostgreSQL config file for high performance writes on Joyent Cloud, used by Wanelo.com in production (4K commits/second on a dedicated 80GB instance).
max_connections = 1500 # (change requires restart)
shared_buffers = 12000MB # min 128kB, based on 80GB RAM DB
temp_buffers = 8MB # min 800kB
work_mem = 64MB # min 64kB
maintenance_work_mem = 1500MB # min 1MB
wal_level = hot_standby # minimal, archive, or hot_standby
checkpoint_segments = 256 # in logfile segments, min 1, 16MB each
checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
max_wal_senders = 6 # max number of walsender processes