Skip to content

Instantly share code, notes, and snippets.

@bnyeggen
bnyeggen / clojure_hive_thrift.clj
Created December 13, 2011 15:28
Clojure to Hive via Thrift
(comment You will want just about everything in your hive/lib dir included in your Classpath)
(ns myproj.core
(:import [org.apache.hadoop.hive.service HiveClient]
[org.apache.thrift.transport TSocket]
[org.apache.thrift.protocol TBinaryProtocol]))
(defn send-hive
"Creates a new socket and Hive client connection, runs the query, pulls the result, and closes the connection.
Eventually modify to split and parse according to schema of result.
@daveray
daveray / seesaw-repl-tutorial.clj
Created December 7, 2011 04:55
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
;; This is a clojure.test test case which enters a value in a form
;; field in the browser, clicks the submit button and checks that the
;; correct information is displayed in the page and that the client
;; and server state is as it should be. 'database' is an atom in the
;; server and 'state' is an atom in the browser.
(deftest test-enter-name
(reset! database #{})
;; evaluate two forms in the browser in the start.view namespace
(cljs-eval start.view
(dom/set-value :name-input "Ted")
@canton7
canton7 / 0main.md
Last active January 17, 2025 06:09
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

@seratch
seratch / build.sbt
Created December 1, 2011 06:07
Scala School - Testing with specs2 examples
organization := "net.seratch"
name := "sandbox"
version := "0.1"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
"junit" % "junit" % "4.9" withSources(),
@daveray
daveray / giant-steps.clj
Created November 24, 2011 04:52
First chorus of Giant Steps solo by Overtone
; Final pre-processed "transcriptions" of several Coltrane "Giant Steps" solos
; are here: https://github.com/daveray/yardbird
; Please take the data and do something fun with it!
; TODO
; Incorporate changes
; Convert to concert pitch
; Convert to correct octave
(use 'overtone.live)
@hugoduncan
hugoduncan / gist:1389222
Created November 23, 2011 17:02
Beginnings of a nexus crate
(ns pallet.crate.nexus
"Install and configure Nexus maven repository manager.
See:
http://www.sonatype.com/books/nexus-book/reference/install.html"
(:require
[pallet.action.directory :as directory]
[pallet.action.environment :as environment]
[pallet.action.exec-script :as exec-script]
[pallet.action.file :as file]
@cpatni
cpatni / app.rb
Created November 21, 2011 22:39
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
:environment
{:algorithms
{:lift-fn pallet.core/parallel-lift
:vmfest
{:create-nodes-fn pallet.compute.vmfest/parallel-create-nodes}
:converge-fn pallet.core/parallel-adjust-node-counts}
:phases {:bootstrap
(phase
(package-manager
:configure :proxy local-proxy))}
@xlson
xlson / listnodes.groovy
Created November 9, 2011 12:57
Listing node metadata on ec2 with jclouds
@GrabResolver(name='jclouds snapshot', root='https://oss.sonatype.org/content/repositories/snapshots')
@Grab('org.jclouds:jclouds-allcompute:1.3.0-SNAPSHOT')
import org.jclouds.compute.ComputeServiceContextFactory
def accesskeyid = '...'
def secretkey = '...'
def context = new ComputeServiceContextFactory().createContext("aws-ec2", accesskeyid, secretkey)
def nodes = context.getComputeService().listNodes()