Skip to content

Instantly share code, notes, and snippets.

View mysteriouspants's full-sized avatar
:shipit:
Help! I'm trapped in a fixed-width str

Christopher R. Miller mysteriouspants

:shipit:
Help! I'm trapped in a fixed-width str
View GitHub Profile
@mysteriouspants
mysteriouspants / Q_rsqrt.c
Created August 4, 2010 20:45
Quake 3 finvsqrt plus corresponding assembler (x86)
#include <stdio.h>
#include <math.h>
/*
** float q_rsqrt( float number )
*/
float Q_rsqrt( float number ) {
long i;
float x2, y;
const float threehalfs = 1.5F;
@mysteriouspants
mysteriouspants / EVE Humor.txt
Last active April 2, 2019 13:03
EVE Online Humor
________ ________ ____ _ _
| ____\ \ / / ____| / __ \ | (_)
| |__ \ \ / /| |__ ______| | | |_ __ | |_ _ __ ___
| __| \ \/ / | __|______| | | | '_ \| | | '_ \ / _ \
| |____ \ / | |____ | |__| | | | | | | | | | __/
|______| \/ |______| \____/|_| |_|_|_|_| |_|\___|
_ _
| | | |
@mysteriouspants
mysteriouspants / Q_rsqrt_test_out.txt
Created November 1, 2010 00:29
Tested on a Intel Core 2 Duo 2.39 GHz chip in an Apple Mac Book (late 2008 model).
cmiller-laptop% clang rsqrt_test.c
cmiller-laptop% ./a.out
Q_rsqrt: 4
Q_rsqrt result: 0.499154 Avg: 555
fsqrt result: 0.500000 Avg: 552 (*)
Q_rsqrt: 4
Q_rsqrt result: 0.499154 Avg: 639 (*)
fsqrt result: 0.500000 Avg: 655
Q_rsqrt: 4
Q_rsqrt result: 0.499154 Avg: 552 (*)
@mysteriouspants
mysteriouspants / righteous-hero.txt
Created February 28, 2011 17:16
The Righteous Hero List
The Righteous Hero List, a companion to the Evil Overlord List (http://www.eviloverlord.com/)
1. I will not make alliances with any of my arch nemesis.
2. If I must have a girlfriend/love-interest, she will be trained in martial arts so as to better defend
herself against the Evil Overlord, who will surely try to use her as leverage against me.
3. I will champion the death penalty for my arch nemesis.
4. I will never leave home without a lockpicking kit.
@mysteriouspants
mysteriouspants / timecalc.rb
Created February 28, 2011 19:32
Short Ruby script written for the purpose of automating the process of computing the total time worked each week on my archaic paper-based timecard.
#!ruby
require 'highline/import'
require 'date'
total_time = nil
begin_time = nil
end_time = nil
@mysteriouspants
mysteriouspants / functional.rb
Created June 6, 2011 18:44
Yaya Functional Programming!
# originally an IRB session on cmiller@t3iMac.ldschurch.org
func= lambda {|hash,key| hash[key]=Hash.new(&func)}
# => #<Proc:0x000001010621b8@(irb):1 (lambda)>
h=Hash.new &func
# => {}
h[:foo]
# => {}
h[:foo][:bar][:baaz] = 'yay functional programming!'
# => "yay functional programming!"
h.keys
@mysteriouspants
mysteriouspants / test.m
Created July 6, 2011 21:28
Runtime Funs!
// compile with:
// clang -framework Foundation test.m
// run with:
// ./a.out
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
#include <stdio.h>
int main(int argc, char *argv[])
> gem list ~@t3imac.ldschurch.org
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.9)
actionpack (3.0.9)
actionservice (0.3.0)
activemodel (3.0.9)
activerecord (3.0.9)
// clang -o magic8ball -framework Foundation magic8ball.m
#import <Foundation/Foundation.h>
#include <stdio.h>
NSUInteger randomUnder(NSUInteger topPlusOne);
int main()
{
srandomdev(); // rather important
@mysteriouspants
mysteriouspants / NSArray+Chunkify.m
Created August 19, 2011 16:49
Sign that I'm Going Nuts. I'm putting corrupted lyrics to Tower of Power songs into my source code. With diacriticals.
//
// NSArray+Chunky.h
//
// Created by Christopher Miller on 8/19/11.
// Copyright 2011 FSDEV. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (Chunky)