"I have a trick that makes things easier for me. Since writing is very hard and rewriting is comparatively easy and rather fun, I always write my scripts all the way through as fast as I can, the first day, if possible, putting in crap jokes and pattern dialogue—“Homer, I don’t want you to do that.” “Then I won’t do it.” Then the next day, when I get up, the script’s been written. It’s lousy, but it’s a script. The hard part is done. It’s like a crappy little elf has snuck into my office and badly done all my work for me, and then left with a tip of his crappy hat. All I have to do from that point on is fix it. So I’ve taken a very hard job, writing, and turned it into an easy one, rewriting, overnight. I advise all writers to do their scripts and other writing this way. And be sure to send me a small royalty every time you do it." - John Swartzwelder
View data_validations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w -s | |
# -*- coding: utf-8 -*- | |
require 'axlsx' | |
## Some documentation ## | |
### Axlsx Gem ### | |
# Axlsx Docs: http://rubydoc.info/gems/axlsx/frames | |
# Axlsx::DataValidation: http://rubydoc.info/gems/axlsx/Axlsx/DataValidation |
View ssh-known-hosts-mgmt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a short collection of tools that are useful for managing your | |
# known_hosts file. In this case, I'm using the '-f' flag to specify the | |
# global known_hosts file because I'll be adding many deploy users on this | |
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts | |
# Add entry for host | |
ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts | |
# Scan known hosts | |
ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com |
View natophon.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################### | |
# # | |
# # | |
# NATO String converter # | |
# # | |
# Description: converts string (first parameter given) # | |
# to NATO phonetics-alphabet # | |
# # |
View cursed_report.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ShellScriptUtils | |
class CursedReport | |
def initialize(message = nil) | |
@clear_commands = [] | |
@message = message | |
update @message | |
end | |
def update(message) | |
clear @message # clear the current message |
View data.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A12345 Jon Osterman | |
A23456 Walter Kovacs | |
A34567 Daniel Dreiberg | |
987 Dr. Manhattan | |
876 Rorshach | |
765 Night Owl | |
A12345 987 | |
A23456 876 |
View gencert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bash shell script for generating self-signed certs. Run this in a folder, as it | |
# generates a few files. Large portions of this script were taken from the | |
# following artcile: | |
# | |
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html | |
# | |
# Additional alterations by: Brad Landers | |
# Date: 2012-01-27 |
View pingr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'logger' | |
require 'open3' | |
require 'optparse' | |
require 'ostruct' | |
require 'thread' | |
class ShellScript |
View file_binary.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excerpt from ptools gem | |
# Returns whether or not +file+ is a binary non-image file, i.e. executable, | |
# shared object, ect. Note that this is NOT guaranteed to be 100% accurate. | |
# It performs a "best guess" based on a simple test of the first | |
# +File.blksize+ characters, or 4096, whichever is smaller. | |
# | |
# By default it will check to see if more than 30 percent of the characters | |
# are non-text characters. If so, the method returns true. You can configure | |
# this percentage by passing your own as a second argument. |
View ac-telemetry.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
$: << './lib' | |
require 'socket' | |
require 'bindata' | |
require 'json' | |
class UTF8String < BinData::String | |
def snapshot |
NewerOlder