Skip to content

Instantly share code, notes, and snippets.

import sys
import struct
import binascii
from collections import Counter
def u16(b):
return struct.unpack('<H', b)[0]
def p16(x):
return struct.pack('<H', x)
def p32(x):
@taxilian
taxilian / 1- README.md
Last active July 9, 2019 15:24
Example nginx config to reverse proxy to three different octoprint servers from one domain

Purpose

I have three printers; each uses a raspberry pi that runs OctoPrint. I wanted to be able to give people a single page to see all of the webcams, what they are printing with ETL (est time left), and what the current temperatures are.

This demonstrates how I did that. Email me at richard@hamstudy.org if you'd like to see a live demo -- I don't want every bot on the web looking at my cameras and using CPU cycles.

License

anonymous
anonymous / rec.sh
Created October 21, 2012 14:06
record using ffmpeg
#!/bin/sh
INFO=$(xwininfo -frame)
WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' |\
grep -oEe '[0-9]+x[0-9]+')
WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' |\
grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/,/' )
ffmpeg -f x11grab -y -r 15 -s $WIN_GEO -i :0.0+$WIN_XY -vcodec ffv1 -sameq -f alsa -ac 2\
@jbgo
jbgo / git-recover-branch.md
Last active May 23, 2024 12:29
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring