Skip to content

Instantly share code, notes, and snippets.

💭
lol no

Cameron Tod cam8001

💭
lol no
Block or report user

Report or block cam8001

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cam8001
cam8001 / correto_unifi.sh
Created Mar 28, 2020
Corrretto JAVA_HOME on Ubuntu 16.04. Replace /etc/init.d/unifi with this!
View correto_unifi.sh
# JAVA_HOME is /usr/lib/jvm/java-1.8.0-amazon-corretto/
!/bin/bash
#
# /etc/init.d/UniFi -- startup script for Ubiquiti UniFi
#
#
### BEGIN INIT INFO
# Provides: unifi
# Required-Start: $local_fs $remote_fs $network
@cam8001
cam8001 / ubuntu-allocate-eip-on-launch.sh
Last active Mar 18, 2020
EC2 User Data script to allocate an EIP on launch.
View ubuntu-allocate-eip-on-launch.sh
#!/bin/bash
#
# Associate a given elastic IP with an instance on boot.
#
# Useful in autoscaling groups with a max-size of 1, where you always want the
# same IP for a given instance.
#
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
AWS_DEFAULT_REGION=ap-southeast-2
@cam8001
cam8001 / get-all-recovery-points.sh
Created Mar 17, 2020
Get all AWS Backup recovery point ARNs as a simple list
View get-all-recovery-points.sh
#!/bin/bash
aws backup list-recovery-points-by-backup-vault --backup-vault-name Default --query 'RecoveryPoints[*].[RecoveryPointArn]' --output text
View oracle_rant.md

oraguy on Nov 13, 2018 on: Ask HN: What's the largest amount of bad code you have ever seen work?

Oracle Database 12.2.

It is close to 25 million lines of C code.

What an unimaginable horror! You can't change a single line of code in the product without breaking 1000s of existing tests. Generations of programmers have worked on that code under difficult deadlines and filled the code with all kinds of crap.

Very complex pieces of logic, memory management, context switching, etc. are all held together with thousands of flags. The whole code is ridden with mysterious macros that one cannot decipher without picking a notebook and expanding relevant pats of the macros by hand. It can take a day to two days to really understand what a macro does.

@cam8001
cam8001 / example-apgiw-lambda-proxy.sam.yaml
Last active Dec 2, 2019
Example SAM template for API Gateway with Lambda proxy integration
View example-apgiw-lambda-proxy.sam.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Globals:
Api:
EndpointConfiguration: REGIONAL
# Your CORS hosts need to be in this format - note the two layers of quotes.
Cors: "'*'"
# Our Python callback
@cam8001
cam8001 / set_java_home.sh
Created Oct 5, 2019
Set java_home for Coretto, if using update-alternatives
View set_java_home.sh
# @see https://stackoverflow.com/a/11542973/15088
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
@cam8001
cam8001 / make_small_gif_ffmpeg.sh
Created Sep 17, 2019
make_small_gif_ffmpeg.sh
View make_small_gif_ffmpeg.sh
#!/bin/bash
start_time=0:22
duration=2.5
scale=180
fps=15
palette="/tmp/palette.png"
filters="fps=$fps,scale=$scale:-1:flags=lanczos"
@cam8001
cam8001 / imessage_dump.py
Last active Aug 29, 2019 — forked from bgulla/imessage_dump.py
Dumps all images from iMessages.
View imessage_dump.py
import os
import pwd
import shutil
from datetime import datetime, date
username = pwd.getpwuid(os.getuid()).pw_name
rootDir = "/Users/{}/Library/Messages/Attachments".format(username)
destDir = "/Users/{}/Desktop/imessage_dump".format(username)
IGNORE_STRING = "pluginPayloadAttachment"
@cam8001
cam8001 / upgrade-python.sh
Last active Jul 29, 2019
Upgrade python to python 3 on Amazon Linux 2
View upgrade-python.sh
sudo -s
yum update -y
yum install -y python36
alternatives --set python /usr/bin/python3.6
pip install --upgrade pip
visudo
# Add /usr/local/bin to secure_path
source ~/.bashrc
# @see https://stackoverflow.com/a/40616976/15088
@cam8001
cam8001 / dns-ubuntu.md
Last active Mar 17, 2020
Fixing broken DNS after dnsmasq freaks out on Ubuntu
View dns-ubuntu.md

FIRST - check what is going on with dnsmasq at /etc/dnsmasq.d/01-pihole.conf.

In my case, dnsmasq/pihole-FTL wasn't starting because it was binding to a non-existent network interface. I had moved an instance from t2.micro to t3.nano. t3.nanos use the nitro hypervisor, which presents network interfaces differently. So, my primary network interface name changed from eth0 to ens5.

Pihole's forked dnsmasq implemention is called pihole-FTL. Just try running that (type it into the console) and see if it fixes things.

If not:

  • In Ubuntu 16.04, 16.10, 18.04 and 18.10, dns is handled by systemd-resolved.
  • You can see how DNS is resolving by running systemd-resolve --status
You can’t perform that action at this time.