Skip to content

Instantly share code, notes, and snippets.

View dimfeld's full-sized avatar

Daniel Imfeld dimfeld

View GitHub Profile
@dimfeld
dimfeld / crashplan_headless
Last active August 29, 2015 13:57
Easily configure and unconfigure the Crashplan client to connect to a headless server, from a Mac client. This could be made much more general but suffices for my needs.
#!/bin/sh
echo servicePort=4200 >> ~/Library/Application\ Support/CrashPlan/ui.properties
echo Open your Crashplan client after the SSH session connects.
# Change $SERVER to the hostname or IP of your server. Or just pause here.
ssh -L 4200:localhost:4243 $SERVER
echo Reverting settings file...
sed -e /servicePort/d -i bak ~/Library/Application\ Support/CrashPlan/ui.properties
@dimfeld
dimfeld / setgopath.sh
Last active August 29, 2015 14:01
Bash function to easily set the GOPATH from any subdirectory thereof.
# Embed this function inside your .bashrc or equivalent.
function setgopath() {
# Assume we're in the src directory, and strip off src and everything after it.
DIR=${PWD/src*/}
if [ -d "$DIR/src" -a -d "$DIR/bin" -a -d "$DIR/pkg" ]; then
export GOPATH=$DIR
fi
}
#!/usr/bin/env node
"use strict";
var es = require('event-stream');
var Promise = require("bluebird");
var pg = Promise.promisifyAll(require("pg.js"));
var pt = require("stream").PassThrough;
var copyStream = require("pg-copy-streams").from;
var _ = require("lodash");
set -g base-index 1
set -s escape-time 0
# Window Switching
bind-key -n C-NPage next
bind-key -n C-PPage prev
bind-key -n C-M-NPage swap-window -t +1
bind-key -n C-M-PPage swap-window -t -1
bind-key n next
@dimfeld
dimfeld / lip.py
Last active August 29, 2015 14:24
Linode IP Lookup
#!/usr/bin/python
import sys
import os
import os.path
import argparse
import json
import linode.api
key = None

Keybase proof

I hereby claim:

  • I am dimfeld on github.
  • I am dimfeld (https://keybase.io/dimfeld) on keybase.
  • I have a public key whose fingerprint is 2814 2D19 F06B 2C7D 752B F055 4CC5 2454 DC43 1235

To claim this, I am signing this object:

@dimfeld
dimfeld / DirectOutputCommitter.scala
Created September 24, 2015 20:37 — forked from aarondav/DirectOutputCommitter.scala
DirectOutputCommitter.scala
/*
* Copyright 2015 Databricks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
// DO NOT EDIT!
// Code generated by ffjson <https://github.com/pquerna/ffjson>
// DO NOT EDIT!
package main
import (
importedinceptionpackage "bitbucket.org/freshmedicalleads/datafuse/writer"
"bitbucket.org/freshmedicalleads/datafuse/vendor/github.com/pquerna/ffjson/inception"
// "github.com/pquerna/ffjson/inception"
@dimfeld
dimfeld / jsonize.js
Created March 23, 2016 15:15
Convert JS-style objects into proper JSON
#!/usr/bin/env node
"use strict";
var fs = require("fs");
var vm = require("vm");
var sandbox = { value: null };
var context = vm.createContext(sandbox);
function convert(contents) {
vm.runInContext('value = ' + contents, context);
@dimfeld
dimfeld / capnp-build.rs
Last active January 10, 2018 02:33
A build.rs script that filters out directives for building capnp files with non-Rust targets.
/*
Go's Cap'n Proto code generator needs some extra directives, but I don't want to require that
my Rust build environment has the relevant Go include files available. The script below filters
out the Go directives before sending the resulting files to the compiler to make this work.
*/
extern crate capnpc;
use std::env;
use std::path::PathBuf;