Skip to content

Instantly share code, notes, and snippets.

View gobug.go
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"runtime/debug"
@bionoren
bionoren / fetchBackgroundImages.php
Created Feb 15, 2014
Fetches background images from http://gtgraphics.de/ (some of which are used in Windows 8). Organizes by resolution.
View fetchBackgroundImages.php
<?php
//Fetching some of the older backgrounds requires the PHP rar extension (available through pecl). If this extension is not installed, those images will be skipped.
for($i = 1; true; $i++) {
$tmpDir = sys_get_temp_dir();
if(substr($tmpDir, -1) != '/') {
$tmpDir .= '/';
}
if(file_exists($tmpDir.'imageList'.$i)) {
$imageListPage = file_get_contents($tmpDir.'imageList'.$i);
} else {
@bionoren
bionoren / ophanim.manufactoria
Last active Dec 24, 2015
Manufactoria (game) solution for Ophanim (Bonus level 2) in manufactoria (language)
View ophanim.manufactoria
/**
aaa|bbb*
| = green
* = yellow
1. Strip off any leading red
2. Assume a > b (a has a red before b does)
2a. If a > b assumption holds and len(a) >= len(b), accept
3. If len(a) < len(b), reject
4. If len(a) > len(b), accept
@bionoren
bionoren / courseLoop.php
Created May 7, 2013
All the course combinations. Well, all the ones the might pan out.
View courseLoop.php
/**
* Creates a list of classes that can be taken (i.e. do not cause conflicts with other classes and can be used
* in a valid schedule.) from the given courses.
*
* Note that this function (the while loop in particular) is a significant performance bottleneck
*
* @param ARRAY $courses List of course objects to consider.
* @return MIXED A list of valid classes or a string with the error message(s).
*/
function findSchedules(array $courses) {