Skip to content

Instantly share code, notes, and snippets.

@ntrepid8
ntrepid8 / cron_speedtest.sh
Created June 28, 2017 02:18
Script to run speedtest-cli via cron and log the results
#!/usr/bin/env bash
LOG_PATH="/home/$(whoami)/log/speedtest.log"
if result=$(/usr/bin/speedtest --simple); then
parsed_result=$(printf "${result}\"" | sed ':a;N;$!ba;s/\n/" /g' | sed 's/: /="/g')
printf "[$(date)] ${parsed_result}\n" >> "${LOG_PATH}"
else
printf "[$(date)] error\n" >> "${LOG_PATH}"
exit 1
@ntrepid8
ntrepid8 / ubuntu-2204-luks-btrfs.md
Last active December 17, 2023 08:26
Ubuntu 22.04 w/luks+btrfs
@ntrepid8
ntrepid8 / gen_server_tpl.ex
Created November 2, 2016 16:06
Elixir GenServer Template
defmodule GenServerTpl do
@moduledoc """
A GenServer template for a "singleton" process.
"""
use GenServer
# Initialization
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, opts, [name: __MODULE__])
end
@ntrepid8
ntrepid8 / ubuntu-2204-btrfs-2nd-drive-home.md
Created September 20, 2022 20:54
Ubuntu 22.04 btrfs home on 2nd drive

Ubuntu 22.04 btrfs home on 2nd drive

Given this crypttab/fstab:

$ cat /etc/crypttab 
nvme0n1p3_crypt UUID=a20b6cb4-c017-43a5-b695-a98fdb230861 /etc/luks/boot_os.keyfile luks,discard
swap_crypt UUID=02fa823d-6779-47ae-b57e-9eb8ba676227 /dev/urandom swap,offset=1024,cipher=aes-xts-plain64,size=512
sda1_crypt UUID=eaaf657d-3526-402e-9580-3d041e888a8d /etc/luks/boot_os.keyfile luks,discard

$ cat /etc/fstab 
@ntrepid8
ntrepid8 / tar_xz_tips.md
Last active August 20, 2022 14:04
Create tar.xz file with threads and progress bar

tar xz tips

Compress a directory using multiple threads and show a progress bar with this script:

#!/usr/bin/env bash

# example: tar_cJf.sh ./directory > directory.tar.xz

SOURCE="$1"
@ntrepid8
ntrepid8 / lxc_lxd_notes.md
Last active February 22, 2022 15:11
LXC/LXD Notes
@ntrepid8
ntrepid8 / ddns_provider.conf
Created September 21, 2013 19:07
This is the /etc.defaults/ddns_provider.conf file for Synology DiskStation NAS devices with a provider added for DNSMadeEasy.com DynamicDNS service.
# Input:
# 1. DynDNS style request:
# Input:
# Input:
# 1. DynDNS style request:
# modulepath = DynDNS
# queryurl = [Update URL]?[Query Parameters]
#
# 2. Self-defined module:
# modulepath = /sbin/xxxddns
@ntrepid8
ntrepid8 / autossh-jump-rtunnel.service
Last active October 7, 2020 01:45
AutoSSH reverse tunnel service config for systemd
[Unit]
Description=AutoSSH reverse tunnel service for jump.you.io 100022 -> 22
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 10022:127.0.0.1:22 user@jump.you.io -i /home/root/.ssh/id_rsa
[Install]
WantedBy=multi-user.target
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCkCGyADKnW57G+WFHEtZ2V9+D1k7nmUyh/q5DoodO7GBm7iTu1r4kw3JhRJq3wBT2gEvTrklgj14hYzsd0Aa1gKhrxeZrgfW2IELJF5y5d+ecuim7tejldNsA66tTBm+1vo0MM5hMSJ+nl+JzssrmxgR4oqNnlQf5g329YedknzadBqVJgU6A1G/lraPeHukTkQcQwSBbGqQnX35kejPDie2N5BW0m3rioTcltJIUnYQwDFmGBRs9ali5WtIHld+OS2tBFvUJ0MT9wYAI1wuIHPGv18MD7NYQTEVFsbu9CBn+xzkIIDnuGTcC7mrPGKiR9TScCu82UCCSvg0X0ywT7g1AyqP/qbhrBhNkkNkLkYcOqGxXAvMTTIW8VEK+6/PM2S0wb9jvVut5Uz71wVX4mtNLg7kOCamBU6nwNZTAo/N5DKAgJ5k/bPxeytDFPLaMQOiR16U3bsrf5WCwQ2caKc+9QrFZcYRdko/KqVWHn8ptr3p2d4Cr1SoMpz18CT7No75o3cwDB3DYjB4LM8krrFrXwB4zEQzyTAwyGPDypFiY6YSDU+9HZFZglud5ovsza828nSfQ95l6f0CH+P6BuFIUdxOBqJodbNp21IopQxKHP36xyVns/0thoYObh9rEUPUJyb5IOvOrcaRDe0QVf0w8tod0ARWoDBnBAhYHdfw== jaustin@devcondetect.com