Skip to content

Instantly share code, notes, and snippets.

View zaneclaes's full-sized avatar

Zane Claes zaneclaes

View GitHub Profile
@zaneclaes
zaneclaes / wifi-auto-connect.sh
Created October 30, 2019 20:55
Bash script to automatically connect to open WiFi networks, upon disconnect, via nmcli
#!/bin/bash
con="${1}"
if [[ -z "$con" ]]; then
echo "Please provide an interface name as an argument."
exit 1
fi
while true; do
conns=$(nmcli con show "$con" | grep "GENERAL.STATE:" | grep "activated")
#!/bin/bash
interfaces=(eth0 eth1 eth2) # which interfaces to auto-detect, in descending order of priority
interface="eth0" # the default/current interface
while true; do
newif="$interface"
for i in "${interfaces[@]}"; do
if $(ip link show dev "$i"); then
newif="$i"
fi
if (window.location.href.indexOf('kiosk') > 0) {
setTimeout(function () {
try {
const home_assistant_main = document
.querySelector("body > home-assistant").shadowRoot
.querySelector("home-assistant-main");
const header = home_assistant_main.shadowRoot
.querySelector("app-drawer-layout > partial-panel-resolver > ha-panel-lovelace").shadowRoot
.querySelector("hui-root").shadowRoot
@zaneclaes
zaneclaes / spellbook-startup.sh
Last active November 24, 2019 09:54
Startup script for magic spellbook home automation with a Raspberry Pi kiosk and home-assistant.io
#!/bin/bash
#
# ARG_POSITIONAL_SINGLE([home-assistant-address],[root URL of home assistant])
# ARG_OPTIONAL_BOOLEAN([tvservice],[],[tvservice on],[on])
# ARG_OPTIONAL_BOOLEAN([usb],[],[USB on],[on])
# ARGBASH_GO()
# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.8.1 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
@zaneclaes
zaneclaes / multipress-deployment.yml
Last active July 17, 2019 04:09
Sample kubernetes deployment of multipress: multiple wordpress sites with nginx in a single docker container
apiVersion: apps/v1
kind: Deployment
metadata:
name: multipress
labels:
app: multipress
spec:
replicas: 2
selector:
matchLabels:
@zaneclaes
zaneclaes / switchboard-k8s-deployment.yaml
Last active July 17, 2019 03:52
A simple version of a Switchboard deployment via k8s
apiVersion: apps/v1
kind: Deployment
metadata:
name: switchboard
labels:
app: switchboard
spec:
replicas: 2
minReadySeconds: 5
selector:
@zaneclaes
zaneclaes / certbot_jks.sh
Created April 23, 2019 16:11
Converts a letsencrypt certificate into a JKS file.
#!/bin/bash
# Converts a letsencrypt certificate into a JKS file.
# Usage:
# ./certbot_jks.sh [domain_name] [email]
le_dir="/etc/letsencrypt"
domain=${1}
email=${2}
OUT_DIR=${le_dir}/live/${domain}
GATE_EXPORT_PASSWORD=test1234
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
ZSH_DISABLE_COMPFIX=false
POWERLEVEL9K_MODE='nerdfont-complete'
#!/bin/bash
#
# ARG_HELP([Configure a mobile device as an external screen:])
# ARG_POSITIONAL_SINGLE([width],[Width of the external screen])
# ARG_POSITIONAL_SINGLE([height],[Height of the external screen])
# ARG_POSITIONAL_SINGLE([position],[Position of the external screen: top, right, bottom, or left],[position - right])
# ARGBASH_GO()
# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.6.1 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
[CLEAN] Cleaning build directories.
[MAKE] Generating /work/libs/opt/pkgconfig/grpc.pc
[MAKE] Generating /work/libs/opt/pkgconfig/grpc_unsecure.pc
[MAKE] Generating cache.mk
[CXX] Compiling src/core/lib/gpr/alloc.cc
[CXX] Compiling src/core/lib/gpr/arena.cc
[CXX] Compiling src/core/lib/gpr/atm.cc
[CXX] Compiling src/core/lib/gpr/avl.cc
[CXX] Compiling src/core/lib/gpr/cmdline.cc
[CXX] Compiling src/core/lib/gpr/cpu_iphone.cc