Skip to content

Instantly share code, notes, and snippets.

View johnweldon's full-sized avatar

John Weldon johnweldon

  • Arizona
  • 03:06 (UTC -07:00)
View GitHub Profile
@johnweldon
johnweldon / aws_cost_report
Created September 2, 2024 18:39
Bash script to get last 3 months of AWS charges, and forecast for current month charges
#!/usr/bin/env bash
set -euo pipefail
TODAY="$(date "+%Y-%m-%d")"
NEXTM="$(date -v+1m "+%Y-%m-%d")"
THREE="$(date -v-3m "+%Y-%m-%d")"
BEGIN="${THREE:0:8}01"
END="${NEXTM:0:8}01"

How to Get Rich (without getting lucky):

Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how we transfer time and wealth. Status is your place in the social hierarchy.

Understand that ethical wealth creation is possible. If you secretly despise wealth, it will elude you.

Ignore people playing status games. They gain status by attacking people playing wealth creation games.

You’re not going to get rich renting out your time. You must own equity - a piece of a business - to gain your financial freedom.

@johnweldon
johnweldon / update_dynamic_dns
Created March 4, 2018 05:42
bash script to update dynamic dns ip address on google domains from a Zyxel C3000Z modem
#!/usr/bin/env bash
#
# Update Google Domains Dynamic DNS from Zyxel C3000Z modem information.
# Tested on a Centurylink issued modem, YMMV
#
# See https://support.google.com/domains/answer/6147083?hl=en for
# Google Domains help and credentials information
#

Keybase proof

I hereby claim:

  • I am johnweldon on github.
  • I am johnweldon (https://keybase.io/johnweldon) on keybase.
  • I have a public key whose fingerprint is 77E9 1E85 501D 0B6A 476D 9B39 9CF9 AF9D 7956 0500

To claim this, I am signing this object:

@johnweldon
johnweldon / debug.go
Created April 26, 2016 02:54
Useful http debugging file. Replaces http.DefaultTransport with a logger of all http traffic.
package main
import (
"fmt"
"io"
"net/http"
"net/http/httputil"
"os"
)
#!/bin/bash
read -r -d '' AWK <<EOF
{
date=\$1;
refname=\$2;
subject=substr(\$3,1,72);
sha=\$4;
len=split(refname, ref, "/");
DROP TABLE tempA; CREATE TABLE tempA ( style_cd CHAR(3), id_cd VARCHAR(15) );
DROP TABLE tempB; CREATE TABLE tempB ( item_desc VARCHAR(50), item_num CHAR(4), style_cd CHAR(3), id_cd VARCHAR(15) );
INSERT INTO tempA
SELECT 'A', 123456
UNION SELECT 'A', 654321
UNION SELECT 'B', 321456
UNION SELECT 'A', 654123
UNION SELECT 'C', 424242;
@johnweldon
johnweldon / start-sshagent
Created December 20, 2011 00:43
powershell script to start the ssh-agent
$ gcm start-sshagent | fl
Name : start-sshagent
CommandType : Function
Definition :
if($env:SSH_AGENT_PID) { echo "ssh-agent running"; return }
$private:gp = get-gitbinpath
if($private:gp) {
$private:out = & (join-path $private:gp "ssh-agent")