Skip to content

Instantly share code, notes, and snippets.

View thinkmassive's full-sized avatar

Miller thinkmassive

View GitHub Profile
@thinkmassive
thinkmassive / k3d_useradd.sh
Last active March 22, 2023 19:34
Add a user to a k3d cluster, with cluster-wide view permissions
k3d_adduser() {
local user=${1:-myuser}
local group=${2:-mygroup}
local cluster=${3:-k3d}
openssl genrsa -out $user.key 2048 && echo "Generated $user.key"
openssl req -new -key $user.key -out $user.csr -subj "/CN=${user}/O=${group}" \
&& echo "Generated $user.csr"
if [ ! -f $user.key ] || [ ! -f $user.csr ]; then
echo "Error generating user credentials. Aborting."
blueprint:
domain: automation
name: Philips Hue v2 Smart Dimmer Switch and Remote
description: Philips Hue v2 Smart Dimmer Switch and Remote (RWL022) using Zigbee Home Automation
input:
zha_device:
name: Philips Hue v2 Smart Dimmer Switch and Remote
description: List of available Philips Hue v2 Smart Dimmer Switch and Remote devices
selector:
device:
@thinkmassive
thinkmassive / my-service-watchdog.service
Created May 1, 2020 16:52
systemd service watchdog
# copy this file to /etc/systemd/system/my-service-watchdog.service
[Unit]
Description=my-service watchdog
[Service]
ExecStart=/usr/local/bin/service-watchdog.sh
Environment=FRAGILE_SERVICE=my-service TIMEOUT=5m
Type=oneshot

Keybase proof

I hereby claim:

  • I am thinkmassive on github.
  • I am thinkmassive (https://keybase.io/thinkmassive) on keybase.
  • I have a public key whose fingerprint is 0563 EF72 A1D1 3909 8F30 F943 7A50 5CDD A81E 83D6

To claim this, I am signing this object:

@thinkmassive
thinkmassive / jenkins-workspace-cleanup.sh
Last active January 25, 2017 00:48
Remove projects in Jenkins workspace with no files modified within the past 90 days
#!/bin/bash
WORKSPACE_DIR=/var/lib/jenkins/workspace
DAYS_TO_KEEP=90
DRY_RUN=1
VERBOSE=1
[ $DRY_RUN ] && echo "DRY RUN..."
for projectdir in `ls -d1 "$WORKSPACE_DIR"/*`; do