Skip to content

Instantly share code, notes, and snippets.

View joestump's full-sized avatar

Joe Stump joestump

View GitHub Profile
@joestump
joestump / certbot-renewal.service
Created September 25, 2021 04:03
LetsEncrypt for Pi-Hole w/ Auto-Renewal
[Unit]
Description=Certbot Renewal
[Service]
# Create /root/.aws/config using the config example.
Environment=AWS_PROFILE=certbot
# This will renew the certificate using Route53 DNS challenge.
# The post-hook will combine the certs for lighttpd and restart.
ExecStart=/usr/bin/certbot certonly --non-interactive --dns-route53 --dns-route53-propagation-seconds 120 -d your-domain.example.com --agree-tos -m your-email@example.com --post-hook "cat /etc/letsencrypt/live/your-domain.example.com/privkey.pem /etc/letsencrypt/live/your-domain.example.com/cert.pem | /etc/letsencrypt/live/your-domain.example.com/combined.pem && systemctl restart lighttpd"
# Use LetsEncrypt SSL certificates and set port to default SSL/TLS port.
# This approach does not use Nginx.
http:
server_port: 443
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
@joestump
joestump / unifi.py
Created July 15, 2020 03:36
A simple Python client for the Ubiquiti UDM Pro
import requests
import json
import urllib3
UNIFI_LOGIN_PATH = '/api/auth/login'
# Disable SSL verification warnings
urllib3.disable_warnings()
#!/bin/bash
set -xe
#This script pulls various information from the Synology NAS
#Edit /etc/crontab then restart, synoservice -restart crond
#Metrics to capture, set to false if you want to skip that specific set
capture_system="true" #model information, temperature, update status,
capture_memory="false" #information about memory stats
capture_cpu="true" #CPU usage
@joestump
joestump / test.tf
Last active October 11, 2024 16:44
Trigger AWS CodePipeline with a GitHub webhook using Terraform
provider "aws" {}
provider "github" {}
resource "github_repository" "test" {
name = "joestump-test"
description = "Terraform test repository"
private = true
}
resource "aws_s3_bucket" "test" {
AWSTemplateFormatVersion: 2010-09-09
Description: Installs IAM role and policy to allow Support Center access to PCS's CSKAccountProvisioner production role.
Resources:
TerraformAdministratorRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: PCSSupportAccessRole
MaxSessionDuration: 3600
AssumeRolePolicyDocument:
Version: "2012-10-17"

Keybase proof

I hereby claim:

  • I am joestump on github.
  • I am joestump (https://keybase.io/joestump) on keybase.
  • I have a public key whose fingerprint is 2944 FAE9 2234 A26B 3E7A 5DA0 887D 2343 C10E 0455

To claim this, I am signing this object:

@joestump
joestump / deploy.sh
Last active February 21, 2024 11:40
Using modern JavaScript and CI tooling for Google Apps Scripts
#!/bin/bash
npm run build
gas deploy -s ./conf/$CLIENT_SECRETS -c ./conf/$OAUTH_CREDENTIALS -b ./build -f $GAS_FILE_ID
@joestump
joestump / San_Francisco.mkd
Created February 1, 2014 02:05
Here are two tours of San Francisco and the surrounding area. Both take about a day. One is entirely within the city and can be done entirely via public transportation. The other requires a car and gets you outside of SF to some of the wonderful sites that comprise the Yay Area.

San Francisco by Foot

  • You can start anywhere in the Castro, Mission (home of the burrito), or downtown. I'd recommend starting at Chow at Market & Church or The Pork Store on 16th at Valencia. If you wanted to go upscale on the weekend, Maverick at 17th and Mission is a fantastic brunch. Another option is to start in Chinatown (just north of Union Squre) for dim sum.
  • From Castro take one of the N, J, etc. trains (every light rail train route in the city intersects at Church and Market) down to the Powell Street station. From the Mission you can take BART a couple of stops up to Powell Street.
  • Once at Powell Street hop on the Powell Street trolley. A quintessential SF experience.
  • Take the trolley up through the city where it will eventually stop at Lombard Street, which is known as the most crooked street in the world. Walk down the hill, take a few pictures and laugh at the tourists trying to drive down the damn thing.
  • Once at the bottom of the hill, turn left. You'll be walking towards the w
from boto.s3.connection import S3Connection
from progressbar import Percentage, ETA, FileTransferSpeed, Bar, ProgressBar
class S3Transfer(object):
def __init__(self, aws_key, aws_secret):
self.conn = S3Connection(aws_key, aws_secret)
self.progress_bar = None
def _update_progress_bar(self, bytes_transferred, size):