Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / markovbot.js
Last active June 1, 2021 07:51
An IRC bot that responds to every input on a channel with Markov-generated output. It also learns from every channel message. Put two in a channel for utter chaos!
// Stripped down version of minibot.
// Use as baseline for other bots !
/*jslint node: true */
console.log("-- working directory: " + process.cwd());
var net = require("net"),
fs = require("fs");
@boxmein
boxmein / mackerel.rb
Created August 1, 2013 23:33
How often have you asked yourself: Is there some silly word that shares letters with most of the names of the states of the US?
states = %w(Alabama Alaska Arizona Arkansas California Colorado
Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa
Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota
Mississippi Missouri Montana Nebraska Nevada NewHampshire NewJersey
NewMexico NewYork NorthCarolina NorthDakota Ohio Oklahoma Oregon
Pennsylvania RhodeIsland SouthCarolina SouthDakota Tennessee Texas Utah
Vermont Virginia Washington WestVirginia Wisconsin Wyoming)
ARGV.each do |word|
states.each do |state|
(function($) {
// add a button for it
$('.Message a[href*="View.html?Post="]')
.after($('<span class="messagePreview">&hellip;</span>'));
// make the buttons work
$('.messagePreview').click(function(evt) {
console.log("Previewing message...");
var postID = $(evt.target).parent()
@boxmein
boxmein / ExpBot II.lua
Last active December 19, 2015 09:19 — forked from JanneSalokoski/ExpBot II.lua
I fixed the commenting up a bit, and added a few todos which in my opinion should help the developer (@jenn4).
--ExpBot II (Experimental Bot V2.1) - An simple IRC bot written in Lua - the programming language.
-- Comments are written in the luadoc style
-- http://keplerproject.github.io/luadoc/manual.html#tags
require "socket"
s = socket.tcp()
-- passwords are received from standard input
passLine = io.read()
network = "chat.eu.freenode.net" --