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 27, 2025 18:47
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 April 2, 2025 13:18
Git, you bloody git
@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")