Skip to content

Instantly share code, notes, and snippets.

@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 / 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
/* 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. */
/// @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.
#include "encoding.hpp"
#include <deque>
#include <string>
using namespace std;
namespace rcc {
void UTF8Decoder::operator () (int code_unit)
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
Running NumPy colfilter...
100 loops, best of 3: 15.98 ms
Running OpenCL colfilter...
100 loops, best of 3: 3.10 ms
Speed up: x5.16
=====
Running NumPy coldfilt...
100 loops, best of 3: 11.24 ms
Running OpenCL coldfilt...
1000 loops, best of 3: 1.96 ms
Running NumPy colfilter...
100 loops, best of 3: 16.12 ms
Running OpenCL colfilter...
100 loops, best of 3: 3.08 ms
Speed up: x5.23
=====
Running NumPy coldfilt...
100 loops, best of 3: 11.18 ms
Running OpenCL coldfilt...
1000 loops, best of 3: 1.95 ms
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.