Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
// datas
unsigned char data[] = {0x32, 0x7b, 0xe0, 0x51, 0xee, 0x6b, 0x45};
unsigned char other_data[] = {0x2f, 0x71, 0xf6, 0x3, 0xe0, 0x72, 0x5F};
unsigned char pad[] = {0x56, 0x1e, 0x83, 0x23, 0x97, 0x1b, 0x31};
unsigned char out[7];
// works as both an encryptor and decryptor
/*
Hey there,
I writ this code a few months ago, in order to familiarize myself with the quake3 code. Rather than let it rot away in the code dungeon, i thought you guy's might find some use for it.
The following modification allows Quake3 to load Quake1 MDL's and Quake2 MD2's. This is done at runtime via a step-by-step in-memory conversion process, which converts the source models into Quake3 MD3's.
I got the MD2 conversion going on pretty well - successfully loaded in some Quake2 models complete with original textures, although my testing has been limited as i am not too familiar with the game code (which would allow me to try out replacing actual player models).
The MDL converter does not work as well (does not convert skins and has scaling issues), but i was still able to display the Quake1 player model in-game as a powerup.
#!/usr/bin/ruby
# csv_to_couch.rb - Simple script which plonks CSV files into CouchDB
# (C) 2009 James S Urquhart (jamesu at gmail dot com)
# Licensed under MIT
require 'rubygems'
require 'fastercsv'
require 'couchrest'
// Bookmarklet to read "title" hints on an iPhone
// Usage: Run boomarklet.
// Using two fingers, hold down on your desired image and await the hint popup.
//
// Code:
function registerImg(img) {
var timer = null;
function ts(e) {
#
# (C) 2009 Stuart J Urquhart.
# Licensed under the MIT License.
#
# The following script generates the .pvranim files used in vidsplit.
require 'rubygems'
require 'fileutils'
/* MyAnim.h */
@interface MyAnim : NSObject
{
CALayer *_root;
NSDictionary *_layers;
NSDictionary *_animTracks;
}
"Dreadful Test" by James Urquhart
[Compile with Inform 7]
Chapter 1 - The Observatory
The Observatory is a room. "Outside a large rundown observatory. It is raining.".
Wetness is a kind of value. Wetness is dry, wet. Player has Wetness. Rooms have wetness. They are usually dry. The observatory is wet.
Fred is in the observatory. He holds an umbrella. The description of the umbrella is "A nice and shiny umbrella with a screw cap on the handle".
class Document < ActiveRecord::Base
after_save :update_permalink
def to_param
permalink.blank? ? id.to_s : permalink
end
private
def update_permalink
@jamesu
jamesu / dynamic_css_animations.js
Created March 3, 2010 23:52
How to make dynamic CSS3 animations!
// Creating CSS Animations dynamically
// - jamesu
//
// Assuming:
// - styleSheets[0] is the main stylesheet
// - frames[] is a list of translation,rotation,scale keyframe values
// Note:
// If you modify an existing animation, the old keyframes
// will continue being used until you re-assign the animation.
#! /bin/bash
# Re-signs apps. Useful if you want to add users to an ad-hoc iPhone app without recompiling in XCode.
# e.g. signapp.sh Mail
#
# NOTE: be sure to replace embedded.mobileprovision in the app!
#
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform\
/Developer/usr/bin/codesign_allocate