Skip to content

Instantly share code, notes, and snippets.

@thijstriemstra
thijstriemstra / play.sh
Last active March 22, 2023 06:58
omxplayer USB audio
View play.sh
# Playback on USB audio device (the second soundcard's first device),
# with omxplayer:
#
# $ ./play.sh myfile.mp4
#
# Use 'aplay -l' to list available devices, e.g:
#
# $ aplay -l
# card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
# Subdevices: 1/1
@thijstriemstra
thijstriemstra / README.md
Last active December 17, 2022 13:38 — forked from savetheclocktower/README.md
Using a potentiometer as a volume control for the Raspberry Pi
View README.md
@thijstriemstra
thijstriemstra / README.md
Last active January 2, 2021 17:44
Export Baikal addressbook using Python 3
View README.md

This script loads an addressbook from a Baikal SQLite database file using SQLAlchemy, and writes the contacts to a single baikal.vcf file.

Install dependencies:

pip3 install SQLAlchemy vobject
@thijstriemstra
thijstriemstra / gist:f1900272b8d680bda765
Created January 3, 2015 17:43
wavesurfer destroy before rendering complete
View gist:f1900272b8d680bda765
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js</title>
<link href="data:image/gif;" rel="icon" type="image/x-icon" />
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
@thijstriemstra
thijstriemstra / upload-server.py
Last active May 7, 2018 02:38
example upload Flask server
View upload-server.py
import os
from flask import Flask, flash, request, redirect, url_for, render_template, send_from_directory
from werkzeug import secure_filename
UPLOAD_FOLDER = 'uploads'
ALLOWED_EXTENSIONS = set(['webm', 'mp4', 'mp3', 'wav', 'jpeg', 'gif', 'png'])
static_folder = os.path.abspath(os.path.dirname(__file__))
template_dir = os.path.join(static_folder, 'examples')
@thijstriemstra
thijstriemstra / async-pyqt-sevensegment.py
Last active April 10, 2018 08:57
pyqt async sevensegment example using quamash.QEventLoop and max7219
View async-pyqt-sevensegment.py
import sys
import time
import asyncio
from PyQt5.QtWidgets import (QApplication, QProgressBar, QMainWindow, QSlider,
QVBoxLayout, QWidget)
from quamash import QEventLoop, QThreadExecutor
import max7219.led as led
View gist:2a18f6300f7ce4ba02f62f066ca82201
runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x76dedf70 m=2 sigcode=4294967290
goroutine 0 [idle]:
goroutine 1 [chan receive, 437 minutes]:
main.btcdMain(0x0, 0x0, 0x0)
/home/rpitest/go/src/github.com/roasbeef/btcd/btcd.go:170 +0x6dc
main.main()
@thijstriemstra
thijstriemstra / bittrex_order_history.py
Created August 20, 2017 19:04
Parse fullOrders.csv downloaded from Bittrex account
View bittrex_order_history.py
"""
Parse fullOrders.csv downloaded from Bittrex account.
Requirements::
pip install dateparser
"""
import csv
@thijstriemstra
thijstriemstra / update-videojs.sh
Last active December 9, 2016 16:29
bump video.js version in examples and
View update-videojs.sh
#!/bin/bash
export OLD_VERSION=5.9.2
export NEW_VERSION=5.10.8
# check if language files exist
wget --delete-after https://vjs.zencdn.net/$NEW_VERSION/lang/nl.js
# update videojs in examples and documentation
find examples/ -type f -name '*.html' -exec sed -i '' -e "s/$OLD_VERSION/$NEW_VERSION/" {} \;
@thijstriemstra
thijstriemstra / pyqt_sevensegment_test.py
Last active November 22, 2016 17:02
time.sleep calls block pyqt app
View pyqt_sevensegment_test.py
#!/usr/bin/env python
"""
PyQt example for seven segment displays.
"""
import sys
import time
from PyQt5 import QtWidgets