Skip to content

Instantly share code, notes, and snippets.

@Duckle29
Duckle29 / Persistent reverse SSH tunnel.md
Last active October 8, 2023 18:53
A systemd service file to ensure a persistent reverse SSH tunnel is active

Persistent reverse-ssh-tunnel systemd unit

This unit file, if enabled on boot, will attempt to connect to a remote server and establish a reverse tunnel. It uses StrictHostKeyChecking=accept-new for the ssh connection, so if you want to make sure the host you're connecting to is the right one, carry out the first connection manually and check the key.

REMOTE is considered a remote server that's available over ssh
LOCAL is considered the device initiating the remote tunnel. This will likely be a device dropped behind a NAT with no option of portforwarding

To use it, copy this multiline command somewhere to edit the configs and run it as root on the device:

@Duckle29
Duckle29 / stuff.cpp
Last active February 18, 2020 13:09
const uint8_t leds[] = { E6, B1, D0, D1, D2 };
void set_leds(void);
void clear_leds(void);
void keyboard_post_init_user(){
// Set all 5 LED pins as outputs
for(int i=0; i<sizeof(leds)/sizeof(leds[0]); i++)
{
setPinOutput(leds[i]);

Hey there.

Because we got stuck in the git adventure. I figured I'd write this little gist for you on how to get back to what you know :)

In msys, run:

git branch

it should show master, takane, plank_ene6, cheka and maybe more

KiCAD has a huge library of components and footprints, and it's only ever going to grow. I find that to best use these components, to have my libraries set up via git repositories, not through kicad, but locally.

This gist will explain how I go about it.

First, find a place on your computer that you want to keep these libraries. I use ~/kicad

Once you've decided on that, fork and clone the kicad-symbols repository, the kicad-footprints repository, and the kicad-packages3D repository

// ==UserScript==
// @run-at document-start
// @id Aliexpress URL Cleaner
// @name Aliexpress URL Cleaner
// @namespace
// @description Clean aliexpress item URL
// @include http://www.aliexpress.com/item/*
// @include https://www.aliexpress.com/item/*
// @include http://www.aliexpress.com/store/product/*
// @include https://www.aliexpress.com/store/product/*
@Duckle29
Duckle29 / bar.cpp
Last active September 22, 2018 18:58
#include "bar.h"
bar::bar():
reader(14)
{}
@Duckle29
Duckle29 / pigrammer.py
Last active July 28, 2018 11:29
RPi avr flasher
#!/usr/bin/python3
avrdude_path = '/usr/bin/avrdude'
avrdude_timeout = 100 # Timeout in seconds before killing avrdude
bootloader_hex = '/home/pi/hexes/vitamins_included_rev2_default_production.hex'
low_fuse = '0x5E'
high_fuse = '0xD9'
ext_fuse = '0xC3'
lock_fuse = '0x3F'
log_file = '/home/pi/log'
#include "currentsens.h"
Current::Current(uint8_t pin, uint16_t sample_period, int8_t debug_pin)
{
_pin = pin;
_sample_period = sample_period;
pinMode(_pin, INPUT);
if(debug_pin >= 0)

#test

@Duckle29
Duckle29 / constraints.ucf
Last active November 7, 2017 01:07
A VHDL project that does something I can't remember with a 4 digit multiplexed 7seg display
CONFIG PROHIBIT=P144;
CONFIG PROHIBIT=P69;
CONFIG PROHIBIT=P60;
NET avr_rst LOC = "P139" | IOSTANDARD=LVTTL;
NET CLK LOC="P94" | IOSTANDARD=LVTTL;
TIMESPEC TS_Period_1 = PERIOD "CLK" 31.25 ns HIGH 50%;
NET switches(7) LOC = "P39" | IOSTANDARD=LVTTL;
NET switches(6) LOC = "P48" | IOSTANDARD=LVTTL;