Skip to content

Instantly share code, notes, and snippets.

View rab's full-sized avatar
👨‍💻
Home Office is a mess (as usual)

Rob Biedenharn rab

👨‍💻
Home Office is a mess (as usual)
View GitHub Profile
@rab
rab / gist:874985
Created March 17, 2011 19:44
Steps for getting the 500Gb drives into the old server
  • Receive the pair of 500Gb drives for the old server.
  • REMOTE
    • turn off all datafeeds (done)
    • StylePath is DOWN (Thu 18:45)
    • do a full backup [A] (done at Thu 19:41)
    • StylePath is UP (~1hr downtime) (Thu 19:52, actual down 1:07)
  • copy the backup to new server and to a USB drive
@rab
rab / with_log_level.rb
Created March 31, 2011 13:48
temporarily change the logging level for the duration of a block
require 'logger'
module WithLogLevel
def with_log_level(level=Logger::INFO)
if logger
begin
original_level = logger.level
logger.level = level
yield
ensure
@rab
rab / xferlist.rb
Created May 28, 2011 21:35
Ruby script to xfer a set of directories to an sftp location
#!/usr/bin/env ruby -w
# Expected to be found at ~/code/ruby/xferlist.rb
# Move all files newer than the 'sentinel' to the web site
# skip all .doc files (MS-Word)
# skip all files containing a tilde (~) (local backup or archival copies)
# skip anything in 'old-notices'
#
# Deals with spaces in file/directory names by using the '?' shell wildcard
@rab
rab / output
Created October 10, 2011 13:48
Testing a die for bias
ruby randomness.rb rob_d20.txt
500 rolls from 1 to 20
Expected per bucket: 25.0 (σ ≈ 5.00)
10: ( 1)
11:
12:
13:
14:
15: (20)
@rab
rab / hello.clj
Created May 8, 2012 22:14 — forked from gigasquid/swarmcoding
Swarm coding instructions
(ns cincyfp.hello)
(+ 1 1)
;; given 3 integers in a sequence
;; generate the number of lights that are on in a berlin clock,
;; returning 5 rows
(defn make-counts [[hours minutes seconds]]
[
(- 1 (mod seconds 2))
@rab
rab / gist:2938025
Created June 15, 2012 18:27 — forked from st23am/gist:2937073
Git branch parsing
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
@rab
rab / .gitconfig
Last active May 14, 2024 07:05
A good starting point for ~/.gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or
@rab
rab / Bot.scala
Created November 14, 2012 01:02 — forked from geofflane/Bot.scala
Scalatron Bot
import util.Random
// rab - Rob Biedenharn
// based on Geoff Lane's Bot
// Wed Nov 14 17:44:48 EST 2012
/**
* This bot builds a 'direction value map' that assigns an attractiveness score to
* each of the eight available 45-degree directions. Additional behaviors:
* - aggressive missiles: approach an enemy master, then explode
@rab
rab / RobGreg.rb
Created November 21, 2012 01:13 — forked from st23am/robot3.rb
BaselineBot
require 'rrobots'
class RobGreg
include Robot
attr_reader :events
def near_a_wall?
x <= size || y <= size || x >= battlefield_width - size || y >= battlefield_height - size
end
@rab
rab / CycleRGB.ino
Created January 20, 2013 03:13
Arduino Digispark Sketch for cycling the RGB Shield
const int ledRed = 0;
const int ledGreen = 1;
const int ledBlue = 2;
const unsigned long delayTime = 20;
// Base the cycle on the graph ( http://upload.wikimedia.org/wikipedia/commons/5/5d/HSV-RGB-comparison.svg )
// at http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV
int maxVal = 127;