Skip to content

Instantly share code, notes, and snippets.

@boylea
boylea / mosaic_builder.py
Last active May 8, 2017 04:26
Creates an photo mosaic out of a base image and a search term. For fun only, the downloaded images may not be licensed for re-use
"""
Before running:
$ pip install pillow
$ pip install requests
Example usage:
$ python mosaic_builder.py puppies my_template_image.jpg
For optional arguments:
$ python mosaic_builder.py -h
@boylea
boylea / ugly_indentation.py
Created October 3, 2015 23:12
An example of abusing python indentation syntax. Python is enforces correct indentation at a block, but if you try (or are grossly negligent) you can make it look really bad.
uglystick = True
def ugly_python():
if uglystick:
print "one space"
if uglystick:
print 'five space'
def more_uglyness():
if uglystick:
print 'two space x2'
@boylea
boylea / livespec.py
Last active August 22, 2024 02:22
pyqtgraph live running spectrogram from microphone
"""
Tested on Linux with python 3.7
Must have portaudio installed (e.g. dnf install portaudio-devel)
pip install pyqtgraph pyaudio PyQt5
"""
import numpy as np
import pyqtgraph as pg
import pyaudio
from PyQt5 import QtCore, QtGui