Skip to content

Instantly share code, notes, and snippets.

View pefoley2's full-sized avatar

Peter Foley pefoley2

View GitHub Profile
@pefoley2
pefoley2 / gist:7781810
Created December 4, 2013 03:18
cross!
set -e
set -o pipefail
TOPDIR=`pwd`
BUILD=`/usr/share/gnuconfig/config.guess`
TARGET=$1
DIR=$TOPDIR/$TARGET
export ARCH=`echo $TARGET | sed 's/-.*//'`
if test -z $TARGET; then
echo "Error: must specify target"
echo "Usage: ./cross.sh alpha-linux"
@pefoley2
pefoley2 / gist:8022705
Created December 18, 2013 13:52
usb bootable script
MIRROR="distfiles.gentoo.org"
ISO=`wget -q -O - http://$MIRROR/releases/amd64/autobuilds/latest-iso.txt | grep -v \# | sed "s#/.*##"`
wget -N http://$MIRROR/releases/amd64/autobuilds/$ISO/install-amd64-minimal-$ISO.iso
7z e -y install-amd64-minimal-$ISO.iso image.squashfs isolinux/gentoo isolinux/gentoo.igz
read -p "Enter block device to format (blank to skip): " DEV
if ! test -z $DEV; then
[ `id -u` != 0 ] && echo "must be root" && exit
dd if=/dev/zero of=/dev/$DEV bs=512 count=1
parted /dev/$DEV mklabel msdos
parted /dev/$DEV mkpart primary 0% 100%
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import re
from glob import glob
from requests import head
def main():
#!/usr/bin/python3 -OO
import logging
import socket
import pygame
import pyudev
import subprocess
import time
count = 0
#!/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"
@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 .