Skip to content

Instantly share code, notes, and snippets.

View FauxFaux's full-sized avatar

Chris West FauxFaux

View GitHub Profile
package ptv.publishing;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@FauxFaux
FauxFaux / gist:1671267
Created January 24, 2012 17:20
Machine set-up
sudo apt-get install git zsh screen && git clone --recursive git://git.goeswhere.com/git/rc.git && rc/install.sh && chsh
exit
sagi fail2ban libpam-cracklib shorewall vim-nox xbase-clients build-essential aptitude apt-file aria2 wget etckeeper dnsutils dos2unix ncdu p7zip pbzip2 pwgen tig openjdk-6-jdk most
printf "deb http://ftp.uk.debian.org/debian-backports/ squeeze-backports main non-free contrib\ndeb-src http://ftp.uk.debian.org/debian-backports/ squeeze-backports main non-free contrib\n" | s tee /etc/apt/sources.list
sagu
sagi -t squeeze-backports gitolite git-daemon-run lighttpd gitweb
screen
faux@sweevo:~$ rvm info
jruby-1.7.11:
system:
uname: "Linux sweevo 3.13.0-19-generic #40-Ubuntu SMP Mon Mar 24 02:36:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.0(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.0.2 (x86_64-pc-linux-gnu)"
faux@sweevo:~% which jruby
/home/faux/.rvm/rubies/jruby-1.7.11/bin/jruby
faux@sweevo:~% jruby -wdv
Error: Could not find or load main class
sta() { s service unbound start 2>/dev/null >/dev/null && echo started }
sto() { s service unbound stop >/dev/null && echo stopped }
ki() { s killall unbound >/dev/null && echo killed }
te() { dig +dnssec example.com @localhost | fgrep HEADER }
ki; sta; te; te; sto; sta; te; te; sto; sta; te; ki; sta; te; te
killed
started
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51393
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40128
javascript:t=document.getElementsByTagName("*");for(var i=0;i<t.length;++i){var a=t[i];var c=window.getComputedStyle(a);if(c.position&&c.position=="fixed"){a.parentNode.removeChild(a);}};
@FauxFaux
FauxFaux / chrome2ca.sh
Created December 30, 2015 00:18
Capture CAs from Chrome history
locate -r '/History$' | fgrep chrom | while read x; do echo select url from urls\; | sqlite3 "$x"; done > hist
cut -d/ -f 3 hist | sort -u | xargs -P200 -I{} -n1 -- sh -c ': | openssl s_client -connect {}:443 2> {}.path > {}.handshake'
for f in *.path; do if ! fgrep 'verify erro' $f >/dev/null; then grep -m1 '^depth' $f; fi; done | cut -d' ' -f 2- | sort | uniq -c | sort -n
for f in *.path; do if ! fgrep 'verify erro' $f >/dev/null; then grep -m1 '^depth' $f; fi; done | cut -d' ' -f 2- | sed 's/.*O = //;s/, OU =.*//;s/, CN = //;s/The //;s/[",.]//g;s/ Inc//' | sort | uniq -c | sort -n
@FauxFaux
FauxFaux / do-release-upgrade.md
Last active May 13, 2023 20:43
What does Ubuntu's do-release-upgrade script actually do?

Ubuntu encourage upgrading between releases by running a command, instead of by manually editing sources and getting on with it. This tool's name is do-release-upgrade, and I believe it should just be doing:

sed -i 's/wily/xenial/g' /etc/apt/sources.list /etc/apt/sources.list.d/*

This command does not explain what it wants to do, or why it is doing anything. It has, in the past:

  • Disabled repos I was using, and hence broken the software in them.
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
static const int supported_bits = 32;
@FauxFaux
FauxFaux / find_deleted_files.py
Created November 14, 2016 14:48
checkrestart / psdel reimplementation
#!/usr/bin/python3
# inspired by psdel, referenced from the checkrestart (debian-goodies) source code
import collections
import errno
import glob
import os
import re
import stat