Skip to content

Instantly share code, notes, and snippets.

View postspectacular's full-sized avatar
🎉
Celebrating 24 years of building open source tools

Karsten Schmidt postspectacular

🎉
Celebrating 24 years of building open source tools
View GitHub Profile
@postspectacular
postspectacular / arm_adressing.s
Last active September 24, 2015 02:22
ARM ASM label addressing/dereferencing note
.syntax unified
.cpu cortex-m4
.thumb
.thumb_func
foo:
ldr r0, =timer @ load address of label
ldr r1, [r0, #4] @ load word following bar ( => SysTick_VAL => 8 )
ldr r0, [r0] @ deref label addr => SysTick_BASE
ldr r0, [r0, r1] @ => val of [SysTick_BASE + SysTick_VAL]
@postspectacular
postspectacular / ffmpeg-av-seq.sh
Created August 10, 2012 22:49
ffmpeg image seq + audio + watermark
ffmpeg -f image2 -i render-%04d.png -i audio.mp3 -r 25 -vcodec libx264 -b:v 1024k -b:a 192k -t 00:00:04 -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" out.mp4
@postspectacular
postspectacular / mecrisp.md
Last active October 29, 2015 12:23
Running Mecrips-Stellaris examples on stm32f429i-disco board

Download: http://sourceforge.net/projects/mecrisp/files/

cd mecrisp-stellaris-2.1.6/stm32f429
st-flash erase
st-flash write mecrisp-stellaris-stm32f429.bin 0x08000000

picocom -b 115200 /dev/tty.SLAB_USBtoUART --imap lfcrlf,crcrlf --omap delbs,crlf --send-cmd "ascii-xfr -s -l 200 -n"
@postspectacular
postspectacular / boroughs.rq
Created November 16, 2015 01:34
boundary polygons of all London boroughs
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sdef: <http://statistics.data.gov.uk/def/>
PREFIX sg: <http://statistics.data.gov.uk/def/statistical-geography#>
PREFIX sid: <http://statistics.data.gov.uk/id/statistical-geography/>
CONSTRUCT {
?item rdfs:label ?id ;
sg:officialName ?name ;
sg:hasExteriorLatLongPolygon ?poly .
@postspectacular
postspectacular / csvrdf.clj
Last active November 16, 2015 02:01
Convert CSV to RDF (stored in EDN format)
(defn load-house-sales
"Loads CSV property sales data from given path, extracts
set of columns and transforms column values.
Returns seq of maps, one per CSV row/record."
[path]
(mapped-csv
path
;; CSV column fields to extract
#{"transaction_id" "price" "date_processed"
"post_code" "property_type" "borough_code"}
@postspectacular
postspectacular / geomviz.clj
Created November 16, 2015 11:41
geom.viz spec SVG transformation example
(->> {:x-axis (viz/linear-axis
{:domain [0 len]
:range [40 220]
:major 100
:minor 50
:pos 100
:label (viz/default-svg-label int)
:label-style {:style {:font-size "9px"}}
:attribs {:stroke-width "0.5px"}})
:y-axis (viz/log-axis
@postspectacular
postspectacular / heatmap-query.edn
Last active November 16, 2015 13:19
thi.ng/fabric heatmap & ONS lat/lon polygon query
;; query spec to compute aggregated heatmap data of all property sales per borough
{:prefixes {"sg" "http://statistics.data.gov.uk/def/statistical-geography#"}
:q [{:where [[?s "rdf:type" "schema:SellAction"]
[?s "schema:price" ?price]
[?s "ws:onsID" ?boroughID]
[?borough "rdfs:label" ?boroughID]
[?borough "sg:officialName" ?name]
[?borough "sg:hasExteriorLatLongPolygon" ?poly]]}]
:aggregate {?num (agg-count ?s)
?avg (agg-avg ?price)
@postspectacular
postspectacular / ws-ldn-2-go.sh
Last active November 16, 2015 21:04
Cloning & launching WS-LDN-2 repo and example app
git clone https://github.com/thi-ng/ws-ldn-2.git
cd ws-ldn-2
lein run
# open another terminal using same directory
lein fighweel dev
# once compilation is complete...
# open http://localhost:8000 in your browser
@postspectacular
postspectacular / instructions.md
Last active December 2, 2015 22:44 — forked from darach/instructions.md
Pony on the Odroid C1

Instructions

The following instructions assume a debian jessie based distribution

0. Prerequisites

Install dependent tools and libraries

$ sudo apt-get update
@postspectacular
postspectacular / problem59.clj
Created May 11, 2013 19:12
Project Euler #59 solution w/ Clojure
(ns toxi.euler.problem59)
;; http://projecteuler.net/problem=59
;; solution by: toxi <k at postspectacular dot com>
;; 2012-12-23
(defn xor-decrypt
"Applies bit-xor to all items in src using key as cyclic sequence."
[src key] (map bit-xor src (cycle key)))