Skip to content

Instantly share code, notes, and snippets.

View raek's full-sized avatar

Rasmus Bondesson raek

View GitHub Profile
[Unit]
Description=Feather serial port forwarder
[Service]
ExecStart=socat TCP-LISTEN:55232,fork /dev/feather,rawer
[Install]
WantedBy=default.target
>>> from firmware import hotp
>>> secret = b"12345678901234567890"
>>> for i in range(3):
... print(hotp(secret, i))
...
755224
287082
359152
@raek
raek / new-session.sh
Created March 26, 2021 14:52
Script to create a new tmux session with the following windows: 0 = shared weechat window, 1 = emacs, 2 = bash
#!/usr/bin/env bash
if (( $# != 1 )); then
echo "Usage: $0 <session-name>"
exit 1
fi
session_name="$1"
shift
@raek
raek / README.txt
Last active March 17, 2021 06:43
Läs elmätaren
# INSTALLING (Running the meter poller as a user service)
# Put the script in ~/.local/bin/run_in_loop.sh (and make it executable) and the service description in ~.config/systemd/user/meter-poller.service .
# Allow your user to run service while not logged in (only needed once this computer)
sudo loginctl enable-linger $USER
# Tell systemd to start meter-poller.service at boot (done by installing symlinks)
systemctl --user enable meter-poller.service
[Unit]
Description=tmux - Terminal Multiplexer Server
[Service]
Type=forking
ExecStartPre=/usr/bin/grep -qs "set-option -s exit-empty off" %h/.tmux.conf
ExecStart=/usr/bin/tmux start-server
ExecStop=/usr/bin/tmux kill-server
Restart=on-failure
[ 12.372028] ata5: softreset failed (device not ready)
[ 22.400066] ata5: softreset failed (device not ready)
[ 22.705854] rfkill: input handler enabled
[ 26.126282] rfkill: input handler disabled
[ 32.943984] ata5: link is slow to respond, please be patient (ready=0)
[ 56.924278] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 61.940151] ata5.00: qc timeout (cmd 0xec)
[ 61.940213] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x5)
[ 71.955985] ata5: softreset failed (device not ready)
[ 81.967574] ata5: softreset failed (device not ready)
@raek
raek / weechat.service
Last active July 22, 2022 22:18
~/.config/systemd/user/weechat.service - SystemD unit for starting Weechat in a detached Screen
[Unit]
Description=Start Weechat in a screen at boot
[Service]
ExecStart=/usr/bin/screen -D -m -S weechat -U weechat
# -D -m Start detached, do not fork
# -S weechat Set name of session to "weechat"
# -U UTF-8 mode
# weechat Command to run
#include <avr/io.h>
#include <util/delay.h>
#include <stdbool.h>
#include <stdint.h>
#define IR_FREQ 38000uL
#define IR_ADDRESS 0x00u
#define IR_DATA_ON 0x80u
#define IR_DATA_OFF 0x90u
#include "Keyboard.h"
void setup() {
pinMode(6, INPUT_PULLUP);
pinMode(13, OUTPUT);
Keyboard.begin();
}
void loop() {
waitForStart();
@raek
raek / cowsay.py
Created November 30, 2018 16:14
cowsay widget for urwid
import urwid
import subprocess
class Cowsay(urwid.WidgetDecoration):
_LEFT = 2
_RIGHT = 2
_TOP = 1
_BOTTOM = 6