Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
sorenmacbeth / gcloud-tramp.el
Created October 14, 2020 23:55 — forked from jackrusher/gcloud-tramp.el
Tramping into GCloud instances from within emacs
;; make sure you've set your default project with:
;; gcloud config set project <project-name>
(require 'tramp)
(add-to-list 'tramp-methods
'("gcssh"
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(ns example.nrepl
(:require [clojure.tools.nrepl.server :refer [start-server stop-server]]
[cider.nrepl :refer [cider-nrepl-handler]])
(:gen-class))
(defn -main [port]
(let [port (Integer. port)]
(defonce server (start-server :port port :handler cider-nrepl-handler))))

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten

Keybase proof

I hereby claim:

  • I am sorenmacbeth on github.
  • I am sorenmacbeth (https://keybase.io/sorenmacbeth) on keybase.
  • I have a public key whose fingerprint is 09DB D06A E0D1 1A0F 8E64 0E02 5819 BF09 B48F 7899

To claim this, I am signing this object:

#!/bin/sh
TMPCP=/tmp/badcp.txt
lein cp | tr ':' '\n' > $TMPCP
while read line; do
find "$line" -name "*.jar" -exec sh -c 'jar -tf {}| grep -H --label {} '$1'' \;
done < "$TMPCP"
@sorenmacbeth
sorenmacbeth / ambrose.clj
Last active August 29, 2015 13:55
cascalog ambrose integration
(defn ambrose?-
[& bindings]
(let [[name bindings] (flow/parse-exec-args bindings)
bindings (mapcat (partial apply normalize-sink-connection)
(partition 2 bindings))
flow (-> (apply compile-flow name bindings)
flow/flow-def
flow/compile-hadoop)
server (EmbeddedAmbroseCascadingNotifier.)]
(.addListener flow server)
(deftheme bubbleberry "bubbleberry")
;; Based on the theme used for LightTable (see: http://www.chris-granger.com/images/lightable/main.png )
(custom-theme-set-variables
'bubbleberry
'(linum-format " %7i ")
'(fringe-mode 5 nil (fringe))
'(powerline-color1 "#3d3d68")
'(powerline-color2 "#292945")
@sorenmacbeth
sorenmacbeth / gist:6049218
Created July 21, 2013 17:19
lmao if your elastic mapreduce jobs don't SIGSEGV the jvm
[thread 140515116697344 also had an error]#
[thread 140515116697344 also had an error][thread 140515116697344 also had an error][thread 140515116697344 also had an error]
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV[thread 140515130382080 also had an error][thread 140515130382080 also had an error][thread 140515130382080 also had an error]
(0xb)
(comment
(defrel edge a b)
(def graph [{:id :gen :in [] :out ["a" "b"]}
{:id :plus :in ["a"] :out ["plus"]}
{:id :times :in ["plus"] :out ["times"]}])
(fact edge '{:id :gen :in [] :out ["a" "b"]} '{:id :plus :in ["a"] :out ["plus"]})
(fact edge '{:id :plus :in ["a"] :out ["plus"]} '{:id :times in ["plus"] :out ["times"]})