Skip to content

Instantly share code, notes, and snippets.

@triffid
triffid / openrc-init-pia
Last active February 15, 2024 06:48
shell script for accessing PIA wireguard
#!/sbin/openrc-run
command="/root/bin/pia-wg.sh"
CONFIGDIR="${CONFIGDIR:-/var/cache/pia-wg}"
CONFIG="${CONFIG:-/etc/pia-wg/pia-wg.conf}"
extra_started_commands="reload"
depend() {
@hjst
hjst / create-tango-theme-profile-in-gnome-terminal.sh
Created April 9, 2018 13:40
Modified Tango palette for GNOME Terminal (off-black background)
#!/usr/bin/env bash
# Base16 - Gnome Terminal color scheme install script
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Tango Modified"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="tango-modified"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
@SpotlightKid
SpotlightKid / test.sh
Last active October 9, 2023 21:31
Making a POST request with url or form-encoded params with MicroPython
$ micropython uget.py key1=value1 key2=value2 key2=value3
{'url': 'http://httpbin.org/get?key2=value3&key1=value1', 'headers': {'Host': 'httpbin.org', 'Connection': 'close'}, 'args': {'key2': 'value3', 'key1': 'value1'}, 'origin': 'XXX.XXX.XXX.XXX'}
$ micropython upost.py foo=bar spamm=42
{'files': {}, 'headers': {'Host': 'httpbin.org', 'Content-Length': '16', 'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'close'}, 'args': {}, 'form': {'spamm': '42', 'foo': 'bar'}, 'origin': 'XXX.XXX.XXX.XXX', 'data': '', 'json': None, 'url': 'http://httpbin.org/post'}
import dht
import machine
try:
import usocket as socket
except:
import socket
import ussl as ssl
# a template of HTTP request to ThingSpeak to post temperature and humidity
@coaxial
coaxial / ir-libreelec.md
Last active July 1, 2023 05:42
How to setup an infrared remote on LibreELEC/Kodi on RPI

Using a simple IR receiver such as IR5040 or TSOPxxxxx and a Raspberry Pi running LibreELEC + Kodi

Enable lirc in Kodi

Edit the file at /flash/config:

  • mount -o remount,rw /flash
  • vi /flash/config
  • append device_tree_overlay=lirc-rpi
  • mount -o remount,ro /flash

Connect the receiver

@reox
reox / bend_tube.scad
Last active June 2, 2021 18:52
Create a bend tube in OpenSCAD. Work ONLY with openscad >=2016, as the angle parameter in rotate_extrude was introduced there.
// fine mesh
fn = 1000;
// epsilon for clean intersection
eps = 0.1;
module tube(inner=5, outer=10, angle=45, length=250){
// we want the thing in z direction, thus we rotate on x axis
@ellerbrock
ellerbrock / tmux.cheat
Created December 18, 2016 04:15 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@tinkerology
tinkerology / HullBetweenIssue.scad
Created June 6, 2016 04:39
Issue with not pre-rendering difference
DETAIL=120;
module hullBetween()
{
// Combine the hull between and the original objects
difference()
{
hull()
{
@ah-cog
ah-cog / ESP8266 AT Commands for Creating a UDP Server.md
Last active March 16, 2024 15:19
ESP8266 AT command sequence to start a UDP server with Espressif AT firmware v0.22.

Create a UDP Server to Listen for Incoming Broadcasts

The following sequence of commands will (1) start a TCP server listening for traffic on port 80 and (2) start a UDP server and listen for incoming UDP packets from all addresses.

AT

OK
AT+CWMODE_CUR=3

OK

@0
0 / bluetooth_serial.md
Last active May 15, 2024 07:01
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm