{{ message }}

Instantly share code, notes, and snippets.

👨‍💻
hackerman

dalandalanmiller

👨‍💻
hackerman
Created Aug 26, 2015
View rethinkdb_statistical_reql_query_examples.js
 ## #Finding the hottest observations per day (or a _single_ maxima for each day) ## r.db("telemetry_pi").table("observations").create_index r.db('telemetry_pi').table("observations").group({index: "datetime"}).max("temp").ungroup()("reduction") ## #Finding some basic statistics and calculating a simple linear regression (y_humidity = alpha + beta_temp * temp) ## # https://en.wikipedia.org/wiki/Simple_linear_regression
Created Oct 18, 2014
View inner_transpose.py
 import os import re import string import random path = "path_to_folder_just_about_set_of_text_files" word = re.compile("\w*") for x,y,z in os.walk(path): for file in z:
Created Oct 18, 2014
Quick script to use `/usr/share/dict/words` and count the amount words which can be inner-transposed to another word. Also prints the average length of words with alternates.
View words_inner_trans_counter.py
 from collections import Counter words = [] with open("/usr/share/dict/words","r") as f: for line in f: words.append(line.strip()) words_list = []
Created Mar 28, 2015
View ML_Proj_Example.py
Created Jun 23, 2015
View earthquake-refresh.py
 import rethinkdb as r url = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month.geojson" def refresh_quakes(): conn = r.connect() r.db("earthquakes").table("quakes").insert( r.http(url)["features"].merge({ "time": r.epoch_time( r.row['properties']['time'] / 1000
Created Jun 24, 2015
How to SSH Tunnel to a Docker container on a remote machine
View gist:e68ef5570a236387100c
Last active Aug 29, 2015
A js file which watches a RethinkDB changefeed and pushes messages to PushBullet.
View watcherRethinkDB.js
 var r = require("rethinkdb"); var Promise = require("bluebird"); var fs = require("fs"); var PushBullet = require('pushbullet'); Promise.promisifyAll(fs); fs.readFileAsync("token").then(function(val) { PUSHER = new PushBullet(val.toString().trim()); }) .then(function(){
Last active Aug 29, 2015
Python script to run via cronjob, read sensor data, and push data into RethinkDB.
View pusherRethinkDB.py
 import socket import rethinkdb as r import time import Adafruit_DHT import datetime import logging import sys logging.basicConfig( level=logging.INFO,
Last active Oct 5, 2015