Skip to content

Instantly share code, notes, and snippets.

View sjm42's full-sized avatar

Sami J. Mäkinen sjm42

  • Tampere, Finland
  • 14:32 (UTC +03:00)
View GitHub Profile
@sjm42
sjm42 / 01_k3s_install
Last active January 2, 2024 09:05
Cilium + WireGuard + external vm
# We have 4 vms on two hardware hosts on a shared LAN.
# 3 nodes are running k3s and one is the extra vm for testing external workloads.
curl -o k3s.sh https://get.k3s.io/
chmod 755 k3s.sh
export INSTALL_K3S_CHANNEL=latest
export K3S_DATASTORE_ENDPOINT="mysql://k3s:xxx@tcp(10.xx.yy.42:3306)/k3s"
@sjm42
sjm42 / dawn
Created July 4, 2023 08:45
OpenWrt WiFi ap configs
config local
option loglevel '0'
config network
option broadcast_ip '10.28.4.255'
option broadcast_port '1025'
option tcp_port '1026'
option network_option '2'
option shared_key 'Niiiiiiiiiiiiick'
option iv 'Niiiiiiiiiiiiick'
# automations.yaml
# Include generated file
!include my-zigbee.yaml
# EOF
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$HOME/bin
export PATH
set -x
tmux has-session 2> /dev/null && exit 0
name=atboot
tmux new -s $name -d
@sjm42
sjm42 / gist:a8eae2a39e3d385e453f878b4575417f
Created September 16, 2022 09:53
Example cronjob done "properly"
root@bastion-i:~# cat run-deploy-updates
#!/bin/bash
PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export PATH
[ z$1 = z-s ] && sleep $[ ( $RANDOM % 300 ) + 1 ]s
LOGD=$HOME/log
[ -d $LOGD ] || mkdir -p $LOGD
interfaces {
reth0 {
inactive: per-unit-scheduler;
vlan-tagging;
redundant-ether-options {
redundancy-group 1;
flow-control;
link-speed 1g;
minimum-links 1;
}
root@nas:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4a57922c63e7 ghcr.io/pterodactyl/yolks:java_17 "/bin/bash /entrypoi…" 21 seconds ago Up 15 seconds 10.28.0.48:25578->25578/tcp, 10.28.0.48:25578->25578/udp def0a02f-ffd3-4d1c-874b-7d0a7fc46d29
377b128912a1 ghcr.io/pterodactyl/yolks:java_17 "/bin/bash /entrypoi…" 23 seconds ago Up 15 seconds 10.28.0.48:25577->25577/tcp, 10.28.0.48:25577->25577/udp f42afbe0-6f41-4a5b-94a1-5d84df173004
@sjm42
sjm42 / gist:ebee72a4ace750f1d682a33184b55ef0
Last active June 19, 2022 08:22
Create timelapse with ffmpeg
###################################################
# concatenate all mp4 files into one mkv input file
time ffmpeg -f concat -safe 0 -i <(for f in *.MP4; do echo "file '$PWD/$f'"; done) -c copy input.mkv
#############################################
# make 10x speed timelapse with 60 fps output
time ffmpeg -i input.mkv -an -r 60 -filter:v "setpts=0.10*PTS" timelapse-10x.mkv
@sjm42
sjm42 / 01-ssh-tunnel
Created March 28, 2022 15:35
Atboot framework
#!/bin/sh
# ~/atboot.d/01-ssh-tunnel
while true
do
ssh -4 -L 1667:localhost:1667 -R 24800:localhost:24800 -N some.host.some.where
sleep 10
done
exit 0
# EOF
@sjm42
sjm42 / gist:12663fa6ef0ac026235c8e892cb7bd58
Last active January 13, 2022 23:42
USB password store
> status
*** blackpill-usb-pwdstore ***
Version: 0.1.0
Source timestamp: 2022-01-13T23:35:19Z
Compiler: rustc 1.60.0-nightly (1bd4fdc94 2022-01-12)
Status: CLOSED
> open kakkakommer
Master key decrypted successfully. Password store opened.