Skip to content

Instantly share code, notes, and snippets.

View tadman's full-sized avatar
🤔
Enumerating

Scott Tadman tadman

🤔
Enumerating
View GitHub Profile
@tadman
tadman / rubygems-warning.patch
Created May 11, 2011 04:28
Rubygems 1.8.1 Deprecate Warning Patch
diff --git a/Manifest.txt b/Manifest.txt
index 6e79ebd..6a2f480 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -121,6 +121,7 @@ test/rubygems/rubygems_plugin.rb
test/rubygems/sff/discover.rb
test/rubygems/simple_gem.rb
test/rubygems/test_config.rb
+test/rubygems/test_deprecate.rb
test/rubygems/test_gem.rb
@tadman
tadman / monkeypatch.rb
Created April 15, 2011 20:03
FreeTDS Configuration Monkeypatch
module ActiveRecord
class Base
def self.sqlserver_connection(config) #:nodoc:
config = config.dup.symbolize_keys!
config.reverse_merge! :mode => :dblib, :host => 'localhost', :username => 'sa', :password => ''
mode = config[:mode].to_s.downcase.underscore.to_sym
case mode
when :dblib
# <monkeypatch>
# raise ArgumentError, 'Missing :dataserver configuration.' unless config.has_key?(:dataserver)
#!/bin/sh
MYSQL_USER=root
MYSQL_PASSWORD=<PASSWORD>
MYSQL_OPTS=
RETAIN_PERIOD=5
DUMP_DIRECTORY="$HOME/dumps"
class Test::Unit::TestCase
alias_method :run_without_transaction, :run
def run(result)
exception = nil
Sequel::Model.db.transaction do
begin
run_without_transaction(result)
rescue => exception
# Capture exception, if raised
# This relates to the issue described at:
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4709
class String
def %(args)
if args.kind_of?(Hash)
dup.gsub(INTERPOLATION_PATTERN_WITH_ESCAPE) do |match|
if match == '%%'
'%'
else
twttr.BANNED_PASSWORDS = ["111111","11111111","112233","121212","123123","123456","1234567","12345678","131313","232323","654321","666666","696969","777777","7777777","8675309","987654","aaaaaa","abc123","abc123","abcdef","abgrtyu","access","access14","action","albert","alexis","amanda","amateur","andrea","andrew","angela","angels","animal","anthony","apollo","apples","arsenal","arthur","asdfgh","asdfgh","ashley","asshole","august","austin","badboy","bailey","banana","barney","baseball","batman","beaver","beavis","bigcock","bigdaddy","bigdick","bigdog","bigtits","birdie","bitches","biteme","blazer","blonde","blondes","blowjob","blowme","bond007","bonnie","booboo","booger","boomer","boston","brandon","brandy","braves","brazil","bronco","broncos","bulldog","buster","butter","butthead","calvin","camaro","cameron","canada","captain","carlos","carter","casper","charles","charlie","cheese","chelsea","chester","chicago","chicken","cocacola","coffee","college","compaq","computer","cookie","cooper","corvette","cowbo
# Force checking of /opt path for OS X macports binaries
if (File.exist?('/opt/local/bin/identify'))
Paperclip.options[:command_path] = '/opt/local/bin'
end
# Monkeypatch to get thumbnails working by allowing proper chaining
class Paperclip::Attachment
def callback(which)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent env=!dont-vary
</IfModule>
module ActionView
module Helpers
def write_asset_file_contents(joined_asset_path, asset_paths)
FileUtils.mkdir_p(File.dirname(joined_asset_path))
File.atomic_write(joined_asset_path, File.join(Rails.root, 'tmp')) { |cache| cache.write(join_asset_file_contents(asset_paths)) }
# Set mtime to the latest of the combined files to allow for
# consistent ETag without a shared filesystem.
mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max
#!/usr/bin/env ruby
PASSPHRASE_CHARS = [ ?0..?9, ?A..?Z, ?a..?z ].collect { |c| c.collect }.flatten.collect { |c| "%c" % c }
cert_name = ARGV[0]
unless (cert_name)
print "Usage: genrsa <certname>"
exit(-1)
end