Skip to content

Instantly share code, notes, and snippets.

Andy Thomson andy-thomason

Block or report user

Report or block andy-thomason

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View make_arrow_tests.py
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
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019
Genomics a programmers introduction
View Genomics_A_Programmers_Guide.md

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.

https://www.genomicsplc.com

@andy-thomason
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
andy-thomason / inverting_stb_image.cpp
Last active Jul 26, 2017
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
andy-thomason / sdl_hello_triangle.cpp
Created Jul 25, 2017
Short SDL triangle example
View sdl_hello_triangle.cpp
#define GL_GLEXT_PROTOTYPES 1
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengles2.h>
int main() {
auto window = SDL_CreateWindow(
"triangle", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN
);
@andy-thomason
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
andy-thomason / python_vr_triangle.py
Created Jul 16, 2017
Tiny VR triangle sample in Python with OpenVR
View python_vr_triangle.py
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
andy-thomason / webgl.html
Created Jul 16, 2017
WebGL triangle in 58 lines
View webgl.html
<html>
<head>
<script>
function main() {
var canvas = document.getElementById("myGLCanvas");
try {
gl = canvas.getContext("webgl");
} catch(e) {
console.log(e);
}
You can’t perform that action at this time.