Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Ball sdball

View GitHub Profile
@sdball
sdball / ezproxy_redirect.php
Created Mar 1, 2013
Some old PHP code I wrote to have PHP force EZProxy into being more secure.
View ezproxy_redirect.php
<?php
/**
* ezproxy_redirect
*
* EZProxy requires that the username and password be passed via GET.
* This is just about as insecure as possible.
*
* So, we trick ezproxy into security by opening a socket connection
* to the server; acting as a browser to initiate the connection; then
* writing out its response to the actual browser.
@sdball
sdball / index.php
Created Mar 1, 2013
Snippets from an old PHP IP Database I wrote. My hand rolled framework code was kind of nice.
View index.php
<?php
// page setup
require('/www/includes/ipdatabase/ipdb_page.php');
$javascript = '<script type="text/javascript" src="/ipdatabase/js/index.js"></script>';
$page = new IPDB_Page();
$page->title('Main');
$page->javascript($javascript);
@sdball
sdball / javascript_learning_sources.md
Last active Dec 13, 2015
Want to learn JavaScript?
View javascript_learning_sources.md
@sdball
sdball / hardcoded_swap.rb
Created Jan 25, 2013
Ruby fun: a one time method override.
View hardcoded_swap.rb
require 'minitest/spec'
require 'minitest/autorun'
class String
def one_time_override(method, &override)
self.instance_eval do
def to_s
self.instance_eval do
def to_s
'foo'
@sdball
sdball / deploy.rb
Created Jan 23, 2013
Example capistrano task to confirm deployment
View deploy.rb
# drop this task in the environment(s) you want to confirm deployment for
before :deploy, "deploy:confirm"
namespace :deploy do
desc "Should we really deploy?"
task :confirm do
if Capistrano::CLI.ui.ask("Are you sure?") == "yes"
puts "You got it buddy. Imma deploy now."
else
@sdball
sdball / fiat_nil.rb
Last active Dec 10, 2015
Don't Do What Johnny Don't Does
View fiat_nil.rb
class FiatNil
def method_missing(*args)
nil
end
end
@sdball
sdball / Gemfile
Last active Dec 10, 2015
Just a quick prototype to talk to data.com's sandbox.
View Gemfile
# Ruby 1.8.7
source "https://rubygems.org"
gem "json_pure"
group :test do
gem "rspec"
gem "vcr"
gem "webmock"
@sdball
sdball / autobots.bash
Created Sep 18, 2012
beanstalkd rollout!
View autobots.bash
$ ruby rollout.rb
$ stalk jobs.rb
@sdball
sdball / expand-url.sh
Created Aug 8, 2012
Expand URLs by following a single redirect
View expand-url.sh
#!/bin/bash
main() {
if [ -z $1 ]; then
echo "Usage: expand-url URL"
exit 1
fi
url=$1
response $url | parse_redirect
}