Skip to content

Instantly share code, notes, and snippets.

@willprice
willprice / stack.py
Last active June 20, 2023 14:27
PIL Image stacking
import numpy as np
from PIL import Image
def vstack(images):
if len(images) == 0:
raise ValueError("Need 0 or more images")
if isinstance(images[0], np.ndarray):
images = [Image.fromarray(img) for img in images]
width = max([img.size[0] for img in images])
# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file
##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.
##### DEVICE NAMES #####
@ian-weisser
ian-weisser / ncurses_clock.py
Created April 6, 2014 23:45
Python class that adds an easy, independent clock to a Curses window
#!/usr/bin/python3
import curses
import time
import threading
class Clock(threading.Thread):
""" Clock curses string class. Updates every second. Easy to install """
# import libraries
import time
import os
while True: # do forever
os.system('fswebcam -r 320x240 -S 3 --jpeg 50 --save /home/pi/to_transmit/%H%M%S.jpg') # uses Fswebcam to take picture