Skip to content

Instantly share code, notes, and snippets.

View chuckwagoncomputing's full-sized avatar

David Holdeman chuckwagoncomputing

View GitHub Profile
@chuckwagoncomputing
chuckwagoncomputing / main.c
Last active October 27, 2018 00:48
Bobcat 225G welder idle controller
//*****************************************************//
// welder.c //
// 2016-4-11 //
// Written By David Holdeman //
// Miller Bobcat 225G Idle Solenoid Controller //
//*****************************************************//
// ATtiny45/85
// +-------+
// !RESET |* | VCC
@chuckwagoncomputing
chuckwagoncomputing / README.md
Last active November 28, 2015 01:20
WebAdd - Add up dollar values from a website

WebAdd

Script to add up dollar values from a website

webadd Test Example

webadd gets the dollar value from every line and adds them. If there is more than one dollar value on a line. you can select which one you want. Spaces or other characters between the dollar sign and numbers are not allowed.

@chuckwagoncomputing
chuckwagoncomputing / excuses.sh
Created November 28, 2015 01:14
BOFH excuses
#!/usr/bin/env bash
EXCUSES="/path/to/excuses.txt"
awk 'NR=='$((1 + $RANDOM % `nl $EXCUSES | tail -n 1 | awk '{print $1}' `))'{print;exit}' $EXCUSES
@chuckwagoncomputing
chuckwagoncomputing / qualitativeThree.rb
Last active December 14, 2016 17:21
FOAC Strategy: Keeps track of who has three pseudonyms, forgetting one in order to remember a better one
# Keep track of who has three pseudonyms, forgetting one in order to remember a better one
class StrategyqualitativeThree
def initialize(parent)
@strategy = parent
@player = @strategy.player
@memory = @strategy.memory
end
def remember(calledName, calledTeam, calledPosition, calledPseudonym, callerName)
# if someone called a number being remembered
@chuckwagoncomputing
chuckwagoncomputing / threePseudonymsMaybe.rb
Last active December 14, 2016 17:20
FOAC Strategy: Keeps track of who has three pseudonyms, with a 50% chance of remembering
# Keep track of who has three pseudonyms
class StrategythreePseudonymsMaybe
def initialize(parent)
@strategy = parent
@player = @strategy.player
@memory = @strategy.memory
end
def remember(calledName, calledTeam, calledPosition, calledPseudonym, callerName)
# if someone called a number being remembered
@chuckwagoncomputing
chuckwagoncomputing / threePseudonyms.rb
Last active December 14, 2016 17:19
FOAC Strategy: Keeps track of who has three pseudonyms
# Keep track of who has three pseudonyms
class StrategythreePseudonyms
def initialize(parent)
@strategy = parent
@player = @strategy.player
@memory = @strategy.memory
end
def remember(calledName, calledTeam, calledPosition, calledPseudonym, callerName)
# if someone called a number being remembered
@chuckwagoncomputing
chuckwagoncomputing / text.js
Created February 25, 2015 23:31
coordinate line font in javascript
var letters = {
' ' : [[50, 0, 50, 0]],
'!' : [[0, 45, 0, 50, 8],
[0, 10, 0, 35, 8]],
'"' : [[0, 10, 0, 20, 8],
[10, 10, 10, 20, 8]],
'#' : [[0, 35, 20, 35, 8],
[0, 25, 20, 25, 8],
[15, 20, 15, 40, 8],
[5, 20, 5, 40, 8]],
@chuckwagoncomputing
chuckwagoncomputing / foac.rb
Last active December 14, 2016 17:07
Four on a couch game sim
#!/usr/bin/env ruby
class Player
attr_accessor :name, :team, :position, :pseudonym
def initialize(name, team, pseudonym, strategy)
@name = name
@team = team
@position = name
@pseudonym = pseudonym
@selection = $players.reject { |a| a == @pseudonym }.sample
#!/bin/bash
BIRTHDAY=$1
DAYSTODAY=$(date +%j | sed "s/^0*//g")
DAYSATBIRTH=$(date -d "$BIRTHDAY" +%j | sed "s/^0*//g")
YEARSOLD=$(($(date +%Y)-$(date -d "$BIRTHDAY" +%Y)))
if [ $DAYSATBIRTH -gt $DAYSTODAY ]; then
YEARSOLD=$(($YEARSOLD-1));
DAYSSINCE=$(($((365-$DAYSATBIRTH))+$DAYSTODAY))
else
DAYSSINCE=$(($DAYSTODAY-$DAYSATBIRTH))
@chuckwagoncomputing
chuckwagoncomputing / xkcd_now_selector.sh
Created February 27, 2014 01:41
Selects the proper xkcd now image file for the time.
#!/bin/bash
# Change this to the directory containing the image files.
XKCDPATH="/usr/local/bin/xkcdnow"
HOUR=$(TZ=Asia/Kamchatka date +%H)
MINUTE=$(date +%M)
if [ $MINUTE -gt 00 -a $MINUTE -le 15 ]; then
MINUTE=15
elif [ $MINUTE -gt 15 -a $MINUTE -le 30 ]; then
MINUTE=30