Skip to content

Instantly share code, notes, and snippets.

View smukkejohan's full-sized avatar

Johan Bichel Lindegaard smukkejohan

View GitHub Profile
#include <wiringPi.h>
#include <wiringPiSPI.h>
#include <iostream>
#include <stdint.h>
int main() {
wiringPiSetup();
if(wiringPiSPISetup(0, 6000000) < 0) {
std::cerr << "wiringPiSPISetup failed" << std::endl;
}
@smukkejohan
smukkejohan / merkurToXero.py
Created September 3, 2018 18:48
merkurToXeroCSVConverter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# xero seems to only read ÆØÅ correctly if we encode the file with ISO8859-1
#import csv
import unicodecsv as csv
import sys
import codecs
import string
@smukkejohan
smukkejohan / sampleAverageFootageColor.jsx
Created January 19, 2018 09:36
sampleColor method for after effects extendscript
//By Johan Bichel Lindegaard 2018
// function sampleAverageFootageColor(options) {
// return [r,g,b,a] 0-1
/*
// options {
footageName
inTimeSeconds,
outTimeSeconds,
position,
/*
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two seconds
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
@smukkejohan
smukkejohan / gist:bd9ee0651ea01fe617e165eebddc5965
Created November 30, 2016 13:04
svg ellipse joystick webserver kea example
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "KEAIOT";
const char* password = "IOT16KEA";
ESP8266WebServer server(80);
{"sampleRate":0.1,"fileName":"/Users/jbil/dev/testPreview.mp4","lufs":"-22.3","integratedValues":["-inf","-inf","-inf","-44.6","-44.4","-25.6","-24.3","-23.3","-22.4","-22.0","-21.8","-21.8","-21.9","-22.0","-22.2","-22.2","-22.3","-22.4","-22.3","-22.2","-22.1","-22.0","-21.9","-21.9","-21.9","-21.8","-21.8","-21.8","-21.8","-21.8","-21.8","-21.8","-21.9","-22.0","-22.1","-22.2","-22.2","-22.3","-22.3","-22.3","-22.3","-22.4","-22.4","-22.4","-22.4","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.2","-22.3","-22.3","-22.3","-22.3","-22.2","-22.2","-22.2","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3","-22.3"],"momentaryValues":["nan","-50.4","-45.1","-44.6","-44.2","-25.6","-23.3","-21.8","-20.5","-20.7","-21.1","-21.6","-22.4","-22.9","-24.1","-23.1","-23.6","-23.4","-21.7","-20.9","-20.7","-20.3","-21.0","-21.6","-20.9","-21.4","-21.1","-21.3","-21.3","-22.2","-22.0","-22.6","-24.9","-25.6","-28.2","-27.6","-25.1","-23.5","-23.4","-23.2","-22.4","-23.5","-22.7","-22.0"
import requests
def voteForAllLogos():
rawPayload = "entry.1081103513=Logo+1&entry.1081103513=Logo+2&entry.1081103513=Logo+3&entry.1081103513=Logo+4&entry.1081103513=Logo+5&entry.1081103513=Logo+6&entry.1081103513=Logo+7&entry.1081103513=Logo+8&fvv=1"
r = requests.post("https://docs.google.com/forms/d/1O9btxd7Lx75hGYJqo-EcoGPoudRGt-g3jpm_FM5SBJg/formResponse", data=rawPayload)
print r.status_code
return r.status_code
votes = 0
voteSucces = True
@smukkejohan
smukkejohan / invite_all_friends.js
Last active February 25, 2016 12:30
Invite all facebook freidns to an event
// Paste in console after scrolling to bottom of invite selection window
javascript:var inputs = document.getElementsByClassName('uiButton _1sm'); for(var i=0; i<inputs.length;i++) { inputs[i].click(); }
@smukkejohan
smukkejohan / usdebtscrape.py
Created February 4, 2016 13:28
debt clock scraper
from bs4 import BeautifulSoup
import requests
""" Extract debt from alt tag in img
<tr><td align="center"><img alt="$ 1 8 , 9 9 6 , 2 2 2 , 5 4 2 , 0 5 2 . 9 3 " height="41" src="debtiv.gif" width="421"/></td></tr>
"""
req = requests.get("http://brillig.com/debt_clock/", verify=False)
soup = BeautifulSoup(req.text, "html.parser")
debtStr = soup.find('img', attrs={'src':'debtiv.gif'})["alt"]
@smukkejohan
smukkejohan / data.json
Created October 5, 2015 11:04
api response sample
{"locations": [["55fa0b6da4b3e6c1db3344bb", [-4.567633, 52.942939], "Porth Dinllaen", [[1443913680000.0, 4.1, "high"], [1443938520000.0, 1.4, "low"], [1443958620000.0, 4.0, "high"], [1443984300000.0, 1.4, "low"], [1444004340000.0, 3.8, "high"], [1444029120000.0, 1.8, "low"], [1444049580000.0, 3.7, "high"], [1444075560000.0, 1.7, "low"], [1444096080000.0, 3.5, "high"], [1444120500000.0, 2.0, "low"], [1444141320000.0, 3.7, "high"]]], ["55fa0b6ea4b3e6c1db3344c0", [-4.046093, 52.543963], "Aberdovey", [[1443908880000.0, 4.4, "high"], [1443933960000.0, 1.4, "low"], [1443953400000.0, 4.2, "high"], [1443978660000.0, 1.4, "low"], [1443998340000.0, 3.9, "high"], [1444023480000.0, 1.7, "low"], [1444043160000.0, 3.8, "high"], [1444068900000.0, 1.7, "low"], [1444088640000.0, 3.6, "high"], [1444114440000.0, 1.9, "low"], [1444133820000.0, 3.5, "high"], [1444161420000.0, 1.8, "low"]]], ["55fa0b6da4b3e6c1db3344bc", [-4.7863934, 52.7589951], "Bardsey Island", [[1443909300000.0, 3.9, "high"], [1443934140000.0, 1.2, "low"], [144