Skip to content

Instantly share code, notes, and snippets.

@ntrepid8
ntrepid8 / lxc_lxd_notes.md
Last active February 22, 2022 15:11
LXC/LXD Notes
@ntrepid8
ntrepid8 / cron_speedtest_csv.sh
Last active June 28, 2017 03:19
Shell script to use with speedtest-cli and parse_speedtest_simple.py
#!/usr/bin/env bash
DATE_TAG="$(date -u +"%Y")-$(date -u +"%m")"
CSV_PATH="/home/$(whoami)/log/speedtest.$(hostname).${DATE_TAG}.csv"
LOG_PATH="/home/$(whoami)/log/speedtest.$(hostname).${DATE_TAG}.csv.log"
# ensure the path exists
mkdir -p $(dirname "${CSV_PATH}")
# add the header row if the file does not exist
@ntrepid8
ntrepid8 / parse_speedtest_simple.py
Last active June 28, 2017 03:11
Simple python script to parse speedtest-cli --simple output into a CSV line
#!/usr/bin/env python
import fileinput
import datetime
input_lines = []
for line in fileinput.input():
input_lines.append(line)
ping_key,ping_val,ping_unit = input_lines[0].split(" ")
download_key,download_val,download_unit = input_lines[1].split(" ")
@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 / bluray-tips.md
Created May 1, 2017 01:05
How to play video disks on Ubuntu 16.04

How to play movie disks on Ubuntu 16.04

To remind me how I got video playback workin on Ubuntu 16.04 for video disks.

DVD

$ sudo apt install vlc libdvd-pkg
$ sudo dpkg-reconfigure libdvd-pkg
@ntrepid8
ntrepid8 / host-interface-route.sh
Created April 7, 2017 00:19
Script to create static routes for individual host names and network interfaces
#!/usr/bin/env bash
# Create a static route for a given host/domain over a specific network interface.
# Put this script in /etc/network/if-up.d/host-interface-route so it runs when the interface comes up
# Script was developer for Ubuntu 16.04 LTS running Network Manager (Gnome 3)
# I use this script to prevent my VPN connections from interfering with automatic reverse SSH tunnles
# to my jump box running in the cloud.
# network interface to target
@ntrepid8
ntrepid8 / .gitconfig
Last active March 8, 2017 22:24
Git config file with useful aliases
[alias]
co = checkout
ci = commit
st = status
br = branch
s = status
ls = branch --sort=committerdate
lsa = branch --list --sort=committerdate --all
lsr = branch --list --sort=committerdate --remotes
f = fetch
@ntrepid8
ntrepid8 / git-github-pro-tips.md
Last active July 5, 2017 19:48
Git/GitHub Pro Tips - helpful resources for managing git repos with github.com