Skip to content

Instantly share code, notes, and snippets.

View jarmokivekas's full-sized avatar

Jarmo Kivekas jarmokivekas

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jarmokivekas
jarmokivekas / update-matplotlib-plot.py
Last active March 9, 2019 17:57
Minimal working example of updating matplotlib plots with new data over time.
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
# read new up-to-date data
def new_data():
x = np.linspace(0, 100)
y = np.random.random(len(x))
return (x,y)
jarmo@jarmo-ThinkPad-T430s:/$ nteract
nteract: command not found
jarmo@jarmo-ThinkPad-T430s:/$ apt-cache show nteract
Package: nteract
Architecture: amd64
Version: 0.0.15
Priority: extra
Section: editors
@jarmokivekas
jarmokivekas / overpass.geojson
Created October 15, 2016 14:34 — forked from anonymous/overpass.geojson
data exported by overpass turbo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jarmokivekas
jarmokivekas / open-gl-stub.py
Created October 10, 2016 14:27
A python boilerplate stub for rendering stuff with open GL un a graphical window
import sys
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
# The display() method does all the work; it has to call the appropriate
# OpenGL functions to actually display something.
def display():
# Clear the color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
@jarmokivekas
jarmokivekas / 1087-grid.gpx
Last active August 25, 2015 19:35
quick python script for generating a coordinate grid for a given area
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="" version="1.1">
<trk>
<trkseg>
<trkpt lon="15.300000" lat="5.500000"></trkpt>
<trkpt lon="11.000000" lat="5.500000"></trkpt>
</trkseg>
<trkseg>
<trkpt lon="15.300000" lat="5.505000"></trkpt>
@jarmokivekas
jarmokivekas / stepper_ctl.c
Created April 1, 2015 15:06
Ineffectively implemented logic with switch statement
struct stepper_motor {
// phase pins connected to the control IC. e.g PB2, PD4
uint8_t phaseA_pin;
uint8_t phaseB_pin;
// which port the relevant pin is located in e.g &PORTB, &PORTC
volatile uint8_t *phaseA_port;
volatile uint8_t *phaseB_port;
// current state of the motor (in the tick loop).
// the value is a 2-bit integer where phaseB_pin (msb) phaseA_pin (lsb)
@jarmokivekas
jarmokivekas / csv_data_input.py
Last active August 29, 2015 14:06
Simple script for data input. Data points include an input value an a timestamp in csv format
#!/usr/bin/python
#
#
# Simple script for data input. Data points include an input value and a timestamp.
# The data is appended to ./data.csv to make it easy to import into a spreadsheet.
#
#
import time