Skip to content

Instantly share code, notes, and snippets.

View scottwallacesh's full-sized avatar

Scott Wallace scottwallacesh

View GitHub Profile
@scottwallacesh
scottwallacesh / openpgp.md
Created November 8, 2021 19:27
OpenPGP identity proof
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adaway.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adblock-nocoin-list/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adguard-simplified/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-adservers/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-ad/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-malvertising/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-malware/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-tracking/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/easylist/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/easyprivacy/list.txt
def cache(func):
"""
Decorator function to cache the returned object of a function.
"""
cache_bucket = {}
def store_and_retrieve(*args, **kwargs):
"""
Function to store and return objects in the cache.
"""
@scottwallacesh
scottwallacesh / determrand.py
Created November 9, 2018 09:46
Deterministic "random" numbers filter_plugin for ansible
# vim: set ft=python:
"""Deterministic "random" numbers jinja filter for ansible.
Place in filter_plugins/ to use.
"""
import random
def determrand(high, seed, low=0):
@scottwallacesh
scottwallacesh / build-openwrt-nginx-ssl.sh
Last active May 26, 2020 16:00
Compile nginx with SSL for OpenWRT
# Pre-requisites
brew install gnu-tar gnu-getopt gnu-time gawk wget grep
# Case sensitive-filesystem
hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
hdiutil attach OpenWrt.sparseimage
cd /Volumes/OpenWrt
# OpenWrt/LEDE source
git clone https://github.com/openwrt/openwrt.git

Keybase proof

I hereby claim:

  • I am scottwallacesh on github.
  • I am scottsome (https://keybase.io/scottsome) on keybase.
  • I have a public key ASAtKyQY5bvl0kxDTiF7K_D4WYkSvmXjIU7ezucIOB_gnAo

To claim this, I am signing this object:

@scottwallacesh
scottwallacesh / openwrt-blockads.sh
Created June 29, 2017 17:44
Script for OpenWRT ad blocking
BLOCKADS=/etc/dnsmasq.d/blockads
CONF=/etc/dnsmasq.conf
cat - << EOF > ${CONF}
conf-dir=$(dirname ${BLOCKADS})
EOF
# Create the directory
mkdir -p $(dirname ${BLOCKADS})
@scottwallacesh
scottwallacesh / blockads.sh
Created June 29, 2017 08:29
Block ads using dnsmasq
#!/bin/bash
BLOCKADS=/etc/dnsmasq.d/blockads
# Create the directory
mkdir -p $(dirname ${BLOCKADS})
# Fetch the List Of Evil™
/bin/curl -sq "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" | /bin/xargs -n1 -I@ echo "address=/@/127.0.0.1" > ${BLOCKADS}
@scottwallacesh
scottwallacesh / validate_ip.py
Created June 14, 2017 10:27
Small Python function to validate an IP address
def is_valid_ip(ip):
m = re.match(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$", ip)
return bool(m) and all(map(lambda n: 0 <= int(n) <= 255, m.groups()))
@scottwallacesh
scottwallacesh / build-libmediainfo.sh
Last active October 7, 2016 07:45
Steps for installing libmediainfo on an old Netgear ReadyNAS Ultra 4
# Install libmms
apt-get install libmms0
# Fetch and compile libmediainfo
cd /c/src
curl -LO https://mediaarea.net/download/binary/libmediainfo0/0.7.89/MediaInfo_DLL_0.7.89_GNU_FromSource.tar.bz2
tar xvfh MediaInfo_DLL_0.7.89_GNU_FromSource.tar.bz2
cd MediaInfo_DLL_GNU_FromSource
./SO_Compile.sh
( cd ZenLib/Project/GNU/Library && make install )