Skip to content

Instantly share code, notes, and snippets.

View drewr's full-sized avatar
👋
hacking on datum.net

Drew Raines drewr

👋
hacking on datum.net
View GitHub Profile
@drewr
drewr / core.clj
Created July 9, 2022 21:18
Redeem NYT gift code
(ns freenyt.core
(:gen-class)
(:require [etaoin.api :as eta]
[etaoin.keys :as k]))
;;(def driver (eta/firefox-headless))
(defn -main [& args]
(let [driver (eta/safari)]
(eta/go
driver (str "https://www.nytimes.com/subscription"
% zig build && ./zig-out/bin/main https://github.com/drewr/zigutils
debug: drewr zigutils
warning: The following command failed:
error: OutOfMemory
/Users/aar/Downloads/zig-macos-aarch64-0.10.0-dev.139+850b053ea/lib/zig/std/os.zig:3997:19: 0x102bdb1cb in std.os.mmap (main)
.NOMEM => return error.OutOfMemory,
^
/Users/aar/Downloads/zig-macos-aarch64-0.10.0-dev.139+850b053ea/lib/zig/std/heap.zig:331:17: 0x102bd8def in std.heap.PageAllocator.alloc (main)
) catch return error.OutOfMemory;
@drewr
drewr / init.el
Created June 10, 2020 21:00
org-roam and helm debugging
(eval-after-load 'helm
'(require 'helm-config))
;; ....
(use-package helm
:ensure t
:pin "melpa"
:requires (async popup)
:config
@drewr
drewr / jurassic_park.clj
Last active December 10, 2018 13:31
java -cp clojure-1.9.0.jar clojure.main /tmp/jurassic_park.clj
(ns jurassic-park
"Post-movie fun with the boys"
(:require [clojure.main :as m]))
(defn jurassic-read
[request-prompt request-exit]
(or ({:line-start request-prompt :stream-end request-exit}
(m/skip-whitespace *in*))
(let [input (.readLine *in*)]
(cond

After you've created a GKE cluster, run:

kubectl apply -f <(curl -s https://gist.githubusercontent.com/drewr/4bdc3540ecb6c4ddf8058c59692ea7a8/raw/es-k8s.yaml)`

That will give you a single-node instance accessible via elasticsearch:9200 around your cluster.

Apr 02 14:19:54 hotel kernel: usb 3-5.1.4: USB disconnect, device number 21
Apr 02 14:19:55 hotel kernel: usb 3-5.1.4: new full-speed USB device number 22 using xhci_hcd
Apr 02 14:19:55 hotel kernel: usb 3-5.1.4: New USB device found, idVendor=16c0, idProduct=047c
Apr 02 14:19:55 hotel kernel: usb 3-5.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Apr 02 14:19:55 hotel kernel: usb 3-5.1.4: Product: Atreus2
Apr 02 14:19:55 hotel kernel: usb 3-5.1.4: Manufacturer: technomancy
Apr 02 14:19:55 hotel kernel: inp
@drewr
drewr / infra-engineer.org
Last active March 8, 2021 18:13
Software Engineer, Infrastructure

Software Engineer, Infrastructure

[recruiting preamble text here]

The Infrastructure team in Elastic Engineering sits underneath the Elastic product stack and support many efforts in the company at large. Primarily we’re software developers that handle state — CI specifications, cloud resources, integrations between teams. The Elastic Stack is built on our infrastructure and we touch everything needed to get it there. We also do software consulting around the organization to put our products to use for our own business.

@drewr
drewr / chat.md
Created January 17, 2018 20:30
Phil Freeman explaining the free monad

10:44] @loganmac Another way to think of the free monad over f is to say we want expressions of the form x >>= \a -> y >>= \b -> z ... where x, y, z :: f _

[10:45] So we just make a type by expanding f to include those terms, purely symbolically. But then to be a Monad we need the laws to hold, so we equate terms which the laws say have to be equal

[10:46] So finding the free monad over f is to find the "smallest" lawful monad which includes all such terms

@drewr
drewr / core.clj
Created January 14, 2018 05:46
Slack websocket experiment
(ns shia.core
(:require [cheshire.core :as json]
[clj-http.client :as http]
[clojure.spec.alpha :as s])
(:import (org.java_websocket.client WebSocketClient)
(java.net URI)))
(s/def :rtm/connect (s/keys :req-un [::ok ::self ::team ::url]))
(def ord (atom 0))
module PagerDuty (main) where
import Prelude
import Control.Monad.Aff (launchAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE, log, logShow)
import Data.Config (Config, string)
import Data.Config.Node (fromEnv)
import Data.Either (Either(..))