Skip to content

Instantly share code, notes, and snippets.

Adam ⚛ Stegman adamstegman

Block or report user

Report or block adamstegman

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
@adamstegman
adamstegman / gem-servers
Created Apr 21, 2015
gem server launch agent
View gem-servers
#!/usr/local/bin/bash -l
set -eo pipefail
declare -a GEM_SERVER_PIDS
function server_port {
ruby_version="${1}"
port_last_3="`echo "${ruby_version}" | sed 's/^ruby-\([0-9]\)\.\([0-9]\)\.\([0-9]\).*$/\1\2\3/'`"
echo "8${port_last_3}"
View install-hdfs.sh
# http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/SingleCluster.html
sudo su
apt-get -y update
apt-get -y install openjdk-6-jdk
wget http://mirrors.ibiblio.org/apache/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
tar xf hadoop-2.6.0.tar.gz -C /usr/local
@adamstegman
adamstegman / available_ebooks.rb
Last active Aug 6, 2016
eBooks from my Goodreads to-read list that are available to check out from OverDrive, sorted by average rating on Goodreads
View available_ebooks.rb
#!/usr/bin/env ruby
require 'json'
require 'logger'
require 'net/http'
require 'addressable/template'
require 'mechanize'
require 'nokogiri'
View app push request body from CF_TRACE
[{"fn":".gitattributes","sha1":"2ae3f36a1ff15605cb6db9b70d35f6595739eeda","size":13},{"fn":"CONTRIBUTING.md","sha1":"6a90de418a4c2555fbd54528a86e9221d49e8b5e","size":149},{"fn":"app","sha1":"0","size":4096},{"fn":"app/commands","sha1":"0","size":0},{"fn":"app/commands/.gitkeep","sha1":"da39a3ee5e6b4b0d3255bfef95601890afd80709","size":0},{"fn":"app/config","sha1":"0","size":4096},{"fn":"app/config/app.php","sha1":"7ac2822addf6a99aeb8e56c523881c0cb43a6389","size":7543},{"fn":"app/config/auth.php","sha1":"922ff60f01800bccda3710d12801088e2cc97ca6","size":2182},{"fn":"app/config/cache.php","sha1":"0fa647fde37e95f33274baeaeda3cd593332fdfc","size":2844},{"fn":"app/config/compile.php","sha1":"06302bbd25af958b94a09521dad19b2a6fbe1492","size":462},{"fn":"app/config/database.php","sha1":"31566c6431343c795cbed1fac8711cf052dacc28","size":3447},{"fn":"app/config/local","sha1":"0","size":0},{"fn":"app/config/local/app.php","sha1":"1f3d9474a5129dbe565ec76a392426216ae73030","size":465},{"fn":"app/config/mail.php","sha1":"76af
@adamstegman
adamstegman / project.clj
Created Mar 23, 2013
dieter dependencies are not pulled in so I pulled them in myself. `lein dieter-precompile` reports that the task does not exist, `lein with-profile dev dieter-precompile` reports the same.
View project.clj
(defproject melnitz "1.0.0-SNAPSHOT"
:description "Sorts the mail (from an Exchange server) and presents it in a dashboard so you can act on it instead of trying to figure out threads on your own."
:url "http://github.com/adamstegman/melnitz"
:dependencies [[com.edgecase/dieter "0.4.0"]
[commons-httpclient/commons-httpclient "3.1"]
[commons-logging/commons-logging-api "1.1"]
[microsoft.exchange/webservices "1.2"]
[org.clojure/clojure "1.4.0"]
[org.samba.jcifs/jcifs "1.3.3"]
[cheshire "5.0.2"]
@adamstegman
adamstegman / message.md
Last active Dec 14, 2015
JRuby NameError: missing class or uppercase package name (`microsoft.exchange.webservices.data.ExchangeService')
View message.md

I'm attempting to use the [Exchange Webservices API][ewsapi]. Unfortunately it has a weird package, but I thought that wouldn't be hard to overcome. So I wrote this script:

require 'java'
require 'vendor/lib/EWSJavaAPI_1.2.jar'

def microsoft
  Java::Microsoft
end

version = microsoft.exchange.webservices.data.ExchangeVersion::Exchange2010_SP1
@adamstegman
adamstegman / hanoi.rb
Created Nov 20, 2011
Hanoi solver for Facebook sample challenge
View hanoi.rb
#!/usr/bin/env ruby
# coding: UTF-8
# K pegs, 3 <= K <= 5
# N discs, radius 1 to N, 1 <= N <= 8
# given initial positions and final positions, output minimum moves to achieve it
# Input Format:
# N K
# 2nd line contains N integers.
@adamstegman
adamstegman / Gemfile
Created Aug 27, 2011
Search a website for permutations of "Fillion"
View Gemfile
source :rubygems
gem 'nokogiri', '~> 1.5.0'
View gist:1038119
$ brew doctor
Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libntfs-3g.54.0.0.dylib
/usr/local/lib/libntfs.9.0.0.dylib
@adamstegman
adamstegman / spec_helper.rb
Created Apr 19, 2011
Silence RSpec specs
View spec_helper.rb
RSpec.configure do |config|
config.before(:all, &:silence_output)
config.after(:all, &:enable_output)
end
# Redirects stderr and stdout to /dev/null.
def silence_output
@orig_stderr = $stderr
@orig_stdout = $stdout
You can’t perform that action at this time.