Skip to content

Instantly share code, notes, and snippets.

View jtolio's full-sized avatar
🙃

JT Olio jtolio

🙃
View GitHub Profile
@jtolio
jtolio / code.ino
Last active January 3, 2021 15:35
esp8266 dht22 sensor
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* WIFI_SSID = "<redacted>";
const char* WIFI_PASS = "<redacted>";
const char* POST_URL = "http://thermostat.lan:8081/sensor/";
const char* SENSOR_NAME = "bedroom";

Keybase proof

I hereby claim:

  • I am jtolio on github.
  • I am jtolds (https://keybase.io/jtolds) on keybase.
  • I have a public key whose fingerprint is 06D0 CD5B A856 7236 55B7 FE47 315F 4F83 B1B6 93C5

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jtolds on github.
  • I am jtolds (https://keybase.io/jtolds) on keybase.
  • I have a public key whose fingerprint is 06D0 CD5B A856 7236 55B7 FE47 315F 4F83 B1B6 93C5

To claim this, I am signing this object:

@jtolio
jtolio / gist:83a8cf059d496586709f
Last active August 29, 2015 14:22
Temporary fix for Go issue #10303 against Go 1.4.2
diff --git a/api/go1.4.txt b/api/go1.4.txt
index 08cb17f..9101909 100644
--- a/api/go1.4.txt
+++ b/api/go1.4.txt
@@ -389,6 +389,9 @@ pkg sync/atomic, method (*Value) Load() interface{}
pkg sync/atomic, method (*Value) Store(interface{})
pkg sync/atomic, type Value struct
+# Fixing Go issue 10303
+# This is absolutely the wrong place to put this. It shouldn't be in
@jtolio
jtolio / Dockerfile
Last active August 29, 2015 14:05
Dockerfile for making a NaCl-targeting Go build environment
FROM ubuntu:precise
MAINTAINER JT Olds <hello@jtolds.com>
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget unzip ca-certificates python libc6-i386 bzip2 gcc-multilib g++-multilib netbase
RUN mkdir -p /tmp/downloads
RUN wget -O /tmp/downloads/go.tar.gz https://storage.googleapis.com/golang/go1.3.1.src.tar.gz
RUN wget -O /tmp/downloads/nacl.zip http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip

Keybase proof

I hereby claim:

  • I am jtolds on github.
  • I am jtolds (https://keybase.io/jtolds) on keybase.
  • I have a public key whose fingerprint is 06D0 CD5B A856 7236 55B7 FE47 315F 4F83 B1B6 93C5

To claim this, I am signing this object:

@jtolio
jtolio / xorsort.py
Created August 12, 2012 04:45
xor re-sort from a numerically sorted list
#!/usr/bin/env python
import time
import bisect
import random
class ArrayWrapper(object):
"""This class allows access to an array via binary search, while counting
@jtolio
jtolio / gist:3320257
Created August 11, 2012 02:55
xor dist intuition helper
in this example, n = 59
val bitstr realdist xordist
0 0000000 59 59
1 0000001 58 58
2 0000010 57 57
3 0000011 56 56
4 0000100 55 63
5 0000101 54 62
6 0000110 53 61
@jtolio
jtolio / run_slow.py
Created July 27, 2012 21:54
run a process slower
#!/usr/bin/env python
import os
import sys
import time
import signal
QUANTUM = 0.01
class AtFuncExit(object):
"""Similar to Go-lang's defer keyword. Allows execution of a list of
functions at a block exit boundary.
"""
def __init__(self, swallow_errors=False, fifo=False):
self._exception_calls = []
self._normal_calls = []
self._swallow_errors = swallow_errors