Skip to content

Instantly share code, notes, and snippets.

View Oneiroi's full-sized avatar
:shipit:

David Busby Oneiroi

:shipit:
View GitHub Profile
@Oneiroi
Oneiroi / osx-aeolus-deps.sh
Created March 19, 2012 22:56
Aeolus @ OSX, Note: using homebrew + ruby version 1.9.3-p0
#!/bin/bash
BREW_RUBY_BIN="/usr/local/Cellar/ruby/1.9.3-p0/bin/"
echo "--- installing pre-requsite gems"
echo "rails
haml
nokogiri
will_paginate
deltacloud-client
simple-navigation
rest-client
@Oneiroi
Oneiroi / edge.sh
Created March 6, 2012 13:25
n2n sysvinit scripts
#!/bin/bash
# Author: David Busby <david.busby@psycle.com>
### BEGIN INIT INFO
# Provides: edge
# Required-Start: $supernode
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
@Oneiroi
Oneiroi / wordpress_importer.rb
Created February 9, 2012 17:41 — forked from stammy/wordpress_importer.rb
Import a WordPress database and generate markdown files for Jekyll
# based on the import script by icebreaker, which is based on mojombo's
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# https://gist.github.com/303570
# edited to rewrite image URLs to use my CloudFront URL
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
@Oneiroi
Oneiroi / gist:1276622
Created October 10, 2011 21:35
CentOS single nic bridge
put this in ifcfg-br0 :
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
ONBOOT=yes
DELAY=0
@Oneiroi
Oneiroi / find_packages_with_no_deps
Created October 9, 2011 12:26
Find packaes with no dependencies
rpm -qa | while read pname; do RES=`rpm -qR $pname`; [[ "$RES" == "" ]] && echo "$pname has no deps"; done
@Oneiroi
Oneiroi / scanosx.py
Created February 16, 2011 09:46
Scanning for available USB tty devices on OSX differes slightly from Linux.
#adapted from pySerial examples for use on OSX systems
import serial
from glob import glob
def _scan():
dev_list = glob('/dev/tty*usb*')
available = []
for dev in dev_list:
try:
s = serial.Serial(dev)
while true; do curl -H'User-agent: AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36' -s 'http://www.game.co.uk/webapp/wcs/stores/servlet/HubArticleView?hubId=639265&articleId=639266&catalogId=10201&langId=44&storeId=10151&&cm_mmc=Facebook-_-Digital-_-Fallout4-_-Link#NaN' | grep 'Check back later today' || chromium https://www.youtube.com/watch?v=H91rPIq2mN4; sleep 10; done
#
# ensure CWD contains dirs root and boot
# ensure sd card has not automounted elsewhere
# ensure ArchARM-rpi2.tgz exists in CWD
# ensure partitions configured as per: http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2
#
mkfs.vfat /dev/mmcblk0p1 && \
mount /dev/mmcblk0p1 ./boot && \
mkfs.ext4 /dev/mmcblk0p2 && \
mount /dev/mmcblk0p2 ./root && \
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
import os, glob, re
def main():
p = re.compile('^([0-9a-f]+-[0-9a-f]+)\s[a-z\-]{4}\s[0-9a-f]{8}\s[a-z0-9]{2}\:[a-z0-9]{2}\s[0-9]+\s+(.*)$')
smaps = glob.glob('/proc/[0-9]*/smaps')
for smap in smaps:
lines = open(smap).readlines()
for line in lines:
m = p.match(line)
if m and 'libc' in line:
name = open(smap.replace('smaps','status')).readlines()[0]