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 'rubygems' | |
require 'base32' | |
require 'openssl' | |
int = 30 | |
now = Time.now.to_i / int | |
key = Base32.decode File.read('secret.key').strip |
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 | |
# ARPs for all the IPs aliased to this machine. | |
data = %x[ifconfig -a].split /\n\n/ | |
data.each do |block| | |
d = /(eth\d:\d+)\s+/.match(block) | |
a = /inet addr:(\d+\.\d+\.\d+\.\d+)/.match(block) |
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 'date' | |
certs = [] | |
regex = /([\w\-\.]+):\s+Not After : (.+)/ | |
today = Date.today | |
%x[grep -H 'Not After' #{ARGV.shift}].each_line do |line| | |
data = regex.match line |
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
namespace :clone do | |
desc 'destructively copy the source environment database to the target' | |
task :database, [:source, :target] => :environment do |t, args| | |
source = args[:source].to_sym | |
target = args[:target].to_sym | |
versions = {} | |
[ source, target ].each do |db| | |
ActiveRecord::Base.establish_connection db |
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/sh | |
bold=$(tput bold) | |
norm=$(tput sgr0) | |
ENV="" | |
GUID="" | |
NAME="" | |
NEWVOL="" | |
OLDVOL="" |
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
package ip; | |
use nginx; | |
sub handler { | |
my $r = shift; | |
my $ip = $r->remote_addr; | |
$r->send_http_header("text/html"); | |
$reply = <<END; |
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 | |
# A simple class for reading values from the DG600F coin acceptor sold by | |
# SparkFun (https://www.sparkfun.com/products/11636) | |
# | |
# The coin acceptor must be configured to send three bytes per coin; see section | |
# 8.6 of the manual. | |
# | |
# You can configure the serial device and baud rate, e.g.: | |
# |
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
require 'json' | |
require 'net/http' | |
require 'socket' | |
require 'uri' | |
# first argument is the url for the passworddb server | |
uri = URI.parse ARGV.shift | |
$passdb = Net::HTTP.new uri.host, uri.port | |
# second argument is the local port for our webhook |
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 | |
# Ruby interface for Griffin PowerMate | |
require 'usb' | |
class PowerMate | |
VENDOR_ID = 0x077d | |
PRODUCT_ID_NEW = 0x0410 | |
PRODUCT_ID_OLD = 0x04AA |
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
Aws::S3::Client.new( | |
access_key_id: ENV['AWS_ACCESS_KEY'], | |
secret_access_key: ENV['AWS_SECRET_KEY'], | |
region: 'default', | |
endpoint: 'http://s3.example.org', | |
signature_version: 's3' | |
) |
OlderNewer