Skip to content

Instantly share code, notes, and snippets.

View wridgers's full-sized avatar

Will Ridgers wridgers

View GitHub Profile
@wridgers
wridgers / gist:4277600
Created December 13, 2012 16:22
Writes a BMP format file.
void Tracer::writeScreenToBmp()
{
// short == 2 bytes
// int == 4 bytes
struct BitMapFileHeader
{
short magic;
int size;
short reserved1;
@wridgers
wridgers / header.tex
Last active December 10, 2015 21:08
\documentclass[a4paper]{article}
% variables! for nice stuff.
\newcommand{\documentTitle}{TITLE OF YOUR DOCUMENT}
\newcommand{\documentAuthor}{YOUR NAME}
\newcommand{\documentDate}{\today}
% unicode please
\usepackage[utf8]{inputenc}
bool Tracer::loadExampleScene()
{
// render settings
// lighting settings
Tracer::useAmbientLighting(true);
Tracer::setAmbientLightingColour(Colour(255, 255, 255));
Tracer::setAmbientLightingIntensity(0.05);
// lights
void Tracer::trace()
{
// camera setup
Vector3 cameraLocation(0, 0, -800);
// light setup
double lightIntensity = 100.0;
Vector3 lightLocation(0, 500, 0);
for (int screenIndex = 0; screenIndex < Tracer::screenBufferSize; ++screenIndex ) {
@echo off
setlocal EnableDelayedExpansion
set EXT_LIST=(c cpp css h hs js pl py sh xml log markdown md text txt conf json)
ftype txtfile="C:\Program Files (x86)\Vim\vim73\gvim.exe" --remote-silent "%%1"
for %%e in %EXT_LIST% do (
assoc .%%e=txtfile
REG ADD "HKEY_CLASSES_ROOT\.%%e" /f /ve /d "txtfile"
REG ADD "HKEY_CLASSES_ROOT\.%%e" /f /v "Content Type" /d "text/plain"
#!/usr/bin/python
import os, time, sys
now = time.time()
errorFiles = open('errors.txt', 'w')
playlist01days = open('Last 1 day.m3u', 'w')
playlist07days = open('Last 7 days.m3u', 'w')
playlist14days = open('Last 14 days.m3u', 'w')
PS D:\Dev\projects\john\bin> Measure-Command { .\debug\john.exe }
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 600
Ticks : 6008259
TotalDays : 6.95400347222222E-06
@wridgers
wridgers / goban.js
Last active December 12, 2015 13:39
function Goban(canvasElement) {
// size config
this.gridSize = 19;
this.gridWidth = 20;
// style config
this.styleStones = 'smooth';
this.styleBoard = 'lightwood';
// board style
<tr>
<td>
<table border="0" class="comment-table" level="1" id="5293602">
<tbody>
<tr>
<td style="border-right-width: 2px; border-right-style: solid; border-right-color: rgb(255, 102, 0);"><img src="/sslyc/images/s.gif" height="1" width="40" /></td>
<td valign="top">
<center>
<a id="up_5293602" onclick="return vote(this)" href="vote?for=5293602&amp;dir=up&amp;by=&amp;auth=">
<div class="up-arrow"></div>
#!/bin/sh
echo 'git submodules...'
git submodule --quiet init
git submodule --quiet update
echo 'vim...'; cp ./vimrc ~/.vimrc
rm -rf ~/.vim
if [ ! -d ~/.vim/ ]; then