I need to start educating myself about how Python packages work.
- http://www.ianbicking.org/docs/setuptools-presentation/ - slideshow about how to put together a package
Official docs:
import types | |
import inspect | |
import pprint | |
from collections import defaultdict | |
def get_stack(offset=0): | |
def frame2tuple(frame): | |
info = inspect.getframeinfo(frame[0]) | |
return (info.filename, info.lineno) |
I need to start educating myself about how Python packages work.
Official docs:
int count = 0; | |
void setup() { } | |
void loop() { | |
int i; | |
Keyboard.print("Hello World "); | |
Keyboard.print(count); | |
count = count + 1; | |
delay(2000); | |
for (i = 0; i < 20; i++) { | |
Keyboard.print("\177"); |
http://askubuntu.com/questions/556911/how-to-create-an-iso-image-from-vdi-file/#answer-816885
TEST THIS STUFF AND UPDATE THE ASKUBUNTU ANSWER IF NECESSARY. If the USB stick can be used with a second VM, add that to the answer.
Test this procedure using Damn Small Linux and make sure it works as expected. More thoughts about DSL on USB stick here.
#!/usr/bin/env python | |
import os | |
import re | |
import time | |
import subprocess | |
os.system("ps ax | grep fluidsynth | cut -c -6 | xargs kill -9") | |
devnull = os.open('/dev/null', os.O_WRONLY) |
I need a reminder about how to set up a service in Linux that will run a script at boot time. Put this
LSB init script in your /etc/init.d
directory and then type
sudo update-rc.d linux_service.sh defaults
to set up the service. This is a wrapper for the script you actually want to run. The "Required-Start" section allows you to choose what Linux services need to be running before your own service is started. (I think my Fluidsynth script probably wants "alsasound".)
Some relevant links about this stuff:
SQLACodeGen is a work of genius. Here is the command you use to generate the model classses for your database. Lately I'm working with MySQL, previously I was working with PostgreSQL.
sqlacodegen mysql://user:password@server/database > mymodels.py
Had I been aware of SQLACodeGen three months ago, I would have used SQLAlchemy for a project where instead I wrote a lot of raw SQL.
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import logging | |
import random | |
import os | |
from Crypto.Cipher import AES | |
def _make_binary(x): | |
for c in list(x): | |
assert c in '0123456789ABCDEFabcdef' |
Do this: | |
make | |
gdb -x hook.x `which python` | |
More info: http://www.swig.org/Doc1.3/Python.html |
# A litle library of memory diagnostics | |
# In no particular order of usefulness: | |
# https://pymotw.com/2/gc/ | |
# https://code.tutsplus.com/tutorials/understand-how-much-memory-your-python-objects-use--cms-25609 | |
# https://www.huyng.com/posts/python-performance-analysis | |
# http://stackoverflow.com/questions/23369937 | |
import gc | |
import os |