Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ilumos on github.
  • I am ilumos (https://keybase.io/ilumos) on keybase.
  • I have a public key whose fingerprint is 379D DC36 F19E 9913 4C4A F2B4 A497 C997 B2CE 2A68

To claim this, I am signing this object:

@ilumos
ilumos / systemctl-symlink.sh
Created August 3, 2017 21:07
Create "sc" alias for "systemctl"
@ilumos
ilumos / lsnic.sh
Created August 3, 2017 21:10
Show colourful status of NICs for HP NC364T
#!/bin/bash
ip -c addr show enp3s0f0
ip -c addr show enp3s0f1
ip -c addr show enp4s0f0
ip -c addr show enp4s0f1
@ilumos
ilumos / letsencrypt-mumble-renew.sh
Created August 11, 2017 18:06
Renew a Letsencrypt SSL Certificate for a Mumble server
#!/bin/bash
UFW="/usr/sbin/ufw"
LETSENCRYPT="/usr/bin/letsencrypt"
CHGRP="/bin/chgrp"
CHMOD="/bin/chmod"
TIMEOUT="/usr/bin/timeout"
SERVICE="/usr/sbin/service"
MURMURD="/usr/sbin/murmurd"
@ilumos
ilumos / index.js
Last active December 26, 2017 14:30
asana-to-discord
module['exports'] = function asanaToDiscord(hook, callback) {
var discordApiUrl = 'https://discordapp.com/api/webhooks/' + hook.params.discord_webhook_id + '/' + hook.params.discord_webhook_token;
var discordAvatarUrl = "https://pbs.twimg.com/profile_images/852570851400482820/zGCC6jNZ_400x400.jpg";
var asanaApiUrl = "https://app.asana.com/api/1.0/";
var asanaPersonalAccessToken = hook.params.asana_personal_access_token;
var request = require('request');
function getTask(eventId, taskId) {
# In Diagnostics > Command Prompt, run:
mkdir -p /root/.ssh # Create a .ssh folder for the pfSense root user
ssh-keygen -t rsa -q -b 2048 -N "" -f /root/.ssh/id_rsa # Generate a public/private key pair for pfSense
cat /root/.ssh/id_rsa.pub # Get pfSense's public key for adding to the remote server
ssh -oStrictHostKeyChecking=no user@example.com # Add the remote host's host key to pfsense's "known_hosts" file
# Run this command in Diagnostics > Command Prompt
# and if it succeeds, add it as a cron job in Services > Cron
/usr/bin/scp -i /root/.ssh/id_rsa /cf/conf/config.xml user@backup.example.com:~/config-`date +\%Y-\%m-\%d`.xml 2>&1 | /usr/bin/logger -t config-backup
@ilumos
ilumos / envsubst-usage-example.md
Created December 4, 2018 14:12
Envsubst is a useful tool that saves you from writing complex and brittle seds

envsubst Usage Example

Envsubst is a useful tool that saves you from writing complex and brittle seds

.env File

export LOGSTASH_HOST="logstash.example.com:5044"
export CACHE_LOGS_DIRECTORY="/var/lancache/logs"
@ilumos
ilumos / schedule-wake-then-shutdown.sh
Created April 19, 2019 06:48
Schedule a wake for up to 23 hours in the future, and then shut down
#!/bin/bash
set -e
HOURS_FROM_NOW=${1,,}
if ! [[ $HOURS_FROM_NOW =~ ^-?[0-9]+$ ]] ; then
echo 'Argument "hours from now" must be an integer'
exit 1
fi
@ilumos
ilumos / keep-28-days-of-backups.sh
Last active December 18, 2019 21:32
Only keep the last 28 days of backups
#!/bin/bash
find backups/ -ctime +28 -name "*.tar.gz" -print -delete
@ilumos
ilumos / rsync-is-better-than-dd.sh
Created February 7, 2020 18:46
rsync-is-better-than-dd.sh
#!/bin/bash
rsync -aHAXvhW --no-compress --progress /source /destination