Skip to content

Instantly share code, notes, and snippets.

View floe's full-sized avatar
😵
Overworked

Florian Echtler floe

😵
Overworked
View GitHub Profile
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active May 7, 2024 21:09
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
#!/usr/bin/env bash
set -e
DEVICE_NUMBER="9"
DEVICE_FILE="/dev/video${DEVICE_NUMBER}"
RTSP_URL="rtsp://username:password@WIFIFCAM:554"
# GitHub: iddo
# https://github.com/umlaeute/v4l2loopback/issues/109#issuecomment-617638198
@floe
floe / PCS-Janitor.user.js
Last active February 11, 2022 14:38
TamperMonkey script to manage the messy submission page in PrecisionConference
// ==UserScript==
// @name PCS-Janitor
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Clean out all hidden submissions from PCS
// @author @floe, based on code by @karalix
// @match https://new.precisionconference.com/submissions*
// @run-at document-end
// @grant none
// ==/UserScript==
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@Luftare
Luftare / drawImage.js
Created October 29, 2017 07:58
Draw image rotated and scaled on html canvas element
function drawImage(ctx, img, x, y, angle = 0, scale = 1){
ctx.save();
ctx.translate(x + img.width * scale / 2, y + img.height * scale / 2);
ctx.rotate(angle);
ctx.translate(- x - img.width * scale / 2, - y - img.height * scale / 2);
ctx.drawImage(img, x, y, img.width * scale, img.height * scale);
ctx.restore();
}
@acrosby
acrosby / calc_volume.py
Last active February 12, 2024 12:18
This code demonstrates how to read a binary STL file and calculate its volume in python.
import numpy as np
import struct
def read_stl(filename):
with open(filename) as f:
Header = f.read(80)
nn = f.read(4)
Numtri = struct.unpack('i', nn)[0]
record_dtype = np.dtype([
@zr-tex8r
zr-tex8r / README.md
Last active November 17, 2023 00:19
LaTeX: To make blinking text (if you dare)

bxblink Package

LaTeX: To make blinking text (if you dare)

System requirement

  • TeX format: LaTeX.
  • TeX engine: Anything.
  • DVI driver: dvips / dvipdfmx / pdfTeX / XeTeX.
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active April 15, 2024 14:27
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@je-so
je-so / testprogram.c
Last active May 5, 2024 20:38
Xlib transparent window with OpenGL support
/*
____ _____
/\__ \ /\ ___\
\/__/\ \ \ \ \__/_
\ \ \ \ \____ \
_\_\ \ \/__/_\ \
/\ _____\ /\ _____\
\/______/ \/______/
Copyright (C) 2011 Joerg Seebohn