Skip to content

Instantly share code, notes, and snippets.

Steve Loveless turboladen

Block or report user

Report or block turboladen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@turboladen
turboladen / old_mapserver.rb
Last active Sep 7, 2016
Homebrew formula for install mapserver 6.2.2
View old_mapserver.rb
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
View myrails.plugin.zsh
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 Oct 2, 2013
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-…
View psql_encoding.sql
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 Aug 1, 2013
Ruby port scanner
View porty.rb
# 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 Aug 1, 2013
Ruby port scanner
View porty.rb
# 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 Jul 26, 2013
PhonyRails normalizes phone numbers in such a way that they fail their own validations...
View gist:6091093
# 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
View 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 Mar 2, 2018
Jenkins Swarm plugin init script
View gist:5416689
#!/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 Mar 22, 2013
Use rspec-mocks with test-unit
View test_helper.rb
require 'test-unit'
require 'rspec/mocks'
class Test::Unit::TestCase
def setup
RSpec::Mocks::setup(self)
end
def teardown
@turboladen
turboladen / gist:5223483
Created Mar 22, 2013
winrm running against my Vagrant-installed Win2k8
View gist:5223483
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
You can’t perform that action at this time.