Skip to content

Instantly share code, notes, and snippets.

View scottwallacesh's full-sized avatar

Scott Wallace scottwallacesh

View GitHub Profile
@scottwallacesh
scottwallacesh / RSA_pubkey_to_PEM
Last active February 16, 2016 21:01
Create SSH public key in PEM format for OpenSSL encryption/decryption
openssl rsa -in ~/.ssh/id_rsa -pubout -out ~/.ssh/id_rsa.pub.pem
@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 )
@scottwallacesh
scottwallacesh / build-mono.sh
Created October 5, 2016 14:49
Steps for building Mono v3.10 on an old Netgear ReadyNAS Ultra 4
# Compiling Mono for the ReadyNAS Ultra-4 running Debian 4.0 (etch)
## Requires modern version of GCC and binutils
# Somewhere to build
mkdir -p /c/src
# Fetch and build GCC & deps
cd /c/src
curl -O ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.bz2
tar xvfh gcc-4.9.4.tar.bz2
@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 / 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 / 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})

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 / 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):
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.
"""
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