Skip to content

Instantly share code, notes, and snippets.

import csv
import datetime
import sys
import sqlite3
import random
#import script to get MiFit data into Gadgetbridge database
activity_file_name="ACTIVITY_MINUTE.csv"
hr_file_name1="HEARTRATE.csv"
@vanous
vanous / grph.py
Created November 1, 2018 20:42
gadgedbridge simple data exploration
import sqlite3
import matplotlib.pyplot as plt
import datetime
import numpy as np
conn = sqlite3.connect('Gadgetbridge')
c = conn.cursor()
a=c.execute("select strftime('%Y.%m.%d', datetime(timestamp, 'unixepoch')) as d,sum(STEPS) from MI_BAND_ACTIVITY_SAMPLE group by d").fetchall()
b={x[0]:x[1] for x in a}
@vanous
vanous / readme.md
Created August 22, 2018 17:36 — forked from xem/readme.md
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@vanous
vanous / Robin_MegaPointe_DMX_charts.qxf
Last active June 17, 2018 11:41
This script converts ROBE XML definitions into QLC+ qxf fixture files. Generated example included.
<!DOCTYPE FixtureDefinition>
<FixtureDefinition xmlns="http://www.qlcplus.org/FixtureDefinition">
<Creator>
<Name>ROBE robe2qlc converter</Name>
<Version>0.1</Version>
<Author>ROBE Petr Vanek</Author>
</Creator>
<Manufacturer>Robe lighting s.r.o.</Manufacturer>
<Model>Robin Megapointe</Model>
<Type>Moving Head</Type>
@vanous
vanous / websocketserver.py
Created February 10, 2016 07:43 — forked from jkp/websocketserver.py
A simple WebSockets server with no dependencies
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@vanous
vanous / gist:6470179
Created September 6, 2013 21:22
generate docbook table from tab separated text python script for codeskulptor
input="""img.png description
bbb 222
ccc 333
ddd 444
eee 555
fff 666"""
#define number of columns
cols=3