Skip to content

Instantly share code, notes, and snippets.

@leifwickland
leifwickland / HFileInputFormat.scala
Created August 2, 2011 14:34
Allows an HFile to be used as the input to MapReduce.
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hbase.io.hfile.{HFile,HFileScanner}
import org.apache.hadoop.hbase.io.hfile.HFile.Reader
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import org.apache.hadoop.hbase.KeyValue
import org.apache.hadoop.mapreduce.{JobContext,InputSplit,TaskAttemptContext,RecordReader}
import org.apache.hadoop.mapreduce.lib.input.{FileInputFormat,FileSplit}
class HFileInputFormat extends FileInputFormat[ImmutableBytesWritable, KeyValue] {
override def isSplitable(context: JobContext, file: Path): Boolean = false
@thickey
thickey / pom2proj.clj
Created March 7, 2012 01:36
Convert Maven pom.xml file to Lein project.clj
(ns pom2proj
(:require [clojure.xml :as xml]
[clojure.zip :as zip]
[clojure.java.io :as io]
[clojure.data.zip.xml :as zx])
(:use [clojure.pprint :only [pprint]]))
(defn- text-attrs
[loc ks]
(map (fn [k]
@kaspergrubbe
kaspergrubbe / install-graphite-ubuntu-13.04.sh
Last active October 4, 2020 11:53 — forked from jgeurts/install-graphite-ubuntu-12.04.sh
Don't overwrite the local_settings.py
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 16. June 2013
####################################
# This is apparantly needed for python when running manage.py
# described here: http://stackoverflow.com/questions/11593556/django-createsuperuser-not-working
export LANG=en_US.UTF-8
@johnbintz
johnbintz / Gruntfile.coffee
Last active August 29, 2015 13:57
Run lein cljsbuild auto with Grunt
module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.initConfig {
app:
dev: "app"
watch:
sass:
files: ['<%= app.dev %>/**/*.scss']
tasks: ['compass:dist']
@sunng87
sunng87 / gist:372a0a45a07357569eb6
Last active March 23, 2024 00:57
defprotocol with var-args support
(defmacro defprotocol+ [name & funcs]
(let [vararg-sym (symbol "&")
normalized-func-specs (map #(let [[n a] %]
(if (.contains a vararg-sym)
[(symbol (str n "*"))
(vec (remove (fn [_a]
(= _a vararg-sym)) a))
[n a]]
[n a]))
funcs)
@danielkcz
danielkcz / firebase.functions.js
Last active January 11, 2019 12:40
Firebase authentication with Graphcool
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// This is hosted using Firebase Functions to gain easier access without meddling with service key
admin.initializeApp(functions.config().firebase)
exports.verifyToken = functions.https.onRequest((req, res) => {
const { idToken } = req.query
if (!idToken) {
@kurtharriger
kurtharriger / types.d.ts
Last active December 31, 2022 16:34
Inferred Workflowy API
type ProjectId = string; // eg: 2a13b3e1-7a74-3b2b-9758-1b398845a8e8
type UserId = number;
type ShareId = string;
type ClientId = string;
// login
// response sessionid returned in set-cookie
// curl -X POST https://workflowy.com/accounts/login/ -F 'username=<username>' -F'password=<password>' -H 'accept: application/json' -D -
export interface LoginFormData {
username: string;