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
Exception in thread 1: comparison of Fixnum with nil failed | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `>' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `upto' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `define_columns' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:127:in `exec' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:97:in `exec' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:82:in `new_from_query' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:132:in `cursor_from_query' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/connection.rb:102:in `select_first' | |
/home/username/.rvm/gems/ruby-2.1.2@gemset/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
puts caller.map{|l| | |
l.sub( | |
%r{/([^:/]+):(\d+):in `([^']*)'}, | |
"/\e[33m\\1\e[0m:\e[34m\\2\e[0m:in `\e[1;35m\\1\e[0m'" | |
) | |
} |
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 | |
for f in `grep -o '[^ ]\+:' config/locales/en.yml | sed -e 's/:$//' | sed -e 's/^/:/'`; do | |
printf "\033[1m$f\033[0m\n" | |
grep -R "\.t(.*$f" || printf "\033[1;33mNONE FOR $f\033[0m\n" | |
done |
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
# Code to perform a basic update/insert using MERGE. Tested with MSSQL | |
# and the TinyTDS adapter. Assumes DB contains a Sequel::Database. | |
require 'sequel' | |
module Merge | |
# Returns a Sequel::Dataset that will update or insert the given Array of | |
# Hashes of +data+ into the given named +table+, with the given primary | |
# +key+(s). Hash key names in +data+ must match the table's column names | |
# The dataset will return one row for each row that was inserted or updated, |
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
def gc_stat | |
GC.disable | |
asym = :total_allocated_objects | |
fsym = :total_freed_objects | |
before = GC.stat | |
ba = before[asym] | |
bf = before[fsym] | |
puts "Before: alloc=#{ba} free=#{bf}" |
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
# Faster than OpenStruct, but liable to get your box pwned. | |
class QuickAndDangerousStruct | |
def method_missing(name, *args) | |
make_method(name) | |
send name, *args | |
end | |
def make_method(name) | |
name = name.to_s | |
base = name.end_with?('=') ? name[0..-2] : name |
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 | |
# Simplified demo showing the use of the Sequel gem, raw OCI8 connection, and | |
# ruby_plsql gem on a single connection. Uses undocumented yield behavior from | |
# Sequel, so might not work with different Sequel versions. | |
# by Mike Bourgeous | |
# These must be set before requiring oci8 | |
ENV['NLS_LANG'] = 'american_america.utf8' | |
ENV['TNS_ADMIN'] = File.expand_path(File.dirname(__FILE__)) |
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 | |
# Launches an application with the Oracle instant client environment set. | |
# Created by Mike Bourgeous, DeseretBook.com | |
export CLIENT_PATH=/usr/lib/oracle/11.2/client64/lib | |
export PATH="$PATH:$CLIENT_PATH" | |
export LD_LIBRARY_PATH="$CLIENT_PATH" | |
export SQLPATH="$HOME/.oracle:$CLIENT_PATH" | |
export TNS_ADMIN="$HOME/.oracle" | |
export NLS_LANG="american_america.utf8" |
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
/* | |
* This implementation of popen3() was created in 2007 for an experimental | |
* mpg123 frontend and is based on a popen2() snippet found online. This | |
* implementation may behave in unexpected ways if stdin/stdout/stderr have | |
* been closed or modified. No warranty of its correctness, security, or | |
* usability is given. My modifications are released into the public domain, | |
* but if used in an open source application, attribution would be appreciated. | |
* | |
* Mike Bourgeous | |
* https://github.com/mike-bourgeous |
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/bash | |
# Creates a base64-encoded self-extracting tar archive. The extracting system | |
# must have GNU tar, GNU coreutils (for base64), and bzip2 installed. | |
# Created June 2011 by Mike Bourgeous | |
# Released into the public domain, or if that is not possible, under CC0 | |
function create_archive() | |
{ | |
set -e | |
echo '#!/bin/sh' |
OlderNewer