Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
@guyhughes
guyhughes / Frequency.java
Created April 16, 2016 01:10
ITI1121 Apirl 2014 question 7 exam
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.Random;
class Tuple {
private final char c;
private boolean visited;
public Tuple(char c){
#include <iostream>
int main ()
{
int z;
for (int i = 39; i < 43; i++){
std::cerr << "i: " << i << std::endl;
for (int j = 29; j < i-9; j+=3){
z = i % j;
std::cerr << "z: " << z << std::endl;
public class Cell<E> {
private E value;
public Cell(E value){
if (value == null)
throw new NullPointerException();
this.value = value;
}
public boolean isCell(){return true;}
@guyhughes
guyhughes / openvpn-resolv.conf-issues.md
Created April 20, 2016 14:36
How to make openvpn resolv.conf updates work
apt-get install openresolv
echo > vpntarget.ovpn <<<EOF
script-security 2
dhcp-option DNS 8.8.8.4
dhcp-option DNS 8.8.4.4
up /etc/openvpn/update-resolv-conf
@guyhughes
guyhughes / check-path-directories.bash
Created May 9, 2016 20:19
Check that every directory in $PATH exists
(IFS=:;for p in ${PATH}; do if [[ -d $p ]]; then echo "OK $p"; else echo "ERR $p"; fi; done; )
@guyhughes
guyhughes / kill-ssh-agents.posix.sh
Last active May 10, 2016 20:13
Kill all ssh-agents by process id using POSIX-ish tools only (cygwin-friendly)
ps -s | grep ssh-agent | sed -re 's/^\s+([[:digit:]]+).*$/\1/' | xargs kill -TERM

Aptly

aka how to make a stupid mirror

  1. get aptly (https://aur.archlinux.org/aptly.git)

  2. get the ubuntu-archive-keyring. can use any ssl mirror.

curl -OJL https://gpl.savoirfairelinux.net/pub/mirrors/ubuntu/project/ubuntu-archive-keyring.gpg.sig
@guyhughes
guyhughes / apt-metapackage.md
Created October 1, 2016 05:16
APT Build metapackage
  1. You need equivs
apt-get install equivs
  1. use it
mkdir my-metapackage
cd my-metapackage/
equivs-control ns-control
equivs-build ns-control
#!/bin/sh
OPTS=''
X="+ */\n"
while [ $# -gt 0 ]; do
case "$1" in
-*)
OPTS+="$OPTS $1"
;;
*)
X+="+ **/$1\n"
@guyhughes
guyhughes / virtualenvwrapper.md
Created December 22, 2016 19:27
virtualenvwrapper quickstart

virtualenvwrapper has broken dependencies right now on macOS, so install like this:

sudo pip install pbr
sudo pip install --no-deps stevedore
sudo pip install --no-deps virtualenvwrapper

So that the commands mkvirtualenv and workon stay in your shell, you're going to want to do this (if you use zsh or another shell, change the filename here):