Skip to content

Instantly share code, notes, and snippets.

View Chase-san's full-sized avatar

Chase-san

  • Detroit, USA
View GitHub Profile
@Chase-san
Chase-san / Scarlet.ATG
Created May 25, 2013 23:40
Coco/R is somewhat annoying...
COMPILER CompilationUnit
CHARACTERS
tab = '\u0009' .
lf = '\u000a' .
cr = '\u000d' .
digit = "1234567890" .
letter = 'A' .. 'Z' + 'a' .. 'z' + '_'.
@Chase-san
Chase-san / jenkins.go
Created May 10, 2013 20:41
Jenkins hash function
package jenkins
import "hash"
// Jenkins hash function
type jenkins uint32
func New32() hash.Hash32 {
var j jenkins = 0
return &j;
@Chase-san
Chase-san / hash.go
Created May 10, 2013 18:51
Some basic hash functions for Go. I wrote this as my first attempt at Go.
package hash
type Hasher interface {
Update(uint8)
UpdateArray([]uint8)
Hash() uint32
Reset()
}
const (
@Chase-san
Chase-san / rain.cpp
Created May 9, 2013 22:08
Matrix Digital Rain
#include <stdlib.h>
#include <windows.h>
#include <objidl.h>
#include <gdiplus.h>
using namespace Gdiplus;
wchar_t* characters =
//Hiragana
L"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもや"
@Chase-san
Chase-san / SkeletonHelper.java
Last active December 29, 2015 00:47
My jpct bones skeleton helper. Now with multiple pose interpolation and blending.
/**
* The MIT License (MIT)
*
* Copyright (c) 2013-2014 Robert Maupin
*
* 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 without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@Chase-san
Chase-san / CSUtil.js
Last active December 12, 2015 08:29
A set of utilities for FightCode.
/* I prefer the singleton class creation method. */
var CSUtil = {
TWO_PI: Math.PI * 2,
TO_DEG: 180/Math.PI,
/**
* Returns the angle from x1y1 to x2y2. This function will accept
* robot.position, scannedRobot.position, and wrap.
*/
angleTo: function(p,q) {
@Chase-san
Chase-san / chibichan.php
Last active December 12, 2015 02:49
A very tiny danbooru style image gallery!
<?php /* Copyright(c) 2013 Robert Maupin. Released under the ZLIB License. */
date_default_timezone_set('GMT');
define('DB','chan.db');
$max_image_size_kb = 1024*1024;
$thumbnail_size = 150;
$thumbnail_quality = 70;
$db = new PDO('sqlite:'.DB, 0, 0, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
function query($sql, $params = NULL) {
global $db;
$s = $db->prepare($sql);
@Chase-san
Chase-san / Rabbit.java
Created February 3, 2013 06:47
An implementation of the Rabbit Stream Cipher.
package org.csdgn.crypt;
import java.util.Arrays;
/**
* Tested against the actual RFC.
* This implementation is optimized for code length.
* Please do not use this version in production, use the much faster unrolled version here: https://gist.github.com/2814851
* @author Robert Maupin
* @see {@link http://tools.ietf.org/rfc/rfc4503.txt}
@Chase-san
Chase-san / index.php
Last active December 12, 2015 02:18
A very tiny image gallery.
<?php /* Copyright(c) 2013 Robert Maupin. Released under the ZLIB License. */
if(count($_FILES) > 0) {
extract($_FILES['file']);
list($w,$h,$type)=getimagesize($tmp_name);
/*see exif-imagetype() documentation :) */
if(!$type||$type>3||filesize($tmp_name)>1024*200)
exit();
$ext=image_type_to_extension($type,false);
$md5=md5_file($tmp_name);
move_uploaded_file($tmp_name,$n="img/$md5.$ext");
@Chase-san
Chase-san / Rabbit.java
Last active April 15, 2021 06:18
Rabbit Stream Cipher
package org.csdgn.crypt;
import java.util.Arrays;
/**
* Tested against the actual RFC.
*
* @author Chase (Robert Maupin)
* @see {@link http://tools.ietf.org/rfc/rfc4503.txt}
*/