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 / 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
@cam8001
cam8001 / all_apple_ips.txt
Created Jan 26, 2019
All Apple IP address ranges. Useful for firewall rules.
View all_apple_ips.txt
# Generated by:
# ASN=AS714; whois -h whois.radb.net -- "-i origin $ASN" | awk '/^route:/ {print $2;}' | sort | uniq
# @see https://ipinfo.io/AS714
#
# ASN=AS6185; whois -h whois.radb.net -- "-i origin $ASN" | awk '/^route:/ {print $2;}' | sort | uniq
# @see https://ipinfo.io/AS6185
144.178.0.0/18
144.178.0.0/19
144.178.48.0/21
144.178.56.0/21
@cam8001
cam8001 / yum-debug-variables.py
Created Jul 17, 2018
Show yum variables as referenced in the files in /etc/yum.repos.d/
View yum-debug-variables.py
python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
You can’t perform that action at this time.