Skip to content

Instantly share code, notes, and snippets.

Matthew Molloy whamtet

Block or report user

Report or block whamtet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Docker GUI on OSX.sh
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
#start XQuartz with appropriate config, then
#launch docker with -e DISPLAY=IP_ADDRESS:0
View MapDF.scala
import clojure.lang.IFn
import org.apache.spark.sql.Row
import clojure.java.api.Clojure
import org.apache.spark.sql.types.StructType
def map_clojure(df: DataFrame, source: String, schema: StructType) = {
var clojure_compiled: IFn = null
val rdd = df.map({row =>
if (clojure_compiled == null) {
clojure_compiled = Clojure.`var`("clojure.core", "load-string").invoke(source).asInstanceOf[IFn]
View persistent.clj
(defonce persisted-frames (atom {}))
(defn persist [k v]
(swap! persisted-frames assoc k v)
v)
(defn split-until [f s]
(let [[a b] (split-with #(not (f %)) s)]
[(concat a (take 1 b)) (rest b)]))
View check-spreadsheet.clj
(require '[excel-repl.interop :as interop])
(require '[clojure.string :as str])
(defn parse [s]
(if (string? s) (-> s (str/replace " " "") Double/Parse)))
(def our-data (map first (interop/get-values "Sheet2" "S1:S1000")))
(def our-members (filter number? our-data))
View clipboard-clr.clj
(import System.Windows.Forms.Clipboard)
(Clipboard/SetText "hi")
View clipboard.clj
(import java.awt.datatransfer.StringSelection)
(import java.awt.Toolkit)
(import java.awt.datatransfer.DataFlavor)
(defn to-clipboard [s]
(let [
selection (StringSelection. s)
clipboard (.getSystemClipboard (Toolkit/getDefaultToolkit))]
(.setContents clipboard selection selection)))
View clojure-gems.clj
(ns gems)
(def unique-by
"inverts the range of f"
[f s]
(vals (zipmap (map f s) s)))
(defn decompose-map
"nested map structure -> list of 'address vectors'"
([m] (decompose-map [] m))
You can’t perform that action at this time.