Skip to content

Instantly share code, notes, and snippets.

@ryangreenberg
ryangreenberg / tableize.rb
Created March 30, 2017 16:31
tableize: Turns tab-separated lines into Atlassian or Markdown formatted tables, with header.
#!/usr/bin/env ruby
# Turns tab-separated lines into Atlassian or Markdown formatted tables, with header.
#
# USAGE: copy some query results from SequelPro or some data out of a Google spredsheet, including header, then:
# > pbpaste | tableize | pbcopy
# paste in Jira.
#
#
# Atlassian Syntax:

Keybase proof

I hereby claim:

  • I am ryangreenberg on github.
  • I am greenberg (https://keybase.io/greenberg) on keybase.
  • I have a public key ASD6FvBRMmusPQi7-AlIy2dD3BBeGlOgsVl_P2Bu3f6yiAo

To claim this, I am signing this object:

val s: Seq[Int] = Seq(1,2,3)
val a: Seq[Int] = Array(1,2,3)
def pp(xs: Seq[Int]) = xs match {
case 1 :: 2 :: 3 :: Nil => "we got a match, baby"
case _ => "who knows"
}
pp(s) // "we got a match, baby"
pp(a) // "who knows"
@ryangreenberg
ryangreenberg / 01_JAVA_CHALLENGE_README.md
Last active March 1, 2016 21:16
The `java` Challenge

The java challenge

  1. Download the following two files: Main.java and Helper.java (this is the easy part).
  2. Compile these files on the command line.
  3. Run Main to produce the output "Hello, World!"

Scoring

  • You are able to run Main: 1 point
  • You are not able to run Main: 0 points
@ryangreenberg
ryangreenberg / tellme.sh
Last active December 22, 2015 19:58
tellme: A simple wrapper to execute commands and provide notification of the results
#!/bin/bash
# Executes the provided command and provides notification when execution has
# completed
#
# Usage: tellme <cmd>
#
# Examples:
#
# tellme ./pants compile science::
#!/bin/bash
# Versions
scalac -version
sbt --version
java -version
# Create project
mkdir -p twitter-server_repro && cd twitter-server_repro
@ryangreenberg
ryangreenberg / shipit.js
Created June 25, 2014 21:13
Reviewboard Bookmarklet
javascript:(function(){if(window.location.href.indexOf("reviewboard")!=-1){var pendingReview=gReviewRequest.createReview();pendingReview.ship_it=true;pendingReview.body_top="";pendingReview.publish({success:function(){window.location.reload();}});}else{alert("You are trying to ship something outside ReviewBoard. That's crazy.");}})();
@ryangreenberg
ryangreenberg / wrapped_exceptions.rb
Created March 20, 2014 22:51
thrift_client wrapped exceptions
#!/usr/bin/env ruby -KU
require 'rubygems'
require 'thrift'
ex = Thrift::TransportException.new(Thrift::TransportException::NOT_OPEN, "it was not open")
wrapped_ex = begin
raise Thrift::TransportException, ex.message, ex.backtrace
rescue StandardError => e
@ryangreenberg
ryangreenberg / ci_notify
Last active January 4, 2016 21:19
Checks with Jenkins until a building job has passed or failed. This script is not well written.
#!/usr/bin/env ruby -KU
require 'open-uri'
require 'rubygems'
require 'json'
CHECK_INTERVAL = 5 # seconds
NOTIFICATION_CENTER = "/Applications/Utilities/terminal-notifier.app/Contents/MacOS/terminal-notifier"
PASS = "SUCCESS"
FAIL = "FAILURE"
@ryangreenberg
ryangreenberg / jank_repl
Last active January 3, 2016 04:49
Jank REPL
#!/bin/bash
INPUT_FILE=input
OUTPUT_FILE=output
LAST_RUN=$(date "+%s")
LAST_MODIFIED=$LAST_RUN
touch $INPUT_FILE
touch $OUTPUT_FILE