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 / 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 Jun 25, 2019
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
@cam8001
cam8001 / user_data.sh
Last active Jun 22, 2019
Ubuntu 18.04 User Data
View user_data.sh
#!/bin/bash
apt update && apt upgrade -y
snap install amazon-ssm-agent --classic
ln -fs /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
@cam8001
cam8001 / user_data.sh
Created May 11, 2019
Amazon Linux 2 EC2 basic boot script
View user_data.sh
#!/bin/bash
yum update -y
systemctl start amazon-ssm-agent
systemctl enable amazon-ssm-agent
@cam8001
cam8001 / awscli.bash
Created May 6, 2019
awscli quick reference
View awscli.bash
# From here:
# https://blog.ashiny.cloud/page/awscli-query-quickref/
#!/bin/bash -ex
export AWS_REGION=your-region-here
export AWS_PROFILE=your-cli-access-profile-here
export AWS_DEFAULT_OUTPUT=text
# Get your user ARN
aws iam get-user --query 'User.Arn'
@cam8001
cam8001 / purge_buckets.sh
Created Feb 5, 2019
Remove all s3 buckets in AWS CLI
View purge_buckets.sh
#!/bin/bash
aws s3 ls | cut -d" " -f 3 | xargs -I{} aws s3 rb s3://{} --force
You can’t perform that action at this time.