Skip to content

Instantly share code, notes, and snippets.

View rubenwardy's full-sized avatar

rubenwardy rubenwardy

View GitHub Profile
@rubenwardy
rubenwardy / login.bat
Created April 24, 2014 19:17
Batch login system, for fun
REM To set up, create a text file called users.txt
REM in the same directory as this batch file
REM with this content (without the REM)
REM 1,user1,password,staff
REM 2,user2,password,pupil
@ECHO OFF
SETLOCAL EnableDelayedExpansion
GOTO main
@rubenwardy
rubenwardy / init.lua
Last active August 29, 2015 14:01
code golf minetest mod 1
_=minetest;h={"get_objects_inside_radius","get_player_name","set_hp","get_hp","remove_node"};_.register_node("t:s",{});_.register_abm({nodenames={"t:s"},interval=0.2,chance=1,action=function(p) local o=_.env[h[1]](_.env,p,2);for k,b in pairs(o) do if b and b[h[2]] and b[h[2]](b)~=nil then b[h[3]](b,b[h[4]](b)-30); for d=-5,5 do for c=-5,5 do for a=-5,5 do if d*d+c*c+a*a<=30 then _.env[h[5]](_.env,{x=p.x+d,y=p.y+c,z=p.z+a}) end end end end _.env[h[5]](_.env,p);break; end end end })
@rubenwardy
rubenwardy / form1.cs
Last active August 29, 2015 14:01
Clever browser opener in C#
/*
Made this script to automatically open a web page in the correct browser.
I use multiple browsers at the same time, so I don't want to keep changing my file associations.
(Firefox used to have association, so if I am creating a game in Chrome and open a link in IRC,
firefox is opened. With this, it will be chrome because it is the only one open)
It priorities Firefox over Chrome, but you can change that.
(I use Firefox for browsing, Chrome for HTML5 games.
I use both of these and IE for web site development).
@rubenwardy
rubenwardy / noob_gen.py
Last active August 29, 2015 14:02
Python Noob Generator
# Python Noob Generator by rubenwardy
# License: WTFPL
# See IRC bot using this: https://gist.github.com/rubenwardy/8863c20a75e4faad3562
# Example:
### a random team mate shot your mum also dat enemy scouted a
### random gun and a random gun covered a random gun but also your
### mum nuked dat arsehole also a random thingy ran it like a arsehole blew up a kid
@rubenwardy
rubenwardy / bot
Created June 6, 2014 18:17
IRC bot for Python Noob Generator
# Based on http://linuxclues.blogspot.co.uk/2011/03/simple-python-irc-bot.html
# Requires https://gist.github.com/rubenwardy/4cb29fedb7952e5a4cdf
import socket
import re
import os
from noob_gen import *
import time
class Bot():
@rubenwardy
rubenwardy / run_lua.lua
Last active August 29, 2015 14:07
Chat command to run lua code in Minetest
minetest.register_chatcommand("l", {
params = "lua code",
description = "Run lua code",
func = function(name, param)
f = loadstring("minetest.chat_send_player(\"" .. name .. "\", \"Result: \" .. dump("..param.."))")
f()
end
})
@rubenwardy
rubenwardy / hudkit.lua
Last active August 29, 2015 14:12
HudKit for Minetest
-- HudKit, by rubenwardy
-- License: Either WTFPL or CC0, you can choose.
local function hudkit()
return {
players = {},
add = function(self, player, id, def)
local name = player:get_player_name()
local elements = self.players[name]
@rubenwardy
rubenwardy / convert_to_pdf.sh
Last active August 29, 2015 14:18
Convert folder of images to PDF with filenames
#
# This batch file is specific to Linux.
# (the for, mkdir, rm etc commands may be done differently on your OS.
# the convert commands should be the same though)
#
rm /tmp/imageex -r
mkdir /tmp/imageex
for filename in *.png; do
echo "Processing $filename"
@rubenwardy
rubenwardy / README.md
Last active January 4, 2016 18:46
Minetest Installer Script

Created by rubenwardy, based on a script by kaeza.

Your build directory should look like this:

  • minetest32/ (no games folder)
  • minetest64/ (no games folder)
  • games/
    • minetest_game/
    • minimal/
  • install.txt (included below)
@rubenwardy
rubenwardy / calc.rb
Last active January 11, 2016 00:47
Mathematical Expression Parser in Ruby
#
# Written by rubenwardy
# License: WTFPL
#
# $ ruby calc.rb
#
# Turns a string such as "( 0 - (6) + ( 6 ^ 2 - 4 * 1 * 5 ) ^ (1 / 2) ) / ( 2 * 1)"
# into a binary syntax tree, and then into Reverse Polish Notation, and then executes it.
#
# String is typed in the terminal during program execution