Skip to content

Instantly share code, notes, and snippets.

Paul Fawkesley paulfurley

Block or report user

Report or block paulfurley

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
@paulfurley
paulfurley / expirybot notes.md
Last active Sep 15, 2018
Rebuild sks keyserver 1.1.6 on debian
View expirybot notes.md

keyserver-c.expirybot.com

  • AKA keyserver.paulfurley.com

  • running sks-1.1.6

  • running github.com/paulfurley/expirybot via cron

  • only recon port, no public PKS queries

  • peered with other keyservers & keyserver-b.expirybot.com

keyserver-b.expirybot.com

@paulfurley
paulfurley / requests_wrapper.py
Last active May 30, 2018
Wrapper for python requests providing session and user agent
View requests_wrapper.py
import requests
class RequestsWrapper():
def __init__(self, user_agent):
self._session = requests.Session()
self._user_agent = user_agent
def get(self, *args, **kwargs):
headers = requests.structures.CaseInsensitiveDict(
@paulfurley
paulfurley / Makefile
Last active May 17, 2019
Makefile for activating a virtualenv and installing requirements. Uses requirements-to-freeze.txt / requirements.txt pattern
View Makefile
# Put *unversioned* requirements in `requirements-to-freeze.txt` as described below.
# `requirements.txt` will be automatically generated from `pip freeze`
# https://www.kennethreitz.org/essays/a-better-pip-workflow
venv/bin/activate: requirements-to-freeze.txt
rm -rf venv/
test -f venv/bin/activate || virtualenv -p $(shell which python3) venv
. venv/bin/activate ;\
pip install -Ur requirements-to-freeze.txt ;\
pip freeze | sort > requirements.txt
@paulfurley
paulfurley / google-analytics.html
Last active Jul 8, 2018
Google Analytics that respects Do-Not-Track header
View google-analytics.html
<script>
var dnt = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
if (dnt != "1" && dnt != "yes") {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('set', 'anonymizeIp', true);
@paulfurley
paulfurley / apt-key-add-from-fingerprint.md
Last active Mar 17, 2018
Safer `apt-key add` based on a key fingerprint
View apt-key-add-from-fingerprint.md

Apt-key add from key fingerprint

$ sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key 0xDBA36B5181D0C816F630E889D980A17457F6FB06
@paulfurley
paulfurley / mkdir_p.py
Created Jan 27, 2018
Python `mkdir -p` equivalent
View mkdir_p.py
import os
def mkdir_p(directory):
if not os.path.isdir(directory):
os.makedirs(directory)
return directory
@paulfurley
paulfurley / organise-cctv
Last active Jan 24, 2018
/etc/cron.hourly/organise-cctv on cctv-server
View organise-cctv
#!/bin/sh -eu
PATH=/bin:/usr/bin
DIR=/media/seagate_250gb/cameras/front
USER="camera-front"
cd_to_directory() {
cd "$DIR"
}
View cron-wrap
#!/bin/sh -u
LOG_FILE="${HOME}/log/$(date --iso-8601=seconds).log"
touch "${LOG_FILE}"
$1 "$@" >> ${LOG_FILE} 2>&1
EXIT_CODE=$?
@paulfurley
paulfurley / lets_encrypt_webroot_notes.md
Created Dec 11, 2017
Let's Encrypt / nginx / webroot notes
View lets_encrypt_webroot_notes.md

/etc/nginx/sites-enabled/www.paulfurley.com_HTTP :

server {                                                                        
  listen 80;                                                                    
  listen  [::]:80;                                                              
  server_name www.paulfurley.com;                                               
                                                                                
  location /.well-known/acme-challenge/ {                                       
    # For the letsencrypt "webroot" plugin                                      
@paulfurley
paulfurley / randomize-mac-addresses.sh
Last active May 28, 2019
In Ubuntu 16.04, randomize WiFi MAC addresses with a daily rotation - /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
View randomize-mac-addresses.sh
#!/bin/sh
# /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# INSTALL
#
# > curl -L 'https://gist.github.com/paulfurley/46e0547ce5c5ea7eabeaef50dbacef3f/raw/56ee5dd5f40dec93b8f7438cbdeda5475ea3b5d2/randomize-mac-addresses.sh' |sudo tee /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# > sudo chmod +x /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# Configure every saved WiFi connection in NetworkManager with a spoofed MAC
You can’t perform that action at this time.