Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@boxmein
boxmein / execl_receiver.c
Created March 28, 2014 16:22
A C experiment to see if execl() can be used to pass around memory, if the new process's memory addresses are at the same location.
// Is the sub-process. Prints out the 'undefined' value of myvalue before it's assigned to.
//# gcc -o execl_receiver execl_receiver.c
#include <unistd.h>
#include <stdio.h>
extern char **environ;
// hopefully since it has the same memory location perchance it'll keep the value that
// last was written to that virtual memory location?
char myvalue;
// Queries the computer for the cpuid bits and tries detailing the results.
//# vcvars32 & cl __cpuid.c
// See http://msdn.microsoft.com/en-us/library/hskdteyh(v=vs.90).aspx
// Not sure what to do for Linux.
#include <stdio.h>
#include <intrin.h>
int main(int argc, char *argv[]) {
@boxmein
boxmein / AdolfNumberer.rb
Last active August 29, 2015 14:03
Finds out the Adolf number of Wikipedia pages by reverse-crawling through the "what links here?" pages.
# Work in Progress
# AdolfNumberer.rb
# ================
#
# I've got too much time on my hands.
# This is a script that visits the listing of "What Links Here?" of the Adolf Hitler Wikipedia page,
# assigns everything there an Adolf number of 1, then goes through each of those and their backlink
# pages, assigns every one of those an Adolf number of 2, on an epic and eternal search for anything
# past Adolf number 6.
@boxmein
boxmein / ristovskithing.c
Created July 6, 2014 17:21
A command-getter-system in C. Technically you can add and remove stuff dynamically!
// A command system with callbacks that technically can be dynamically added/removed
//# gcc -o ristovskithing.exe ristovskithing.c -std=c99
// The above is an inmake command. You can just run it in the shell to compile.
// for the ristovski
// ~ boxmein 2014
#include <string.h>
#include <stdio.h>
#include <assert.h>
// basically, how long a line can be. let's store the line inside a char*[MAX_LINE]
@boxmein
boxmein / build_tpt.sh
Last active August 29, 2015 14:04
A shell script to download all necessary libraries, and build simtr/The-Powder-Toy on Linux. Includes a Vagrantfile to run said Linux. (Runs 32-bit Debian Wheezy)
#!/bin/sh
# Run 'vagrant up' for a Linux box with all necessary tools to compile TPT.
# Note: does not yet work!
#
# Linux
#
echo "Preparing Linux build environment"
# install TPT dependencies and general build tools
@boxmein
boxmein / file.sh
Last active August 29, 2015 14:04
Testing Git features on Gist
#!/bin/sh
echo i'm a nice shell script!
echo i'm updated!
echo THIS IS AN EVIL LINE OF CODE
echo IF THE LAST ONE WASNT EVIL ENOUGH THIS WILL BE
@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? :: '))
@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 / 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 / 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