Skip to content

Instantly share code, notes, and snippets.

View briancline's full-sized avatar

Brian Cline briancline

  • SoftLayer / IBM Cloud
  • Dallas, Texas
View GitHub Profile
@briancline
briancline / gist:5598491
Created May 17, 2013 11:26
Thrift 0.8.0 -> 0.9.0 RPM spec file changes
--- thrift-0.8.0.spec 2012-06-10 16:50:54.000000000 -0500
+++ thrift-0.9.0.spec 2013-05-17 02:37:48.000000000 -0500
@@ -39,7 +39,7 @@
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
Name: thrift
-Version: 0.8.0
+Version: 0.9.0
Release: 1%{?dist}
Summary: A multi-language RPC and serialization framework
echo "ttyS0" > /etc/securetty
vi /etc/grub.conf
# Add console=ttyS0 to the end of kernel line(s)
vi /etc/sysconfig/init
# Edit ACTIVE_CONSOLES to look like:
ACTIVE_CONSOLES="/dev/tty[1-6] /dev/ttyS0"
# If on a live system, do the following
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;

Booting with CNXSoft image

Reference: http://www.cnx-software.com/2012/07/31/84-mb-minimal-raspbian-armhf-image-for-raspberry-pi/

curl -O https://dl.dropbox.com/u/45842273/2012-07-15-wheezy-raspian-minimal.img.7z

yum install p7zip
7za e 2012-07-15-wheezy-raspian-minimal.img.7z

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2012-07-15-wheezy-raspian-minimal.img -net nic -net user -vnc :0 -net tap,ifname=vnet0,script=no,downscript=no
@briancline
briancline / gist:7530880
Last active December 28, 2015 16:39
Simple Luhn formula function
<?php
/* From http://adrianotto.com/2011/10/better-luhn-formula-validator-for-php/ */
/*
* Copyright 2011 Adrian Otto
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@briancline
briancline / gist:7610991
Last active December 29, 2015 03:49
Read/write tags from shell on OSX Maverick
# Read existing tags, output as JSON string
xattr -p com.apple.metadata:_kMDItemUserTags ${file} | xxd -r -p | plutil -convert json -o - -
# Write tags to file
PLIST_START='<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array>'
PLIST_END='</array></plist>'
XTAG="Red\n6"
XTAG_PLIST="${PLIST_START}<string>${XTAG}</string>${PLIST_END}"
XTAG_BINARY_PLIST=$(echo -e $XTAG_PLIST | plutil -convert binary1 -o - - | xxd -c16 -g2 -p)
bc:~/dev/openstack/glance% python
Python 2.7.5+ (default, Sep 17 2013, 15:31:50)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'nonempty' if ('') else 'empty'
empty
>>> print 'nonempty' if ('', '') else 'empty'
nonempty
>>> print 'nonempty' if all(('', '')) else 'empty'
empty
@briancline
briancline / swift-docker-steps.sh
Last active January 1, 2016 08:29
Updated set of steps to take within a Docker container to run a Swift All-in-One (SAIO) dev/test install (to be turned into an improved Dockerfile)
#!/usr/bin/env bash
## Known awesomeness:
## - Passes all unit tests
## - Passes all functional tests (skips the last 20 though)
## - Passes all probe tests
##
## Known issues:
## - Certain package upgrades cause issues, mostly around upstart not working in
## Ubuntu containers; as a result, initctl and ischroot are linked to /bin/true
@briancline
briancline / 00session
Last active January 1, 2016 08:49
My Ctrl-D is better than your Ctrl-D
root@file02:~# docker run -i -t -p=22 ubuntu /bin/bash
root@50a921e05835:/# exit
root@file02:~#
Message from syslogd@file02 at Dec 24 23:32:20 ...
kernel:[1106236.240151] general protection fault: 0000 [#1] SMP
Message from syslogd@file02 at Dec 24 23:32:20 ...
kernel:[1106236.244003] Stack:
Message from syslogd@file02 at Dec 24 23:32:20 ...
@briancline
briancline / doge.py
Created January 6, 2014 06:58
First pass at rudamentary doge bark detection using a webcam mic attached to a Raspberry Pi. Also, this constantly keeps track of the current max sample value in Redis (not dB, not RMS, just peak sample value) so that other things can grab the value(s).
#!/usr/bin/env python
from __future__ import print_function
import alsaaudio
import audioop
import sys
import time
import redis