Skip to content

Instantly share code, notes, and snippets.

View irlabs's full-sized avatar

Dirk van Oosterbosch irlabs

View GitHub Profile
@irlabs
irlabs / contrast-color.markdown
Last active September 4, 2020 14:43
Contrast Color
@irlabs
irlabs / index.html
Last active August 31, 2020 07:58
Snap color into fixed palette
<html>
<head>
</head>
<body>
<div class="wrap">
<div class="half">
<div class="colorPicker"></div>
</div>
<div class="half readout">
<h1>Snap into fixed palette</h1>
@irlabs
irlabs / run_sequence_example.py
Last active June 13, 2020 22:09
Running a timed sequence of events in python
#!/usr/bin/env python
import time
def main():
print("Start program")
# Initialize variables
sequence = [
{ 't': 1.0, 'msg': "Yakayak 1"},
{ 't': 1.8, 'msg': "Yakayak 2"},
@irlabs
irlabs / gist:58aed5c5394485c0780ffb78f774f582
Last active June 9, 2017 10:04 — forked from akirahrkw/gist:ce3c52ae79f3b5de5a01
Manipulate pixel data in swift 3.0
class BaseImageProcessor {
func createARGBBitmapContext(image: CGImage) -> CGContext? {
let pixelWidth = image.width
let pixelHeight = image.height
let bitmapBytesPerRow = pixelWidth * 4
let bitmapByteCount = bitmapBytesPerRow * pixelHeight
let bitmapData: UnsafeMutableRawPointer = malloc(bitmapByteCount)
let colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB()
@irlabs
irlabs / xed.sh
Created November 11, 2016 08:25 — forked from dunkelstern/xed.sh
xed "reimplementation" to fix broken Xcode 4 xed
#!/bin/bash
if [ "$1" = "-l" ] || [ "$1" = "--line" ] ; then
line=$2
file=$3
else
line=1
file=$1
fi
@irlabs
irlabs / getStreets.py
Created August 15, 2016 18:34
Example of getting geometry from a .shp 'shapefile'
# getStreets.py
# Example script that demonstrates how to get the geometry data out of a 'shapefile'
# A shapefile is a combination of .shp, .dbf, and .shx files, describing
# the (vector) shapes of geographic "features" (roads, bridges, lakes, etc)
# The following example deals with roads (in the Netherlands)
# (To make this script work, you'll have to download the shapefile for roads
# in the Netherlands and put these files in the same location as this file.)