Skip to content

Instantly share code, notes, and snippets.

@turingbirds
turingbirds / usbreset.rst
Created October 31, 2014 20:30
usbreset.c
@turingbirds
turingbirds / invoke.py
Last active August 29, 2015 14:16
Execute a child program in a new process
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Execute a child program in a new process"""
import os
import subprocess
def exec_binary(cmd_line_list, cwd=None, stdout=None, stderr=None, verbose=False):
"""Invoke an executable file.
@turingbirds
turingbirds / inkscape_to_dxf.rst
Last active February 24, 2019 18:07
From InkScape to DXF

From InkScape to DXF

1. Save in Inkscape as PDF

Draft your design in InkScape. If there's any text, convert it to a path before or during exporting (Path → Object to Path).

Save as PDF (tested PDF v1.5).

@turingbirds
turingbirds / upload.php
Last active May 30, 2019 13:40
a simple php upload script
<?php
header("Content-Type: text/html; charset=utf-8");
function display_filesize($filesize) {
if (is_numeric($filesize)) {
$decr = 1024;
$step = 0;
$prefix = array('Byte','KB','MB','GB','TB','PB');

Connect an IP camera via wired ethernet to an ethernet USB adapter to a Raspberry Pi

Connect the camera to the ethernet USB adapter via a CROSSOVER cable (or via an ethernet switch).

Install DHCP server:

sudo apt install isc-dhcp-server
@turingbirds
turingbirds / launch_xscreensaver.sh
Created April 30, 2020 10:32
Manually launch xscreensaver; disable auto-activate
#!/bin/bash
# I do not want my screensaver to auto-activate after a timeout.
# For some reason, you *have* to select a nonzero, finite timeout value for xscreensaver (there's no "infinity").
# I only want my screensaver to active when I lock my system by pressing [Meta]+[L].
# This hotkey is set up to launch this script, which
# - starts the xscreensaver daemon,
# - activates the screensaver (with lockscreen enabled),
# - waits for it to terminate (unlocking logs an "UNBLANK" event),
# - then kills the xscreensaver daemon.
@turingbirds
turingbirds / bwedge.scad
Last active March 15, 2022 13:24
Beveled wedge shape for OpenSCAD
// Beveled wedge shape for OpenSCAD
// Written by C.A.P. Linssen <charl@itfromb.it>, Sept 2018
// This software is distributed under the "CC0 1.0 Universal (CC0 1.0)" license.
// You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
// module bwedge
@turingbirds
turingbirds / Git cheatsheet.markdown
Last active January 10, 2023 22:10
Git cheatsheet

Git cheatsheet

Set up Git

git config --global user.email "john_doe@example.com"
git config --global user.name "John Doe"

Linux installation notes

A giant ball of yarn containing notes on how to set up Debian/KDE Linux, with tips on useful software and commands.

Increase console font size

setfont /usr/share/consolefonts/Lat7-Terminus28x14.psf