Skip to content

Instantly share code, notes, and snippets.

bsx=77;
bsy=32;
// distance of screwhole to edge of pcb
screwdist=3.5;
screwr=1.75;
clearance=2;
wall=2;
// 2,5 * 6 * 2
module case(wall_thickness) {
// dimensions of the space inside
width = 30;
height = 60;
depth = 30;
difference() {
// shell
translate([-1 * wall_thickness, -1 * wall_thickness, -1 * wall_thickness])
#include <Wire.h>
#include "Adafruit_TMP007.h"
#include "esp_system.h"
#include "nvs_flash.h"
#include "nvs.h"
Adafruit_TMP007 tmp007;
nvs_handle nvs;
esp_err_t err;
@mschuetz
mschuetz / gist:fb98c6e1d926ed4a589d
Created September 3, 2014 07:34
clojure call performance
(ns funcall_perf)
(defn len1a [^String foo] (.length foo))
(defn len1b [foo] (.length foo))
(defn len2a [^String foo] (count foo))
(defn len2b [foo] (count foo))
; warm up
(doseq [func [len1a len1b len2a len2b]]
(dotimes [n 1000000]
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.function.Consumer;
import com.google.common.collect.ImmutableList;
public class Foo {
static interface IOExceptionConsumer<T> {
@mschuetz
mschuetz / gist:7747363
Created December 2, 2013 10:00
check slf4j logger names match class name
Dir.glob('**/*java').map{|fn| expected = File.basename(fn).gsub(/\.java/, ''); [expected, open(fn){|f| if f.read=~/LoggerFactory.getLogger\((.+)\.class\)/; $1==expected; else; true; end}]}.reject{|fn, valid| valid}
@mschuetz
mschuetz / gist:5956570
Created July 9, 2013 11:11
free desktop notifications with python
>>> import pynotify
>>> pynotify.init()
>>> pynotify.init('console')
True
>>> pynotify.Notification('foo')
@mschuetz
mschuetz / noise.sh
Created January 11, 2012 12:42
pink noise or space using sox
#!/bin/bash -e
function die() {
echo $1 >&2
exit 0
}
[[ -x $(which play) ]] || die "sox must be installed"
if [ $# -gt 0 ]; then
@mschuetz
mschuetz / spam.rb
Created October 25, 2011 21:29
simple bayesian spam classifier using laplace smoothing. quickly thrown together but i'll try to polish this tomorrow.
def sum(arr)
res = 0
arr.each{|e| res+=e}
res
end
def mult(arr)
res = 1
arr.each{|e| res*=e}
res
public class Singleton {
private static Singleton inst;
public static synchronized Singleton getInstance() {
if (inst==null)
inst = new Singleton();
return inst;
}
private Singleton() {