Skip to content

Instantly share code, notes, and snippets.

@markfickett
markfickett / gist:c37e085fed88d321b773387f09012c56
Created August 15, 2017 19:51
Comparison of looking up Python class in dict
from pyprofiling import Profiled
import logging
import random
import threading
A_HASH_INDEX = 1
class A(object):
@markfickett
markfickett / gist:e092164ae3d88fbfba7c6f93ab9a5710
Created August 15, 2017 14:03
Multi-threaded comparison of lookups in Python dict and ResizingList
from pyprofiling import Profiled
import logging
import random
import threading
class ResizingList(list):
"""A list of values that automatically grows when items are set, and returns None if an index
greater than the list length is provided."""
@markfickett
markfickett / fht_curses_graph
Last active June 20, 2017 16:43
ArduinoFHT Demo Graph (Python using curses)
"""Draw a live bar graph of frequency data (from Arduino FHT)."""
import collections
import curses
import math
import serial # http://pyserial.sourceforge.net/
import time
_SERIAL_DEVICE = '/dev/tty.usbmodemfa141'
_GRAPH_MAX_Y = 100