Skip to content

Instantly share code, notes, and snippets.

View vigevenoj's full-sized avatar

Jacob Vigeveno vigevenoj

View GitHub Profile
@vigevenoj
vigevenoj / index.html
Last active April 15, 2023 18:00
D3 heatmap calendar of running distance with additional detail in mouseover section
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>Runs by date</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
.Blues .q0-3{fill:rgb(222,235,247)}
.Blues .q1-3{fill:rgb(158,202,225)}
.Blues .q2-3{fill:rgb(49,130,189)}
.Blues .q0-4{fill:rgb(239,243,255)}
@vigevenoj
vigevenoj / mqtt2influxdb.rb
Last active February 27, 2017 08:13
bmp085 -> beagleboneblack -> mqtt -> ruby -> influxdb -> graphs!
#!/opt/rh/ruby193/root/usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# mqtt & influxdb sample...
#
# libraries
# $ gem install mqtt
# $ gem install influxdb
#
@vigevenoj
vigevenoj / location-based-sunrise.rb
Last active May 2, 2017 18:34
Get next-day sunrise/sunset information for most-recent owntracks location push
require 'mqtt'
require 'solareventcalculator'
require 'json'
class LocationBasedSunrise
Version = '0.0.1'
def initialize(arguments, stdin)
@client = MQTT::Client.new('mqtts://sharkbaitextraordinaire.com:8883', :ssl => :TLSv1)
@vigevenoj
vigevenoj / Instructions for building manually without packaging
Last active April 23, 2021 14:25
Building mosquitto on centos 6 with websocket support
sudo yum install wget mercurial cmake openssl-devel c-ares-devel libuuid-devel
wget https://github.com/warmcat/libwebsockets/archive/v2.1.0.tar.gz
tar xf v2.1.0.tar.gz
cd libwebsockets-2.1.0
mkdir build; cd build
cmake .. -DLIB_SUFFIX=64
sudo make install
echo "/usr/local/lib64" | sudo tee -a /etc/ld.so.conf.d/libwebsockets.conf
sudo ldconfig
ldconfig -p | grep libwebsockets
@vigevenoj
vigevenoj / gist:795ffbb05a3aeb0e2c60
Last active March 21, 2016 03:45
mqtt_influxdb_bridge.rb
#!/opt/rh/ruby193/root/usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# mqtt & influxdb sample...
#
# libraries
# $ gem install mqtt
# $ gem install influxdb
# $ gem install logger
#
require 'mqtt'
require 'json'
require 'net/http'
require 'uri'
require 'nokogiri'
require 'yaml'
require 'bigdecimal'
# a handy set of test lat/long coords: 45.522351, -122.680826
@vigevenoj
vigevenoj / instructions.txt
Created April 5, 2016 02:49
trim Google Location History to points during a specified time window and view them as a heatmap
Go to https://takeout.google.com/settings/takeout
"Select None"
Scroll down to "Location History" and select that
Scroll to the bottom, click next, and download the file
Extract the LocationHistory.json
Convert the start and end times that you're interested in to milliseconds since epoch (epoch * 1000) and use them in the comparisons below
Use this jq filter pipeline to match only the timestamps that are within the selected time range, and export that to a file
jq '{"locations" : .locations | map(select(.timestampMs | tonumber >= 1458889200000)) | map(select(.timestampMs | tonumber <= 1459796400000)) }' Takeout/Location\ History/LocationHistory.json > trip.json
@vigevenoj
vigevenoj / how_big_them_shits_is.py
Created July 14, 2016 05:07
Inspect a list of images to see if any of them have really giant dimensions
#!/usr/bin/env python3
"""
This script takes as input a list of image IDs from image table and
uses the Pillow python library to determine the height and width
of each image. Indicate if the image is larger than a configured pixel limit.
"""
from argparse import ArgumentParser
import os
import sys
@vigevenoj
vigevenoj / index.html
Created September 9, 2016 14:59
Generate a json file with image location information and then display that on a mapbox map
<!DOCTYPE html>
<html>
<head>
<title>tripmapper</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<style media="screen" type="text/css">
@vigevenoj
vigevenoj / location_to_lcd.rb
Last active September 30, 2016 04:56
poop latest phone location onto ssd1306 lcd
!# /usr/bin/env ruby
require 'mqtt'
require 'json'
require 'yaml'
require 'bigdecimal'
require 'logger'
require 'SSD1306'
require 'rufus-scheduler'