Skip to content

Instantly share code, notes, and snippets.

View ersatzryan's full-sized avatar

Ryan G ersatzryan

View GitHub Profile
@ersatzryan
ersatzryan / csvsplit
Created October 16, 2019 16:19
CSV Splitter
#!/bin/bash
NUMLINES=4000
while [[ $# -gt 0 ]]; do
case "$1" in
-l|--lines) NUMLINES="$2"; shift; shift;;
-h|--help ) echo -e "Usage: csvsplit [-l line_count] file\n -l, --lines: Number of lines to split\n -h, --help: Show this message"; exit 1;;
-* ) echo "Unknown option: $1"; exit 1;;
-- ) shift; break;;
* ) FILE="$1"; shift;;

Keybase proof

I hereby claim:

  • I am ersatzryan on github.
  • I am ersatzryan (https://keybase.io/ersatzryan) on keybase.
  • I have a public key ASCC0VUT5inXXvZfch9tP_Gf0gnggy6M5lQkY_roK17lxQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ersatzryan on github.
  • I am ersatzryan (https://keybase.io/ersatzryan) on keybase.
  • I have a public key whose fingerprint is DA0E F2E6 EFB3 1302 8F89 5C16 81F5 F2BA 8C33 BFB8

To claim this, I am signing this object:

{
"meta": {
"event": "incident.alerted"
}
"snitch": {
"id":1,
"name":"Something",
"interval":"hourly",
"state":"failed",
"checked_in_at":"2013-08-25T00:54:20Z",
We couldn’t find that file to show.
@ersatzryan
ersatzryan / gist:980917
Created May 19, 2011 14:48
Array slice weirdness
a = (1..10).map.reverse #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
Array(a).unshift(11).slice(0, 10) #=> [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]
a = Array(a).unshift(11).slice(0, 10) #=> [11, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]
---
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- http://gems.github.com
- http://rubygems.org/
:update_sources: true
:verbose: true
gem: --no-ri --no-rdoc
# * ActiveRecord::SessionStore - Sessions are stored in your database, which works better than PStore with multiple app servers and,
# unlike CookieStore, hides your session contents from the user. To use ActiveRecord::SessionStore, set
#
# MyApplication::Application.config.session_store :active_record_store
#
# in your <tt>config/initializers/session_store.rb</tt> and run <tt>script/rails g session_migration</tt>.
#
require 'rubygems'
require 'thor/rake_compat'
require 'rspec/core/rake_task'
class Test < Thor
include Thor::RakeCompat
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ["--no-color"]
t.pattern = 'spec/**/*_spec.rb'
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "!"
}