This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
const Websocket = require('ws'); | |
const async = require('async'); | |
const Influx = require('influx'); | |
const once = require('once'); | |
const toml = require('toml'); | |
const fs = require('fs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set up basic alpine environment (networking, kbd layout, apk repo) | |
setup-alpine -q | |
# add some required packages | |
apk add e2fsprogs mdadm parted sgdisk gptfdisk | |
# create partition layout on the first disk | |
gdisk /dev/sda | |
> o | |
> y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- # Install FreeBSD 11.3-RELEASE with `ports` and `src` components in a VM | |
- pkg install wget ca_root_nss | |
- wget -qO- http://xor.meo.ws/KmLFJaaLqaQmUtNk2PP64KOLSNVb9GCy/rtl_bsd_drv_v196.04.tgz | tar xzf /dev/stdin | |
- cd rtl_bsd_drv_v195.00/ | |
- sed -i.bak 's|#include <dev/re/if_rereg.h>|#include "if_rereg.h"|' if_re.c | |
- make | |
- # You're done with compiling the kernel module, `if_re.ko` is the file you need | |
- # Copy the kernel module file from your FreeBSD instance to your pfSense instance into /boot/kernel/ | |
- # Exec chmod 555 /boot/kernel/if_re.ko on your pfSense instance | |
- # Add if_re_load="YES" to your /boot/loader.conf file on your pfSense instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
### CONFIG START ### | |
homebasedir="/data/homes" | |
defaultimage="alpine" | |
### CONFIG END ### | |
# sudo up to root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat docker-compose.tyml | perl -pe 's/^(\t+)/" " x length($1)/gei' > docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getBasicAuthArray = data => { | |
data = data.split(' '); | |
if (data.length !== 2 || !data[0].length || !data[1].length || data[0].toLowerCase() !== 'basic') return [null, null]; | |
let basicAuthData = Buffer.from(data[1], 'base64').toString('utf8').split(':'); | |
return [basicAuthData.shift(), basicAuthData.join(':')]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// No kittens were harmed while writing this really ugly looking and badly written code, I promise. | |
'use strict'; | |
/* | |
( | |
wget -O- https://iptoasn.com/data/ip2asn-v4.tsv.gz | gzip -d | |
wget -O- https://iptoasn.com/data/ip2asn-v6.tsv.gz | gzip -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:i:1}" | |
case $c in | |
[a-zA-Z0-9.~_-]) printf "$c" ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findmnt -u -n -r -o TARGET -R /path/to/mountpoint/ | sort -r | tr '\n' '\0' | xargs -0 -r umount |
NewerOlder