Skip to content

Instantly share code, notes, and snippets.

View chuckwagoncomputing's full-sized avatar

David Holdeman chuckwagoncomputing

View GitHub Profile
#!/bin/bash
clear
one()
{
FILETEXT=`cat $FILE | tail -c +5`
echo $FILETEXT
rm -f $FILE
}
two()
{
badopts()
{
echo -e "Usage: ifchanged [command to check] [number of seconds to wait between checks] [command to execute if not changed] [command to execute if changed]"
exit
}
if [ $# -ne 4 ]; then
badopts
else
while true; do
RES=`$1`
@chuckwagoncomputing
chuckwagoncomputing / random.rb
Created September 7, 2013 03:03
Random Selection Chance Counter
#!/usr/bin/env ruby
$randwins = 0
$swins = 0
$equal = 0
$tried = []
ARGV[0].to_i.times do
$times = 0
$num = rand(1..9)
$sel = rand(1..$num)
loop do
@chuckwagoncomputing
chuckwagoncomputing / counter.rb
Created September 7, 2013 03:02
Random Number Occurence Counter
#!/usr/bin/env ruby
$one = 0
$two = 0
$three = 0
$four = 0
$five = 0
$six = 0
$seven = 0
$eight = 0
$nine = 0
@chuckwagoncomputing
chuckwagoncomputing / schlock.sh
Created September 7, 2013 02:58
Schlock Mercenary Getter
#!/bin/bash
DATE=$(date -d "$1" +%Y-%m-%d)
URL="http://schlockmercenary.com/$DATE"
PICS=$(xidel $URL -e "//@src/resolve-uri(.)" 2> /dev/null | egrep '[0-9][a-z].(png|jpg)')
if [ -z "$PICS" ]; then
PICS=$(xidel $URL -e "//@src/resolve-uri(.)" 2> /dev/null | egrep '[0-9].[png|jpg]' | head -n 1)
fi
echo "$PICS"
exit
@chuckwagoncomputing
chuckwagoncomputing / infun.sh
Created August 10, 2013 16:53
Text insertion in functions
#!/bin/bash
LINE=$((`grep -n "$2()" $1 | head -c 1`+1))
./insert.sh $1 $LINE "$3"
exit
@chuckwagoncomputing
chuckwagoncomputing / error.log
Created July 11, 2013 17:16
camping init.d error
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1.554/lib/camping/server.rb:40:in `expand_path': no implicit conversion of nil into String (TypeError)
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1.554/lib/camping/server.rb:40:in `<class:Options>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1.554/lib/camping/server.rb:28:in `<class:Server>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1.554/lib/camping/server.rb:27:in `<module:Camping>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1.554/lib/camping/server.rb:26:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/camping-2.1
@chuckwagoncomputing
chuckwagoncomputing / xmltags.sh
Created June 27, 2013 21:07
Execution of functions from xml tags
xidel $1 -e 'xquery version "1.0"; for $i in //* return concat(name($i), " ", $i, "&#x00;")' | while read -d $'\0' i; do if `type $(echo $i | cut -d " " -f 1) 2> /dev/null | grep function` >> /dev/null; then $i; else :; fi; done
@chuckwagoncomputing
chuckwagoncomputing / log.txt
Created May 24, 2013 01:56
JeweryBox gem install errors
mkdir: : No such file or directory
Installing gems listed in /tmp/jewelrybox_gemstack-675292940.gems file...
installing mkdir: .....
..
@chuckwagoncomputing
chuckwagoncomputing / jargon.sh
Last active December 17, 2015 07:29
symbol jargon translator
#!/bin/bash
while true; do
read LINE
echo "$LINE" | while IFS= read -r -n1 i; do
case $i in
"<"|">")
echo -n "waka "
;;
"!")
echo -n "bang "