Skip to content

Instantly share code, notes, and snippets.

View alexhwoods's full-sized avatar

Alex Woods alexhwoods

View GitHub Profile
@alexhwoods
alexhwoods / localhost.md
Created May 26, 2023 13:43
Route *.localhost traffic to localhost

Route *.localhost traffic to localhost

Inspired and adjusted from this gist.

  1. Install dnsmasq
brew install dnsmasq
  1. Setup
@alexhwoods
alexhwoods / auth-0.ts
Last active October 31, 2022 15:06
Go from an Auth0 user id, to one used in a URL
function auth0Url(tenant: string, userId: string) {
const userIdInUrl = btoa(encodeURIComponent(userId))
return `https://manage.auth0.com/dashboard/us/${tenant}/users/${userIdInUrl}`
}
auth0Url("foo-development", "auth0|1234")
@alexhwoods
alexhwoods / install-confluent.md
Last active May 14, 2020 15:31
Install the Kafka Command Line Tools
  1. Download the Confluent Platform.
  2. Decompress the downloaded file, and move the confluent-x.y.z (where x.y.z is the major.minor.patch version) to your $HOME directory
  3. Add the following line your .bashrc or .zshrc
export PATH="${HOME}/confluent-x.y.z/bin:${PATH}"
@alexhwoods
alexhwoods / export.sql
Created January 21, 2020 19:38
Export a mysql query to a CSV
mysql -h <host-name> -D <database-name> -u <username> --password=<password> -e "SELECT 1;" | tr '\t' ',' >> output.csv
@alexhwoods
alexhwoods / README.md
Last active May 5, 2023 13:25
Fixing "must be superuser to create FOR ALL TABLES publication" error from Debezium with PostgreSQL on Aiven

Issue

You're trying to use Kafka Connect, using the Debezium to Postgres, and your Postgres database is running on Aiven. You have pgoutput selected as the plugin name (this is the best choice).

You're getting this error: Caused by: org.postgresql.util.PSQLException: ERROR: must be superuser to create FOR ALL TABLES publication.

Why This is Happening

Aiven doesn't allow you to have a superuser. Debezium tries to create a publication, and fails, because it's not using a superuser.

@alexhwoods
alexhwoods / .sh
Created September 8, 2019 16:06
Kill all running Docker containers
docker kill $(docker ps -q)
@alexhwoods
alexhwoods / .zprofile
Created September 6, 2019 18:03
Restart wifi command - Mac
restart() {
if [[ $@ == "wifi" ]]; then
command networksetup -setairportpower en0 off
command networksetup -setairportpower en0 on
else
command echo not yet defined
fi
}
const AWS = require('aws-sdk')
AWS.config.update({
accessKeyId: "access-key",
secretAccessKey: "secret-access-key"
});
new AWS.S3().putObject(
{
Bucket: "bucket-name",
@alexhwoods
alexhwoods / reveal.js
Created June 22, 2019 16:53
Show entire object
const util = require('util')
module.exports = (obj) => util.inspect(obj, { showHidden: false, depth: null })
@alexhwoods
alexhwoods / dijkstra.py
Last active September 26, 2016 21:01
Dijkstra's Algorithm (clean)
# python 3 only!!!
import collections
import math
class Graph:
def __init__(self):
self.vertices = set()
self.edges = collections.defaultdict(list)
self.weights = {}