Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Dzombak cdzombak

View GitHub Profile
View sync-music-to-iphone.sh
#!/usr/bin/env bash
set -u
WHITE='\033[0;37m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
GREEN='\033[0;32m'
NC='\033[0m'
if [ -e "/Volumes/Chris Dzombak's iPhone 11 co.brushedtype.doppler-ios" ] ; then
@cdzombak
cdzombak / git-google
Last active Feb 2, 2021
Shell script adding `git google *` to git subcommands. Put this file, named `git-google`, somewhere in your $PATH, and be sure to make this file executable. Then, type "git google commit," for example, to open a Google search for "git commit tutorial." Hacky AF, but it does generally work.
View git-google
#!/usr/bin/env bash
set -e
urlencode() {
# from https://gist.github.com/cdown/1163649
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
View install-restic-pi.sh
#!/usr/bin/env bash
RESTIC_TAG_LATEST=$(curl --silent "https://api.github.com/repos/restic/restic/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")')
echo "Downloading and installing restic v$RESTIC_TAG_LATEST ..."
RESTIC_URL=https://github.com/restic/restic/releases/download/v${RESTIC_TAG_LATEST}/restic_${RESTIC_TAG_LATEST}_linux_arm.bz2
curl -L --silent ${RESTIC_URL} | bunzip2 > /usr/local/bin/restic
chmod +x /usr/local/bin/restic
@cdzombak
cdzombak / 10-banner
Last active Sep 26, 2019
automatic figlet based banner
View 10-banner
#!/bin/sh
figlet -f big "$(hostname --fqdn)" | grep -v "^ *$"
View rewrite.md

collected links on rewriting software (or not)

View lightweight-healthcheck.sh
#!/usr/bin/env bash
set -u
THING_DESC="dzombak.com"
EMAIL_SUBJECT="[dzombak.com] Website"
LASTSTATUS_FILE="$HOME/.website-healthcheck-status"
EMAIL_TO="chris@example.com"
SMS_TO="+1xxxxxxxxxx"
TWILIO_NUMBER="+1xxxxxxxxxx"
@cdzombak
cdzombak / mastodon-streaming-healthcheck.sh
Created Jun 11, 2019
Mastodon health checks, run every minute via cron on a separate server
View mastodon-streaming-healthcheck.sh
#!/usr/bin/env bash
set -u
NOW=$(date +"%F %T %Z")
OK=
if curl -s https://a2mi.social/api/v1/streaming/health | grep -c OK > /dev/null ; then
OK="1"
else
OK="0"
@cdzombak
cdzombak / listening
Created May 31, 2019
simple cross-platform wrapper for lsof/netstat to tell what processes are listening for network connections
View listening
#!/usr/bin/env python3
import argparse
import platform
import subprocess
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
View sidekiq.chart.sh
# sidekiq.chart.sh by codl <codl@codl.fr>
#
# put this in /usr/libexec/netdata/charts.d
# chown root:netdata and chmod +x
sidekiq_update_every=5
sidekiq_priority=9000
sidekiq_check() {
redis-cli get 'stat:processed' > /dev/null 2> /dev/null
@cdzombak
cdzombak / youtube-dl-wrapper.sh
Last active Oct 9, 2019
youtube-dl wrapper for downloading videos direct to the correct Plex collection on my plex Mac Mini
View youtube-dl-wrapper.sh
#!/bin/bash
# all sorts of more advanced features are available, but this is a start:
# https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template-examples
if [ -z $1 ]; then
echo "Syntax: $0 VIDEO_URL"
exit 1
fi
VIDEO_URL="$1"