Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@boxmein
boxmein / proc_save.lua
Last active August 29, 2015 14:12
Procedural save-generator library/function for simtr/The-Powder-Toy.
-- Procedural Save Generator
-- -------------------------
--
-- A script that lets you create other scripts that create saves procedurally!
-- If you've ever done vertex shaders, this is kinda like it.
-- A few examples are in the bottom that you can uncomment to try.
--
-- NOTE: this script alone does seemingly nothing. It creates a function named
-- "runner" that can be called with another function that's described below.
--
@boxmein
boxmein / highlight-code-boxes.user.js
Last active August 29, 2015 14:10
userscript that highlights code blocks on powdertoy.co.uk
// ==UserScript==
// @name TPT Syntax Highlighted Code Boxes
// @version 1.3.0
// @description Syntax highlights <code> boxes on the powder toy forums.
// @author boxmein
// @match *://powdertoy.co.uk/Discussions/Thread/*
// ==/UserScript==
// last updated: Tue Dec 02 2014 21:16:57 GMT+0200 (FLE Standard Time)
/*
@boxmein
boxmein / newconversations.user.js
Created November 30, 2014 15:41
userscript that displays web notifications for new conversations (almost) live
// ==UserScript==
// @name New Conversation Notifier (Beta!)
// @version 1.0.0
// @description Notifies you about new conversations live on powdertoy.co.uk
// @author boxmein
// @match *://powdertoy.co.uk/*
// ==/UserScript==
/*
1.0.0 : Sun Nov 30 2014 17:39:06 GMT+0200 (FLE Standard Time)
@boxmein
boxmein / one-off-quiz-engine.html
Last active August 29, 2015 14:09
Tiny one-off quiz engine for Fast-Driver
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>quiz</title>
</head>
<body>
<!-- Something like this -->
<select class="question" data-id="1">
<option value="1">Wrong</option>
@boxmein
boxmein / generate.rb
Last active August 29, 2015 14:07
A script that generates a JSON data structure based on simtr/The-Powder-Toy element source codes. Also decorates some definitions to make them prettier/more wiki friendly.
#!/usr/bin/env ruby
# usage: ruby generate.rb -d <directory for src/simulation/elements/*>
require 'json'
require 'optparse'
# Descriptive method name award 2014
# dir :: String -- directory to look for element source code in
# outfile :: IO -- output to this writable object (.puts needs to exist)
# opts[:clean] :: Boolean -- clean up mismatches? defaults to true
# opts[:post_process] :: Boolean -- decorate some values to prettier versions? def true
@boxmein
boxmein / keybase.md
Created September 30, 2014 19:04
keybase proof thing

Keybase proof

I hereby claim:

  • I am boxmein on github.
  • I am boxmein (https://keybase.io/boxmein) on keybase.
  • I have a public key whose fingerprint is B87E 6037 955C 154E FEAB E0E6 F66E D382 3078 540B

To claim this, I am signing this object:

@boxmein
boxmein / tiny_task.py
Last active August 29, 2015 14:06
Tiny task/etc system for Python.
#
# Tiny task system
# ~boxmein 2014
# free to use
#
# {'name': callback, ...}
tasks = {}
# Add a task
@boxmein
boxmein / twitterbot-reversify.js
Created September 16, 2014 01:17
A Twitter bot that reverses the text it gets from @mentions from a specific user ID.
// A Twitter bot! Experimental!
// Reverses words of text sent to it.
//# node {{f}} # don't forget to add environment vars!
// npm install twit
var Twit = require('twit');
// how many @mentions from the top to fetch, to look for
// TODO: go through many pages of @mentions
// TODO: add since_id for the last tweet this fetched
@boxmein
boxmein / ruletka.js
Created September 7, 2014 23:18
Node.js IRC bot (adapted from my mini-bot) for kick/ban roulette, and more.
/*
Sadistic Russian Roulette and Random Banning IRC bot, codename ruletka.
Requires ops in the channel.
Commands:
1. \r : roulette.
2. \b : randomban.
3. \k : chance kick.
@boxmein
boxmein / week_1_task_1.py
Last active August 29, 2015 14:05
An attempt to solve all Week 1 and 2 problems on a Python course with one-liners. (Task 1 was a graph!)
(lambda s, t, u:
print('Hello, ' + u + '-year-old ' + s + ' ' + t + '. Good luck on the course!'))(
input('First name? :: '),
input('Last name? :: '),
input('Age? :: '))