Skip to content

Instantly share code, notes, and snippets.

View turboladen's full-sized avatar
🌮

Steve Loveless turboladen

🌮
View GitHub Profile
@turboladen
turboladen / old_mapserver.rb
Last active September 7, 2016 21:42
Homebrew formula for install mapserver 6.2.2
class OldMapserver < Formula
desc "Publish spatial data and interactive mapping apps to the web"
homepage "http://mapserver.org/"
url "http://download.osgeo.org/mapserver/mapserver-6.2.2.tar.gz"
sha256 "79b81286dde030704f59a668a19e5b01af27bb35d05b3daf91cefe06ca29ffd9"
bottle do
cellar :any
sha256 "8bfa96a50ee83117bd929afc4ed1c6ce3e9e82a7e6da6328e4ca500c4fbb096d" => :yosemite
sha256 "7ed6da72cbb724c1dfe92cc701bf292ddac02788dc7976f7a81e5e367b472262" => :mavericks
alias rdbm='bin/rake db:migrate db:test:clone'
alias rdbmt='bin/rake db:migrate RAILS_ENV=test'
alias rdbr='bin/rake db:rollback'
alias spec_all='bin/spring rspec spec'
spec_model() { bin/spring rspec spec/models/"$1"_spec.rb }
spec_controller() { bin/spring rspec spec/controllers/"$1"_controller_spec.rb }
spec_views() { bin/spring rspec spec/views/"$1"/*_spec.rb }
alias devlog='tail -f log/development.log'
@turboladen
turboladen / psql_encoding.sql
Created October 2, 2013 08:46
Script for dealing with creating Postgres databases that complain with: ``` PG::InvalidParameterValue: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. ``` ...when trying to create the production DB. Taken from: http://stackoverflow.com/questions/13115692/encoding-utf8-does-not-match-…
sudo su postgres
psql
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
@turboladen
turboladen / porty.rb
Created August 1, 2013 17:36
Ruby port scanner
# Thanks to http://rubysource.com/build-a-port-scanner-in-ruby
require 'celluloid'
require 'socket'
class ScanPort
include Celluloid
def initialize(start_port, end_port, host)
@start_port = start_port
@turboladen
turboladen / porty.rb
Created August 1, 2013 17:36
Ruby port scanner
# Thanks to http://rubysource.com/build-a-port-scanner-in-ruby
require 'celluloid'
require 'socket'
class ScanPort
include Celluloid
def initialize(start_port, end_port, host)
@start_port = start_port
@turboladen
turboladen / gist:6091093
Created July 26, 2013 18:24
PhonyRails normalizes phone numbers in such a way that they fail their own validations...
# PhonyRails + Faker
1000.times do
num = PhonyRails.normalize_number(Faker::PhoneNumber.short_phone_number, country_code: 'US')
sizes << num.size
end
sizes.count { |s| s == 9 } # => 22
sizes.count { |s| s == 10 } # => 180
sizes.count { |s| s == 11 } # => 797
@turboladen
turboladen / libav.rb
Last active December 17, 2015 08:28 — forked from jamiehodge/libav.rb
require 'formula'
class Libav < Formula
homepage 'http://libav.org/'
url 'http://libav.org/releases/libav-9.6.tar.xz'
sha1 '7c66e9776e83b13910eae960d63b7b86ad229dfe'
head 'git://git.libav.org/libav.git'
option "without-x264", "Disable H264 encoder"
@turboladen
turboladen / gist:5416689
Last active March 2, 2018 14:21
Jenkins Swarm plugin init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: hudsonvmfarm
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: hudsonswarm build slave
@turboladen
turboladen / test_helper.rb
Created March 22, 2013 19:59
Use rspec-mocks with test-unit
require 'test-unit'
require 'rspec/mocks'
class Test::Unit::TestCase
def setup
RSpec::Mocks::setup(self)
end
def teardown
@turboladen
turboladen / gist:5223483
Created March 22, 2013 18:11
winrm running against my Vagrant-installed Win2k8
require 'winrm'
require 'kconv'
endpoint = 'http://192.168.33.10:5985/wsman'
winrm = WinRM::WinRMWebService.new(endpoint, :plaintext, :user => 'Vagrant', :pass => 'vagrant')
shell = winrm.open_shell
output = winrm.run_command shell, 'dir'
result = winrm.get_command_output(shell, output)
=begin