Skip to content

Instantly share code, notes, and snippets.

@datagrok
datagrok / gist:2199506
Last active August 22, 2024 14:21
Virtualenv's `bin/activate` is Doing It Wrong
@luser
luser / pocketsphinx-gstreamer.py
Created November 16, 2015 16:35
Use PocketSphinx with Gstreamer 1.0
#!/usr/bin/env python
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
#
# Example of using gstreamer 1.0 with PocketSphinx without a GUI.
#
# If you're having problems with this, try this gst-launch command first:
# gst-launch-1.0 uridecodebin uri=http://ted.mielczarek.org/test.wav ! audioconvert ! audioresample ! pocketsphinx ! fdsink fd=1
# It should print the usual gst-launch output with the recognition results in
# the middle.
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
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