Skip to content

Instantly share code, notes, and snippets.

View xeoron's full-sized avatar

Xeoron xeoron

  • ACK Geek
  • Nantucket
View GitHub Profile
@xeoron
xeoron / recover_source_code.md
Created March 11, 2017 17:26 — forked from simonw/recover_source_code.md
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
@xeoron
xeoron / woof.py
Created October 16, 2015 00:20 — forked from robcowie/woof.py
woof.py One-time file server
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# woof -- an ad-hoc single file webserver
# Copyright (C) 2004-2009 Simon Budig <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# And here: http://forums.macrumors.com/showthread.php?t=1480302
@xeoron
xeoron / daemon.py
Created February 21, 2014 02:02 — forked from dcai/daemon.py
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
import os
def main():
os.chdir(os.path.dirname(os.path.dirname(__file__)))
src_path = "resources"
dest_path = "myproject/res"
for filename in os.listdir(src_path):
if not os.path.isfile(os.path.join(src_path, filename)):

Python Number Conversion Chart

From To Expression
@xeoron
xeoron / FacebookWordCloud.py
Created February 14, 2012 00:42 — forked from bostwick/FacebookWordCloud.py
Facebook News Feed Word Cloud
#!/usr/bin/env python
import sys
import urllib2
import json
from collections import defaultdict
from nltk import word_tokenize
IGNORED_WORDS = ["!", ".", ",", "(", ")", "'s", ":", "?", "...", "$",