Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Hufford someburner

View GitHub Profile
@someburner
someburner / replace.sh
Last active Mar 5, 2020 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
View replace.sh
# agr <search> <replace>
# place in .bashrc
function agr { ag -0 -l "$1" | AGR_FROM="$1" AGR_TO="$2" xargs -r0 perl -pi -e 's/$ENV{AGR_FROM}/$ENV{AGR_TO}/g'; }
export -f agr
# ORIGINAL
# ag <https://github.com/ggreer/the_silver_searcher>
# usage: ag-replace.sh [search] [replace]
# caveats: will choke if either arguments contain a forward slash
@someburner
someburner / mosquitto-v1.5.sh
Last active May 19, 2020
Install Mosquitto 1.5
View mosquitto-v1.5.sh
#!/bin/bash
# remove mosquitto
sudo apt-get purge *mosquitto*
# hold mosquitto packages
sudo apt-mark hold mosquitto libmosquitto1 mosquitto-clients
# required build dependency
sudo apt-get install uuid-dev
# needed for mosquitto_passwd
sudo apt-get install libssl-dev
View install-mmc.sh
#!/bin/bash
############ SETTINGS ############
pfx="mmc"
backup_prefix="/mnt/sda2"
#DISTNAME="arm-soft-$pfx-master"
DISTNAME="arm-soft-$pfx-mini"
##################################
if ! [[ -f $backup_prefix/dist/$DISTNAME.tgz ]]; then
View build_go.sh
#!/bin/bash
############ SETTINGS ############
PREFIX=/usr
_GOVERS="1.11.5"
PATCH_CERTS=0
##################################
set -e
set -x
@someburner
someburner / le2018.md
Last active Sep 16, 2020 — forked from cecilemuller/letsencrypt_2020.md
Let's Encrypt + wildcards for Nginx (Ubuntu 17.10, IPv6, HTTP/2, Proxy-Pass, SLL Rating=A)
View le2018.md

Let's Encrypt for Nginx on Ubuntu 17.10, 18.04 with wildcards

Guide info:

  • we're setting up mydomain.com, *.mydomain.com
  • HTML is served from /var/www/mydomain
  • Challenges are served from /var/www/letsencrypt.
  • As of this writing, SSL Labs gives it an A+
  • Took info from here and here on wilcard certs.

Auto-renewal

View bashlib.mini.sh
#################################################################################
# MINI VERSION #
#################################################################################
_pmod=0;
paint() { local c=1; case "$1" in "nrm") c=0;; "gry") c=30;; "red") c=31;; "grn") c=32;; "ylw") c=33;; "blu") c=34;; "pur") c=35;; "aqu") c=36;; "wht") c=1;; esac; printf "\\033[$_pmod;$c""m$2""\033[m"; };
lpaint() { local c=1; case "$1" in "nrm") c=0;; "gry") c=90;; "red") c=91;; "grn") c=92;; "ylw") c=93;; "blu") c=94;; "pur") c=95;; "aqua") c=96;; "wht") c=97;; *);; esac; printf "\\033[$_pmod;$c""m$2""\033[m"; };
paintln() { paint "$1" "$2\n"; }; lpaintln() { lpaint "$1" "$2\n"; };
painthi() { _pmod=7; paint "$1" "$2"; }; painthiln() { _pmod=7; paintln "$1" "$2"; };
lpainthi() { _pmod=7; lpaint "$1" "$2"; }; lpainthiln() { _pmod=7; lpaintln "$1" "$2"; };
do_warn() { paint 'ylw' '[WARN]'; printf ' %s\n' "$1"; }; do_error() { lpaint 'red' '[ERROR]'; printf '
View frps_installer.sh
#!/bin/bash
systemctl daemon-reload
systemctl stop frps.service || true
touch /lib/systemd/system/frps.service
ENVPGM=/usr/bin/nohup
FRPS=/root/go/bin/frps
FRPS_CONF=/root/go/init.d/frps.ini
FRPS_LOG=/var/log/frps.log
View frpc_installer.sh
#!/bin/bash
systemctl daemon-reload
systemctl stop frpc.service || true
touch /lib/systemd/system/frpc.service
ENVPGM=/usr/bin/nohup
FRPC=/root/go/bin/frpc
FRPC_CONF=/root/go/init.d/frpc.ini
FRPC_LOG=/var/log/frpc.log
View install_go.sh
#!/bin/bash
TARNAME="go1.10.linux-amd64"
PREFIX=/usr/local
ensure_root() { if [[ "$EUID" -ne 0 ]]; then echo "Please run with sudo"; exit 1; fi }
ensure_root;
if [[ -f $TARNAME.tar.gz ]]; then
echo "$TARNAME.tar.gz exists.";
View gist:e7895cc70bfa90cd49e10f8b95f28e8f
GitHub Apps augment and extend your workflows on GitHub with commercial, open source, and homegrown tools.
Services
Available Services
AWS CodeDeploy
AWS OpsWorks
ActiveCollab
Acunote
AgileZen
Amazon SNS
Amazon SQS