Skip to content

Instantly share code, notes, and snippets.

@Ricket
Ricket / vanthiabot.user.js
Created April 6, 2011 21:23
Greasemonkey script to cheat at Vanthia, the beta version in mid-July 2009
// ==UserScript==
// @name VanthiaBot
// @namespace http://richardcarter.org/
// @include http://87.239.219.99/
// ==/UserScript==
var allMonstersDead = function () {
var actionbar = unsafeWindow.document.getElementById("actionbar");
return (actionbar.style.display == "none");
}
@Ricket
Ricket / brainfucc.c
Created April 24, 2011 16:47
Brainfuck to C translator
/*
* A simple, non-optimizing brainfuck to C translator.
* 2010-08-31 - Version 1.0 (Cory Burgett)
*
* This code is hereby placed into the public domain.
*
* Originally located at: http://www4.ncsu.edu/~cmburget/brainfucc.c
*/
#include <stdio.h>
@Ricket
Ricket / CompetitionTemplate.java
Created April 28, 2011 04:15
Template for programming competition Java program
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class CompetitionEntry {
@Ricket
Ricket / MA493_A7.m
Created May 5, 2011 05:49
MA 493 Assignment 7
clear all;
% load the "MLtraining" matrix
load('Examtraining.mat');
% movies.dat: replace :: with @
tic;
movies_dat = fopen('movies.dat');
movies = textscan(movies_dat, '%d %s %s', 'delimiter', '@');
[m_ids m_names m_genres] = movies{:};
@Ricket
Ricket / ServerManagedPolicy.java
Created August 22, 2011 23:38
Modified ServerManagedPolicy which only requires licensing to be verified every 7 days or 10 tries. (from the Android licensing library)
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Ricket
Ricket / RightToLeftTest.java
Created August 24, 2011 23:23
Correcting the notion that Java's assignment statements are evaluated "right to left."
/**
* This program proves that expressions are evaluated left to right; assignment
* statements, therefore, are evaluated left-to-right on the right side of the
* equals sign (since that's just an expression) and then assigned to the
* thing to the left of the equals sign.
*
* So when a professor tells you that assignment statements are evaluated
* right-to-left, it doesn't mean each symbol in the statement is evaluated
* in the order from right to left, just that the stuff on the right is assigned
@Ricket
Ricket / gist:1205383
Created September 9, 2011 02:53
My notes from Douglas Crockford's speech "JavaScript Programming Style & Your Brain"
Douglas Crockford
Sr. JavaScript Architect, Yahoo!
JavaScript Programming Style & Your Brain
He made JSLint
Prefer forms that are error resistant and more reliable
return
{
@Ricket
Ricket / config.log
Created September 19, 2011 01:11
msgpack failed attempt to compile 32-bit
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure CFLAGS=-bundle -arch i386 -arch x86_64 CXXFLAGS=-bundle -arch i386 -arch x86_64
## --------- ##
## Platform. ##
@Ricket
Ricket / spinningsquare.c
Created February 26, 2012 18:42
OpenGL Spinning Square
// spinningsquare.c
// compiles on OSX with:
// gcc spinningsquare.c -framework glut -framework opengl -o spinningsquare
#include <stdlib.h>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
@Ricket
Ricket / gist:2044441
Created March 15, 2012 14:23
Three.js mouse picking
var projector = new THREE.Projector();
var ray = projector.pickingRay( mouseCoord, camera ); // (mouse coord are in screenspace and must be [-1, 1])
var objects = ray.intersectObjects( scene.children );
if( objects.length )
{
objects[ 0 ].object; // THREE.Particule or THREE.Mesh
objects[ 0 ].face; // THREE.Face3 or THREE.Face4 (is .object is a Mesh
objects[ 0 ].point; // THREE.Vector3
}