Skip to content

Instantly share code, notes, and snippets.

View pefoley2's full-sized avatar

Peter Foley pefoley2

View GitHub Profile
#!/bin/bash
case $script_type in
up)
ip netns add vpn
ip link set dev "$1" up netns vpn mtu "$2"
ip netns exec vpn ip link set dev lo up
ip netns exec vpn ip addr add dev "$1" local "$4" peer "$5"
;;
route-up)
ip netns exec vpn ip route add default via "$route_vpn_gateway"
#!/usr/bin/python3 -OO
import logging
import socket
import pygame
import pyudev
import subprocess
import time
count = 0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import re
from glob import glob
from requests import head
def main():
@pefoley2
pefoley2 / deepdream.py
Last active August 29, 2015 14:24
Deepdream
#!/usr/bin/python2
import numpy as np
import scipy.ndimage as nd
import PIL.Image
import sys
sys.path.append('../caffe/distribute/python')
import caffe
# a couple of utility functions for converting to and from Caffe's input image layout
@pefoley2
pefoley2 / bashrc
Last active August 29, 2015 14:22
Pia
alias pia="sudo ip netns exec pia sudo -u peter"
@pefoley2
pefoley2 / Parser.js
Created May 21, 2015 23:29
Irssi import for tjhsstBot
var fs = require('fs'),
util = require('util'),
mixin = require('./util').mixin,
EventEmitter = require('events').EventEmitter,
// Default regular expressions for log parsing
defaultRegexps = {
// Log open / log close / day change: $1 = date+time
logopen: /^--- Log opened (.*)$/,
logclose: /^--- Log closed (.*)$/,
daychange: /^--- Day changed (.*)$/,
@pefoley2
pefoley2 / cdupdate.sh
Created May 6, 2015 03:42
Automated installer!
echo 'read -s -n 1 -t 5 -p "Press any key to exit" && exit
/stage1.sh |& tee log
chroot /mnt/gentoo /stage2.sh |& tee -a log
mv log /mnt/gentoo
rm /mnt/gentoo/stage2.sh
init 0' >> etc/local.d/auto.start
chmod +x etc/local.d/auto.start
cp mnt/cdrom/stage*.sh .
import logging
import sys
import time
from configparser import ConfigParser
from irc.client import SimpleIRCClient
class IrcClient(SimpleIRCClient):
def __init__(self, nick, config):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ldap3
if __name__ == '__main__':
import ssl
# ssl.CERT_REQUIRED
tls = ldap3.Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2)
@pefoley2
pefoley2 / gssapi_ldap.py
Last active August 29, 2015 14:18
GSSAPI LDAP
# -*- coding: utf-8 -*-
import gssapi
import ldap3
from ldap3.protocol.sasl.sasl import send_sasl_negotiation, abort_sasl_negotiation
NO_SECURITY_LAYER = 1
INTEGRITY_PROTECTION = 2
CONFIDENTIALITY_PROTECTION = 4