Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
sorenmacbeth / gcloud-tramp.el
Created Oct 14, 2020 — forked from jackrusher/gcloud-tramp.el
Tramping into GCloud instances from within emacs
View gcloud-tramp.el
;; 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")
View nrepl.clj
(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))))
@sorenmacbeth
sorenmacbeth / gist:1340665
Created Nov 4, 2011
The rest of our utility functions
View gist:1340665
(defn tokenizer-seq
"Build a lazy-seq out of a tokenizer with TermAttribute"
[^TokenStream tokenizer ^TermAttribute term-att]
(lazy-seq
(when (.incrementToken tokenizer)
(cons (.term term-att) (tokenizer-seq tokenizer term-att)))))
(defn load-analyzer [^java.util.Set stopwords]
(StandardAnalyzer. Version/LUCENE_CURRENT stopwords))
View bubbleberry-theme.el
(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 Jul 21, 2013
lmao if your elastic mapreduce jobs don't SIGSEGV the jvm
View gist:6049218
[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)
View graph.clj
(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"]})
View serfn.clj
(defn cascalog-map
[op-var output-fields & {:keys [stateful?]}]
(let [ser (ops/fn-spec op-var)]
(proxy [BaseOperation Function] [^Fields output-fields]
(prepare [^FlowProcess flow-process ^OperationCall op-call]
(let [op (serfn/deserialize-val ser)]
(-> op-call
(.setContext [op (if stateful? (op))]))))
(operate [^FlowProcess flow-process ^FunctionCall fn-call]
(let [[op] (.getContext fn-call)
View carbonite-records.clj
(defn write-record
"Write an associative data structure to Kryo's buffer. Write record
name as a string, count as an int, then serialize the key/value pairs."
[^Kryo registry ^Output output r]
(.writeString output (.getName (class r)) true)
(.writeInt output (count r) true)
(doseq [[k v] r]
(.writeClassAndObject registry output k)
(.writeClassAndObject registry output v)))
View gist:5110034

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@sorenmacbeth
sorenmacbeth / ham-mode.el
Created Oct 26, 2012
When you need to go HAM
View ham-mode.el
(defconst ham-mode-keymap (make-sparse-keymap) "Keymap used in ham mode")
(define-key ham-mode-keymap (kbd "C-c C-0") 'go-ham)
(defgroup ham-mode nil
"HAM minor mode.")
(defun go-ham ()
(interactive)
(message "HARD AS A MOTHERFUCKER"))