This file contains hidden or 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
# We're currently on `non-working` branch, and we've identified a previous working commit of `abcdef123456`. | |
# We want to go back to commit `abcdef123456`, and then start work anew from there | |
# First checkout to the working commit `abcdef123456` | |
git checkout abcdef123456 | |
# You'll be in a temporary staging area now. If we want to make changes now, we'll need to copy the current commit | |
# into a new branch. | |
git checkout -b previous-working-branch |
This file contains hidden or 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
# ------------------------------------------------ | |
# Config files are located in /etc/wireguard/wg0 | |
# ------------------------------------------------ | |
# ---------- Server Config ---------- | |
[Interface] | |
Address = 10.10.0.1/24 # IPV4 CIDR | |
Address = fd86:ea04:1111::1/64 # IPV6 CIDR | |
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started | |
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown |
This file contains hidden or 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
gpg -k # List keys | |
gpg --edit-key [email protected] # Or key ID | |
key 1 # Select expired key | |
expire # Set new expiration | |
save | |
gpg --send-keys # Update keys on server | |
gpg --armor --output /tmp/key.gpg --export [email protected] # ASCII safe key for Github or another service |
This file contains hidden or 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 | |
IFS=$'\n' | |
VPNS=($(nmcli con | grep vpn)) | |
UUID_REGEX="^.*\(\w\{8\}.*\w\{12\}\).*$" | |
is_active_vpn() { | |
row=$(nmcli con | grep $1 | sed 's/\s*$//g' ) # Trim whitespace so we can test ending column | |
if [[ $row =~ ^.*--$ ]]; then | |
echo -n 0 |
This file contains hidden or 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
# Check to see what processes are using drive | |
fuser -vm /dropbox | |
sudo umount /dropbox |
This file contains hidden or 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
// https://stackoverflow.com/questions/6672374/convert-rgb-to-rgba-over-white | |
function RGBtoRGBA(r, g, b){ | |
if((g == null) && (typeof r === 'string')){ | |
var hex = r.replace(/^\s*#|\s*$/g, ''); | |
if(hex.length === 3){ | |
hex = hex.replace(/(.)/g, '$1$1'); | |
} | |
r = parseInt(hex.substr(0, 2), 16); | |
g = parseInt(hex.substr(2, 2), 16); | |
b = parseInt(hex.substr(4, 2), 16); |
This file contains hidden or 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
function addNeighbor() { | |
payload=$(jq -n --arg uris "$1" '{"command":"addNeighbors", "uris":[ $uris ]}') | |
curl http://localhost:14265 -H "X-IOTA-API-VERSION: 1.4" -d "$payload" | jq | |
} | |
function removeNeighbor() { | |
payload=$(jq -n --arg uris "$1" '{"command":"removeNeighbors", "uris":[ $uris ]}') | |
curl http://localhost:14265 -H "X-IOTA-API-VERSION: 1.4" -d "$payload" | jq | |
} |
This file contains hidden or 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
import moment from 'moment'; | |
const _constructor = ( ...args ) => moment.utc( ...args ); | |
const clone = Object.assign( _constructor, moment ); | |
export default clone; |
This file contains hidden or 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
# https://gist.github.com/chrisnolet/d07a55580337cfe7d5388b1d3c4960cc | |
function git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (*\([^)]*\))*/\1/' | |
} | |
function markup_git_branch { | |
if [[ -n $@ ]]; then | |
if [[ -z $(git status --porcelain 2> /dev/null | tail -n1) ]]; then | |
echo -e " \001\033[32m\002($@)\001\033[0m\002" |