Skip to content

Instantly share code, notes, and snippets.

View WouterG's full-sized avatar
💙

Wouter Gerarts WouterG

💙
View GitHub Profile
@WouterG
WouterG / abcde
Created October 9, 2012 20:18
possibru's
abc
abd
abe
acb
acd
ace
adb
adc
ade
aeb
@WouterG
WouterG / Program.cs
Created November 3, 2012 19:19
Puzzle solver triangle ( A = diff of b&c )
using System;
class Program
{
private static int a = 5,
b = 9,
c = 4,
d = 1,
e = 1,
f = 1,
@WouterG
WouterG / receive server.lua
Last active December 10, 2015 13:18
computercraft redstone receive/transmission server
print(os.getComputerID())
rednet.open("bottom")
redstone.setOutput("front", true)
function getinbounds(varColorInt, varSideInt)
if varSideInt >= 32768 then varSideInt = varSideInt - 32768 if varColorInt=="32768" then return true end end
if varSideInt >= 16384 then varSideInt = varSideInt - 16384 if varColorInt=="16384" then return true end end
if varSideInt >= 8192 then varSideInt = varSideInt - 8192 if varColorInt=="8192" then return true end end
if varSideInt >= 4096 then varSideInt = varSideInt - 4096 if varColorInt=="4096" then return true end end
if varSideInt >= 2048 then varSideInt = varSideInt - 2048 if varColorInt=="2048" then return true end end
if varSideInt >= 1024 then varSideInt = varSideInt - 1024 if varColorInt=="1024" then return true end end
@WouterG
WouterG / gist:5509075
Created May 3, 2013 13:19
Very precise PI
This file has been truncated, but you can view the full file.
3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match http://www.radio2.nl/top2000*
// @grant none
// ==/UserScript==
Software Design:
Design an API from scratch for using one of these household objects:
- Microwave
- Television (you may or may not include a remote)
- Phone
- Vending Machine
Take care in the design of your the program - it should include several classes packaged and organised well as well as custom exceptions (e.g trying to put non food in a microwave should through an Exception e.g ObjectNotMicrowWaveable) and possible events if you believe they are required.
This is quite an open ended task so feel free to ask for clarification if you are unsure.
public Object getRandom(HashMap<Object, Integer> chanceMap) {
int chancey = 0;
for (int c : chanceMap.values()) {
chancey += c;
}
int index = myRandom.nextInt(chancey);
Object o = null;
for (Entry<Object, Integer> e : chanceMap.entrySet()) {
index -= e.value();
package net.wouto.simplemongo;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
public class WeightedSet<T> {
@WouterG
WouterG / alter_api.js
Created April 3, 2015 13:24
Alter PlugDJ's API
/* Add any DJ to the waitlist, allows adding yourself */
API.moderateAddDJ = function(id) {
var xml = new XMLHttpRequest();
xml.open('POST', 'https://plug.dj/_/booth/add', true);
xml.setRequestHeader('Content-Type', 'application/json');
xml.send(JSON.stringify({id: id}));
}
/* Remove any DJ from waitlist, allows removing yourself */
@WouterG
WouterG / fs-whatsapp.js
Last active July 18, 2017 19:13
Fullscreen whatsapp in web based chat
// ==UserScript==
// @name Fullscreen Whatsapp & Themes
// @namespace http://your.homepage/
// @version 2.0
// @description Dark theme, and bg/theme selector.
// @author Wouter Gerarts
// @match https://web.whatsapp.com/
// @grant none
// ==/UserScript==