Skip to content

Instantly share code, notes, and snippets.

Ben Hundley FestivalBobcats

  • Fayetteville, AR
Block or report user

Report or block FestivalBobcats

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
FestivalBobcats / quinky.rb
Created Jul 1, 2014
Quinky (GroupMe haiku bot)
View quinky.rb
require 'json'
require 'typhoeus'
require 'ansi'
def register_bot(name, avatar_url=nil)
url = "{ACCESS_TOKEN}"
body = {
FestivalBobcats / .bash_profile
Created Mar 14, 2014
Git branch and changes indicator for bash
View .bash_profile
__quiet() {
$1 2> /dev/null
parse_git_branch() {
__quiet 'git branch' | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
count_git_changes() {
count=$(__quiet 'git status -s' | wc -l)
FestivalBobcats / gist:7913652
Last active Dec 31, 2015
Migrating Elasticsearch index from one cluster to another.
View gist:7913652
require 'json'
require 'tempfile'
OLD_CLUSTER_ENDPOINT = '' # root endpoint
NEW_CLUSTER_ENDPOINT = '' # root endpoint
PER_PAGE = 3_000
def get_json(url)
JSON.parse(`curl -s '#{url}'`)
FestivalBobcats /
Last active Dec 30, 2015
Connecting to Elasticsearch cluster with the Java TransportClient.
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.index.query.QueryBuilders;
FestivalBobcats / gist:6689477
Created Sep 24, 2013
importing stuff into qbox with tire
View gist:6689477
Tire.configure do
Tire.index(INDEX_NAME) do
json_filepaths.each do |filepath|
FestivalBobcats / gist:5623373
Created May 21, 2013
setting up auto-complete in ElasticSearch with test documents
View gist:5623373
require 'tire'
Tire.configure do
url ""
mappings: {
product: {
properties: {
FestivalBobcats / gist:2898588
Created Jun 8, 2012
Produce one big image from a folder of images
View gist:2898588
# requires ImageMagick. very simple to install
# quick and simple image montaging
collage() {
# convert all images to png
# squash them into one grid-based .png
# cleanup
convert ./* MON%02d.png && montage ./MON*.png -geometry +0+0 __montage.png && rm ./MON*
FestivalBobcats / gist:1387748
Created Nov 23, 2011
beginning of a DSL for me to abuse embedding and linking in MongoDB
View gist:1387748
# Facets are little bits of info about visitors
# Each facet has it's own Mongo collection; however,
# Essential attributes of the facet are imbedded in an Impression.
# This greatly improves performance by avoiding extraneous lookups,
# but also links Facets to their respectful impressions, much like
# facet :has_many => :impressions
# The containing module serves to provide "facet definitions" --
FestivalBobcats / gist:1378576
Created Nov 19, 2011
1,679,616 unique 4-character ID possibilities. Each generated in < 2ms
View gist:1378576
module Arbiter
class Identity
@@data = Arbiter.db.collection('data')
@@coll = Arbiter.db.collection('page_ids')
def initialize
@length = identity_matrix['length']
@last = identity_matrix['last']
@idx = identity_matrix['idx']
View gist:1345428
require 'acceptance/admin/admin_spec'
feature 'Channel management', :js => true, :admin => true do
let!(:channel) { Fabricate(:channel) }
# TODO: make helper for doing something like
# on_page admin_channels_path do
# scenario...
You can’t perform that action at this time.