Skip to content

Instantly share code, notes, and snippets.

import pygame, json, math, socket
# Axes
ROLL_AXIS = 0 # Xbox: left stick H
PITCH_AXIS = 1 # Xbox: left stick V
HOVER_AXIS = 2 # Xbox: left trigger
YAW_AXIS = 3 # Xbox: right stick H
GAS_AXIS = 4 # Xbox: right stick V
# Buttons
#include "encoding.hpp"
#include <deque>
#include <string>
using namespace std;
namespace rcc {
void UTF8Decoder::operator () (int code_unit)
/// @file
/// @brief Translation of source file characters to/from Unicode code points.
///
/// The first stage of processing is handled by code within this file. The UTF8Decoder class
/// provides a decoder for the UTF-8 encoding scheme. The UTF8Encoder class provides the equivalent
/// code point to UTF-8 code unit decoding. Both classes work as a wrapper around a std::function
/// which represents the remaining phases of translation.
///
/// The CodePoints scoped enum also defines some useful non-graphical code points along with some
/// 'special' code points which can be used to indicate various conditions to later pipeline stages.
/* extractall.c - an example of extracting all files from a zip file in C. */
/* This file should be considered an example, and *not* an exemplar, on how to
* use libzip to extract an archive. */
/* Note: this file goto which is famously considered harmful. We use it only to
* provide poor-man's state cleanup on error and, in this example, it is safe.
* There are other ways to do this which you should consider in your
* application. We use it here because our program is entirely contained within
* one function and the amount of state we're manipulating is small. YMMV. */
@rjw57
rjw57 / osmap-to-mc.py
Created September 25, 2013 11:34
A Python script I hacked together to convert OS mapping data to Minecraft maps.
#!/usr/bin/env python
from __future__ import print_function
import os
import numpy as np
import glob
import mclevel
import materials
@rjw57
rjw57 / ubuntu-edge-prediction.ipynb
Last active December 20, 2015 05:49
A simple IPython notebook for predicting the final amount raised on the Ubuntu Edge campaign.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rjw57
rjw57 / twython-geo-tag.ipynb
Created June 25, 2013 13:34
An IPython notebook demonstrating how to determine tweet locations with Twython.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rjw57
rjw57 / england-basemap-osgrid.tiff
Last active September 22, 2018 20:00
A Python script to plot the current delay times on England's major road links.
@rjw57
rjw57 / cat-position-data.json
Last active December 18, 2015 12:10
Extracted data from BBC's "Secret life of cats" http://www.bbc.co.uk/news/science-environment-22567526 JSON file gives timestamped pixel locations in map images. Map images copied from BBC website.
{
"cats": [
{
"videoLabel": "Ginger confronts a rival",
"name": "Ginger",
"metersToShow": 60,
"color": "#0D7C35",
"videoLocation": [
74.44,
250.92
@rjw57
rjw57 / CGSPrivate.h
Last active February 14, 2025 00:41
CGSPrivate.h - undocumented APIs for OSX. Re-licensed under MIT licence.
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* This file is a relicensed portion of DesktopManager and was originally released under
* the terms of the GNU General Public Licence. Original licence text follows the new terms.
* The contents of this file has been re-released by the original author under the following terms:
*
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software