Skip to content

Instantly share code, notes, and snippets.

@KaeruCT
KaeruCT / GameObject.java
Created May 2, 2012 21:57
bad platformer basic entity
package com.cascadegames.androidgame;
import android.util.Log;
import jgame.JGObject;
public abstract class GameObject extends JGObject {
AndroidGame g;
double gravity = 0.9;
@KaeruCT
KaeruCT / about.md
Created June 30, 2012 02:04 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@KaeruCT
KaeruCT / hackertyper.sh
Last active April 4, 2022 15:21
hackertyper.com on your bash shell
#!/bin/bash
if [ ! -r "$1" ]; then
echo "Please provide a valid file."
exit 0
fi
file="$(<$1)"
length="${#file}"
speed=4
char_count=0
@KaeruCT
KaeruCT / noise.py
Last active December 14, 2015 09:08
i have no idea what i'm doing
#!/usr/bin/env python2
# do: ./noise.py | aplay -c 2
# edited: speed up until too fast
import sys
import math
import random
TEMPO=1000
def p(i):
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
@KaeruCT
KaeruCT / gist:5500114
Last active December 16, 2015 21:29
choose your own adventure (really tightly coupled to board software)
<?php
// By Kaeru~
require('lib/common.php');
$sql = new mysql;
if(!@$sql->connect($sqlhost,$sqluser,$sqlpass))
{
mysqlerror();
}
package main
import (
"fmt"
"math/big"
)
func fibonacciCalculator() func(n int) *big.Int{
cache := map[int]*big.Int{
0: big.NewInt(0),
@KaeruCT
KaeruCT / .conkyrc
Created September 12, 2013 21:33
conky config
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_class conky-semi
own_window_argb_value 40
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
format_human_readable yes
double_buffer yes
background yes
#!/usr/bin/php
<?php
if (empty($argv[1])) {
die("please specify a file\n");
}
function is_str($word) {
return preg_match('%^".*"$%', $word);
}
#!/usr/bin/php
<?php
class Gasm { private $code = []; private $pc = 0; private $code_start = 0; private $code_len = 0; private $vars = []; private $labels = []; private $stack = []; private $comparison = false; private function line_number() { return 1 + $this->code_start + $this->pc; } private function strip_comments($line) { return trim(preg_replace('%;(.*)$%m', '', $line)); } private function is_label ($line) { return substr($line, -1) === ':'; } private function parse_line($line) { return array_map('trim', preg_split('%\s%', $line, 2)); } private function parse_args($args) { return array_map('trim', preg_split('%,%', $args)); } private function eval_expression($exp) { $matches = []; $ops = [ '+' => function ($a, $b) {return $a + $b;}, '-' => function ($a, $b) {return $a - $b;}, '*' => function ($a, $b) {return $a * $b;}, '/' => function ($a, $b) {return $a / $b;}, '%' => function ($a, $b) {return $a % $b;}, ]; $literals = [ '\n' => "\n", '\t' => "\t" ]; $ifx = '/(\w+)\s*(['.preg_quote(implode('', array_ke