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
#!/bin/bash | |
STATE=$1 | |
TOKEN=$2 | |
TOKEN=${TOKEN:-$DIGITALOCEAN_TOKEN} | |
HOSTNAME=$(hostname) | |
PRIVATE_IP_BASE=10.123. | |
PRIVATE_DOMAIN=internal.example.com |
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 python3 | |
import math | |
from sys import stdout | |
import shutil | |
w,h = shutil.get_terminal_size() | |
a0 = 3.0 | |
a1 = 4.0 |
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 python | |
from sys import exit | |
try: | |
import paho.mqtt.client as mqtt | |
except ImportError: | |
exit("This example requires the paho-mqtt module\nInstall with: sudo pip install paho-mqtt") | |
import blinkt |
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
rename 'use Time::Piece;s/(\d+)(\w{3})(20\d{2})/Time::Piece->strptime("$3-$2-$1", "%Y-%b-%d")->ymd/e' *.pdf |
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
// After writing this, I found | |
// https://codeburst.io/alternative-to-javascripts-switch-statement-with-a-functional-twist-3f572787ba1c | |
// which was almost identical to what I'd done. | |
// | |
// It's slow, though, but fine for small ones. | |
/* | |
const result = _switch(testValue) | |
.case(predicateFn, resultFn) |
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
PWDCOLORS_PATH=~/.pwdcolors | |
PWDCOLOR= | |
# macOS Terminal color change based on current PWD | |
# by Tom Gidden <[email protected]>, July 2021 | |
# | |
# This is a bit grotty and untested. Any improvements _very_ welcome. | |
# | |
# Ideally, Apple would bolt this functionality into Terminal.app, |
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
*PPD-Adobe: "4.3" | |
*% PPD created by ipp2ppd (v2:Jun 6 2020) | |
*FormatVersion: "4.3" | |
*FileVersion: "2.0" | |
*LanguageVersion: English | |
*LanguageEncoding: ISOLatin1 | |
*PSVersion: "(3010.000) 0" | |
*LanguageLevel: "3" | |
*FileSystem: False | |
*cupsVersion: 2.0 |
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
# | |
# Automounter master map | |
# | |
+auto_master # Use directory service | |
#/net -hosts -nobrowse,hidefromfinder,nosuid | |
/home auto_home -nobrowse,hidefromfinder | |
/Network/Servers -fstab | |
/- -static | |
/nfs auto_nfs -nobrowse,nosuid,soft,noowners,bg,intr,nfc |
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
// Alternatively, look at https://stackoverflow.com/questions/15690706/recursively-looping-through-an-object-to-build-a-property-list/53620876#53620876 | |
// and https://stackoverflow.com/questions/15690706/recursively-looping-through-an-object-to-build-a-property-list | |
/* Converts a potentially deep tree into a list of tuples. | |
* eg. {a:{b:{c:1,d:2}},e:{f:3},g:4} → [['a.b.c',1],['a.b.d',2],['e.f',3],['g',4]] | |
*/ | |
const flattenTree = (tree) => { | |
const recurse = (newentries, entries, path) => ( | |
entries.reduce( (a, [k,v]) => { |
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
gsettings set org.gnome.Vino disable-background true | |
gsettings set org.gnome.Vino prompt-enabled false | |
gsettings set org.gnome.Vino authentication-methods "['vnc']" | |
gsettings set org.gnome.Vino require-encryption false | |
gsettings set org.gnome.Vino vnc-password `echo -n mypassword | base64` | |
## Isn't this meant to work? | |
#nmcli connection show | |
#dconf write /org/gnome/settings-daemon/plugins/sharing/vino-server/enabled-connections "['60db8415-f429-4dcf-88bf-5180daee1199','67359432-bfb9-3163-94c7-fa58a5aa4d49']" |