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))))
@sorenmacbeth
sorenmacbeth / gist:1340665
Created November 4, 2011 22:32
The rest of our utility functions
(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))
(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"]})
(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)
(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)))

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 October 26, 2012 19:38
When you need to go HAM
(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"))