Skip to content

Instantly share code, notes, and snippets.

Avatar

Joseph Bolus josephbolus

View GitHub Profile
@josephbolus
josephbolus / Caddy.env
Created Jul 23, 2022 — forked from crazy-max/Caddy.env
Proxmox web interface through Caddy as reverse proxy with Let's Encrypt
View Caddy.env
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_HOSTED_ZONE_ID=
@josephbolus
josephbolus / caddy.service
Created Jul 22, 2022
Caddy systemd service
View caddy.service
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
@josephbolus
josephbolus / Caddyfile
Created Jul 22, 2022 — forked from dimasahmad/Caddyfile
Install Caddy 2 on Ubuntu
View Caddyfile
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
:80
reverse_proxy 10.100.100.1:80
@josephbolus
josephbolus / default.conf
Created Jun 16, 2022 — forked from fmaul/default.conf
nginx config that uses the oauth2-proxy (via auth_request) to authenticate against gitlab and then proxies all requests to a backend service while setting the auth headers X-User and X-Email
View default.conf
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
@josephbolus
josephbolus / The Technical Interview Cheat Sheet.md
Created Mar 20, 2021 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

View crontab_
0 0 * * * /root/.acme.sh/acme.sh --renew --apache --renew-hook /root/.acme.sh/cloudkey-renew-hook.sh -d cloudkey.local.xintriq.net
* * */5 * * "/root/.acme.sh"/expirycheck.sh >> /var/log/letsencrypt.log
@josephbolus
josephbolus / script-template.sh
Created Dec 15, 2020 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
View gist:b64448b645c9290998246debe4b2dd14
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@josephbolus
josephbolus / add_ssl_to_cloudkey.txt
Last active Aug 13, 2019 — forked from potto007/add_ssl_to_cloudkey.txt
Set up Free SSL with Ubiquiti UniFi Cloud Key -- follow instructions in `add_ssl_to_cloudkey.txt`
View add_ssl_to_cloudkey.txt
1) Login to Cloud Key
2) Cloud Key ssh: `curl https://get.acme.sh | sh`
3) Cloud Key ssh: `acme.sh --upgrade --auto-upgrade --accountemail "myemail@example.com"`
4) Cloud Key ssh: Add `cloudkey-renew-hook.sh` file to `/root/.acme.sh`
5) Create free CloudFlare account (if not already member)
6) Login to CloudFlare
7) On CloudFlare: Create a zone for a domain you own (can add a cheap domain with namecheap.com or any number of alternatives)
8) On CloudFlare: Create an A record for your Cloud Key; ie: unifi.CHANGE.ME, 192.168.1.10
9) On UniFi Controller: Go to Settings; Click "Controller"; Change "Controller Hostname/IP" to the name entered in step 8.
10) On CloudFlare: go to Overview for your zone; click "Get your API key"
View cloudkey-renew-hook.sh
#!/bin/bash
# Renew-hook for ACME / Let's encrypt
echo "** Configuring new Let's Encrypt certs"
cd /etc/ssl/private
rm -f /etc/ssl/private/cert.tar /etc/ssl/private/unifi.keystore.jks /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/fullchain.pem
openssl pkcs12 -export -in /etc/ssl/private/cloudkey.crt -inkey /etc/ssl/private/cloudkey.key -out /etc/ssl/private/cloudkey.p12 -name unifi -password pass:aircontrolenterprise
keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /usr/lib/unifi/data/keystore -srckeystore /etc/ssl/private/cloudkey.p12 -srcstoretype PKCS12 -srcstorepass aircontrolenterprise -alias unifi