Skip to content

Instantly share code, notes, and snippets.

View ralph-tice's full-sized avatar

Ralph Tice ralph-tice

  • Kentik
  • Texas
View GitHub Profile
@dhoss
dhoss / gist:5484465
Created April 29, 2013 20:19
error: play test [info] Loading project definition from /Users/daustin/web-dev/lumos-pottery/project [info] Set current project to lumos (in build file:/Users/daustin/web-dev/lumos-pottery/) [info] Compiling 10 Scala sources and 1 Java source to /Users/daustin/web-dev/lumos-pottery/target/scala-2.10/classes... [error] /Users/daustin/web-dev/lumo…
/** GenerateThumbnail
* generate a thumbnail of an image
*
* ==Overview==
* {{{
* val thumbnail = new Thumbnailer(.25, "image.jpg", "image-thumbnail.jpg")
* val resized = thumbnail.resize()
* thumbnail.save()
* }}}
*/
@danveloper
danveloper / MemoizedLambdaFib.java
Last active December 16, 2015 08:19
Memoized Fibonacci calculation using lambdas in Java 8
public class MemoizedLambdaFib {
interface MemoizedFunction<T, R> {
enum Cache {
_;
Map<Object, Object> vals = new HashMap<>();
}
R calc(T t);
@simonvc
simonvc / stats-to-hosted-graphite.py
Last active December 16, 2015 03:39
This little recipe will pump your riak stats into hosted graphite. For more information see hostedgraphite.com @simonvc
import json
from urllib2 import urlopen
import socket
from time import sleep
UDP_ADDRESS = "carbon.hostedgraphite.com"
UDP_PORT = 2003
RIAK_STATS_URL='http://localhost:11098/stats'
HG_API_KEY='Your Api Key from HostedGraphite.com'
@nanliu
nanliu / homebrew::tap.pp
Last active December 14, 2015 16:08
Homebrew::Tap for boxen PoC
define homebrew::tap (
$ensure = present,
) {
if $ensure == 'present' {
exec { "homebrew_tap_${name}":
command => "brew tap ${name}",
unless => "brew tap | grep ${name}",
}
} else {
exec { "homebrew_untap_${name}":
@philwinkle
philwinkle / compare-core-mods.sh
Last active December 12, 2015 05:49
MD5 Comparison snapshot of current Magento release files. Works and tested on OSX, CentOS; though OSX requires md5 instead of md5sum
#!/bin/bash
find app/code/core/Mage app/code/core/Enterprise app/code/core/Zend lib/Varien lib/Mage lib/Zend -type f | grep -v '\.svn' | sort -d -f -k1 | xargs md5sum | awk {'print $2, $1'} > 1.11.2.0.local.md5
diff 1.11.2.0.base.md5 1.11.2.0.local.md5
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@Irio
Irio / fake_parser.rb
Created July 8, 2012 01:23
Skip parse on HTTParty
class FakeParser
def self.call(body, format)
body
end
end
@digitaljhelms
digitaljhelms / gist:3014302
Created June 28, 2012 22:08
Sublime Text 2 bash alias & CLI function to open projects without using the `.sublime-project` file extension
# bash alias
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
# bash function, usage: $ st -p [projectname] -opt2 -opt3
function st() {
if [ -n "$1" -a -n "$2" ]; then # if more than one argument
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project
local projectfile="$2"
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext
if [ -e $projectfile ]; then # does project file exist?
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@mardambey
mardambey / KafkaEmbedded.scala
Created May 10, 2012 02:58
Embedded Kafka broker / producer / simple consumer in a single process useful for testing or for persistent queues.
import java.util.Properties
import kafka.server.KafkaServer
import kafka.server.KafkaConfig
import kafka.producer.ProducerConfig
import kafka.producer.Producer
import kafka.message.Message
import kafka.producer.ProducerData
import kafka.consumer.ConsumerConfig
import kafka.consumer.Consumer
import kafka.utils.Utils