Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@boxmein
boxmein / gist:6599306
Created September 17, 2013 19:16
Another terribly unnecessary script for the unnecessary esoteric language.
# http://esolangs.org/wiki/Unnecessary
# Unnecessary interpreter for the unnecessary language.
# Usage: unnecessary.rb <file>
puts "Error: program file exists" if ARGV[0] and File.exist? ARGV[0]
@boxmein
boxmein / gist:6729923
Last active December 24, 2015 02:19
#powder fuckfuck/brainfuck clone. This kept me busy for a few minutes.
import sys, array
# Name to character reference
# you can like
# modify me
# modify me a lot
# i likes it
ch = {
'mniip': '<',
'Ristovski': '>',
@boxmein
boxmein / integer-division.c
Last active December 25, 2015 09:29
A script that demonstrates integer division in C. Prints two numbers, the first with integer division and the second with floating division. Integer division is achieved by having the divisor be an integer.
/*
A script that demonstrates integer division in C.
Prints two numbers, the first with integer division
and the second with floating division.
Integer division is achieved by having the divisor
be an integer.
Compile with anything really. Running produces the
following output:
0 0.333333
*/
@boxmein
boxmein / liivakellad.py
Last active December 25, 2015 11:09
Creates two equal triangles in a hourglass formation-ish
# -*- encoding:utf8 -*-
def magic(width):
lines = []
oldwidth = width
# going downwards
width += 2
while width-2 > 0:
lines.append(str.center("* " * (width-2), oldwidth*2))
@boxmein
boxmein / split.py
Last active December 25, 2015 15:29
Splits a square defined by its side w into four equal squares defined by their relative coordinates to the top left corner.
# split a square defined by its side w into four equals
# for Doxin
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Square:
def __init__(self, x1, y1, x2, y2):
@boxmein
boxmein / secret.py
Created October 20, 2013 17:42
A script to run a HTTP server that responds with different data when an Authorization header has been sent. Will not tell the end user about needing an Authorization header.
# A secret HTTP server that only serves some content of a page
# when a decent Authorization header has been sent with the
# correct data.
# By itself will not tell the client that there needs to be an Authorization
# header.
# woo, secret spy networks!
# boxmein 2013 - free to use - idk
@boxmein
boxmein / minidust.pde
Last active March 30, 2020 13:19
Processing implementation of a small falling-sand game.
// Something relating to a falling sand game
//
// Usage:
//
// After opening the Processing IDE, copy it into an empty new sketch.
// Just as simple as that.
//
//
// Playing:
//
@boxmein
boxmein / inmake.rb
Last active January 2, 2016 12:29
A script to have inline shell commands in source files (main source now: https://github.com/boxmein/inmake)
#!/usr/bin/env ruby
# echo yay! you ran inmake on inmake itself in default mode!
# Option parsing!
require 'optparse'
opts = {}
OptionParser.new do |parser|
@boxmein
boxmein / Markov.rb
Last active January 3, 2016 09:59
A Ruby class to generate order-2 Markov text.
#!/usr/bin/env ruby
#
# Markov.rb
# =========
#
# A weighted Markov chain [text] generator implementation in Ruby
# Actually works!
#
#
# Usage
@boxmein
boxmein / extrapolate.js
Created March 6, 2014 13:21
A small Javascript function that extrapolates in-string code like Ruby does.
/*
extrapolate.js
==============
A small utility function that allows Ruby-like string extrapolation
via #{expr}. Relies on ES5's Array#forEach but is relatively easy
to convert not to use it.
...that's it, folks!