Skip to content

Instantly share code, notes, and snippets.

@vtsatskin
vtsatskin / tkinter_key_event_debouncing.py
Created October 13, 2015 17:32
Listening to KeyPress and KeyRelease with Tkinter with debouncing
import Tkinter as tkinter
tk = tkinter.Tk()
has_prev_key_release = None
'''
When holding a key down, multiple key press and key release events are fired in
succession. Debouncing is implemented in order to squash these repeated events
and know when the "real" KeyRelease and KeyPress events happen.
@maurisvh
maurisvh / spectrogram.py
Last active January 28, 2026 07:19
ANSI art spectrogram viewer that reads audio from a microphone
#!/usr/bin/python
import numpy
import pyaudio
import re
import sys
WIDTH = 79
BOOST = 1.0
@jaygooby
jaygooby / git_notes.md
Last active January 26, 2026 10:45
Git, you bloody git

Case Insensitive search all commit messages

git log -i --grep='weavils'

Add --all if you also want to check all branches, not just the current one.

Alias for recently edited branches

git lb

31 minutes ago: fun-branch

2 days ago: remove-things

@von
von / p-with-fixed-help.py
Created April 30, 2011 01:57
Demonstrate parse_known_args() with fixed help
#!/usr/bin/env python
import argparse
import ConfigParser
conf_parser = argparse.ArgumentParser(
# Turn off help, so we print all options in response to -h
add_help=False
)
conf_parser.add_argument("-c", "--conf_file",
help="Specify config file", metavar="FILE")