Skip to content

Instantly share code, notes, and snippets.

View mlb-'s full-sized avatar

Matthew Batema mlb-

  • Vyncacare
  • California bay area
View GitHub Profile
@mlb-
mlb- / bypass-quora-login.user.js
Created November 18, 2012 07:32 — forked from kaezarrex/massive-props.user.js
Bypass Quora's annoying login
// ==UserScript==
// @name Bypass Quora Login
// @namespace http://www.quora.com
// @include http://www.quora.com/*
// ==/UserScript==
var script = document.createElement('style');
script.innerHTML = '\
.modal_signup_background,.modal_signup_dialog,.modal_signup_top_section{\
display: none !important; \
@mlb-
mlb- / gist:3985269
Created October 31, 2012 06:08
thermocouple array test
#include "MAX6675.h"
int LED1 = 9; // Status LED Pin
int CS = 0; // CS pin on MAX6675
int SCK = 1; // SCK pin of MAX6675
int units = 1; // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F)
const int thermocouple_count = 4;
float temperature[thermocouple_count]; // Temperature output variable

Keybase proof

I hereby claim:

  • I am mlb- on github.
  • I am mlbatema (https://keybase.io/mlbatema) on keybase.
  • I have a public key whose fingerprint is 1188 2C08 1CDC 5C33 8E51 9D3F 1A93 0524 7F3F 9AB3

To claim this, I am signing this object:

@mlb-
mlb- / matching-substring-integer-counts.clj
Created September 11, 2017 17:51 — forked from featheredtoast/matching-substring-integer-counts.clj
Find the largest substring in which the number of integer elements is equal to number of non integer elements.
(defn find-subcoll-of-equal-int-nonint [coll]
(let [candidates (->> (range 2 (count coll) 2)
reverse
(map #(-> (partition % 1 coll)
(doto println)))
(reduce concat)
(filter (fn [candidate]
(let [{ints true
non-ints false} (group-by integer?
candidate)]
@mlb-
mlb- / *scratch*.clj
Last active October 21, 2016 01:09
Stupid recursive Clojure destructuring
(let [[[x1 y1] [x2 y2] :as [c1 c2 :as cs]] [[1 2] [3 4]]]
{:x1 x1
:y1 y1
:x2 x2
:y2 y2
:c1 c1
:c2 c2
:cs cs})
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(defn get-that-thing
"Bind the event handler for clicks and have it `put!` into a
channel."
[]
;; The implementation of this is left to the reader. Who will
;; probably skim swannodette's blog.
@mlb-
mlb- / gist:6127584
Created August 1, 2013 00:47
Python wrapper for spawning open_port from Erlang.
import sys
import os
import subprocess
def main(args):
cmd = args
if len(cmd) == 0:
return "Nope!"
@mlb-
mlb- / gist:6127583
Created August 1, 2013 00:46
Python wrapper for spawning open_port from Erlang.
import sys
import os
import subprocess
def main(args):
cmd = args
if len(cmd) == 0:
return "Nope!"
(def paper-feet
(comp #(apply + %)
(juxt (partial apply min)
(comp #(* 2 %)
(partial apply +)))
#(map (partial apply *) %)
#(partition 2 1 (take 1 %) %)
#(map (fn [x]
(Integer/parseInt x))
%)
(defn happy-numbers
[n]
(letfn [(next-happy [n]
(->> n
str
(map (comp int
#(Math/pow % 2)
read-string
str))
(reduce +)))]