Skip to content

Instantly share code, notes, and snippets.


Andy Thomson andy-thomason

View GitHub Profile
import numpy as np
import pyarrow as pa
import pyarrow.feather as pf
import pandas as pd
dtypes = ['i1', 'i2', 'i4', 'i8', 'u1', 'u2', 'u4', 'u8', 'f4', 'f8']
strings = ['a', 'bc', 'de', 'efgh', 'five']
cols = {d: np.ones(dtype=d, shape=(20)) for d in dtypes}
andy-thomason /
Created May 14, 2019
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

andy-thomason / exif.cpp
Created Jul 30, 2017
Example of extracting a JPEG thumbnail from a camera Exif JPEG image.
View exif.cpp
// Example Exif thumbnail extractor.
#include <iostream>
#include <fstream>
#include <vector>
andy-thomason / inverting_stb_image.cpp
Last active Aug 26, 2020
Inverting stbi_image using C++11 threading operations.
View inverting_stb_image.cpp
// Example of converting stb_image to a libjpeg-style background process.
// This enables you to stream JPEG files from the internet and interleave
// decoding time without frameout on the main thread.
// The example uses three parts of the C++11 threads API.
// 1) std::async This is used to run the loader in its own thread.
// 2) std::mutex This is used to protect the members of the class from race
// conditions.
andy-thomason / sdl_hello_triangle.cpp
Created Jul 25, 2017
Short SDL triangle example
View sdl_hello_triangle.cpp
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengles2.h>
int main() {
auto window = SDL_CreateWindow(
andy-thomason / exif_example.cpp
Created Jul 18, 2017
Extract a thumbnail from a camera JPEG file using libexif
View exif_example.cpp
#include <stdio.h>
#include <libexif/exif-loader.h>
// Note: no error handling and no cleanup for clarity.
int main()
ExifLoader *loader = exif_loader_new();
exif_loader_write_file(loader, "IMG_20170422_132409.jpg");
ExifData *ed = exif_loader_get_data(loader);
ed = exif_loader_get_data(loader);
andy-thomason /
Created Jul 16, 2017
Tiny VR triangle sample in Python with OpenVR
import time
import sdl2
import openvr
import numpy
from OpenGL.GL import *
from OpenGL.GL.shaders import compileShader, compileProgram
from openvr.glframework import shader_string
from sdl2 import *
andy-thomason / webgl.html
Created Jul 16, 2017
WebGL triangle in 58 lines
View webgl.html
function main() {
var canvas = document.getElementById("myGLCanvas");
try {
gl = canvas.getContext("webgl");
} catch(e) {