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 February 16, 2026 12:33
Git, you bloody git

Create a git alias to show all your git aliases

git config --global alias.alias "! git config --get-regexp ^alias\. | sed -e s/^alias\.// -e s/\ /\ =\ /"

Thanks Asclepius!

Then you can git alias to see them all

Rename a remote

git remote rename <old-name> <new-name>
@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")