Skip to content

Instantly share code, notes, and snippets.

@sfan5
sfan5 / mtforum-crawler.py
Last active March 9, 2022 00:55
Crawls the Minetest forum mod releases section
import urllib, urllib2, re
from xml.dom import minidom
# Made by sfan5 2013 v0.4.09.3
V = "0.4.09.3"
# this script runs through the 'Mod Releases' section and checks the topics for missing things
# Also displays Statistics
# Can also reply to topics when valid session cookies are provided
# Can also move faulty topics to another forum
## <Settings>
@sfan5
sfan5 / netfifo.c
Last active December 16, 2015 16:19
Creates two FIFO files that are piped to a network connection.
/* NetFIFO
* Creates two FIFO files that are piped to a network connection.
* Made by sfan5
* License: CC-BY-SA v3
*
* Example Usage:
* netfifo tcp google.com 80 ififo ofifo &
* echo -e "GET / HTTP/1.1 \r\n" > ififo
* cat ofifo
*/
@sfan5
sfan5 / socks5_serv.py
Last active December 16, 2015 22:59
A SOCKS 5 proxy server
#!/usr/bin/env python2
# SOCKS 5 server
# -*- coding: utf-8 -*-
import socket, struct, time, select, os
from thread import start_new_thread, allocate_lock
# Address to listen on
HOST = ""
# Port to listen on
PORT = 12345
@sfan5
sfan5 / readpng.py
Created June 7, 2013 22:05
Reads a .png file and outputs its sections
#!/usr/bin/env python2
import sys, binascii, struct
def islower(c):
return (c.upper() != c)
def countin(s, c):
i = 0
for b in s:
if b == c:
i += 1
return i
@sfan5
sfan5 / xteapipe.c
Last active December 19, 2015 17:59
De/Encrypts from stdin to stdout using XTEA in OFB mode
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
void xtea_encrypt(unsigned int num_rounds, uint32_t v[2], uint32_t const key[4]) {
unsigned int i;
uint32_t v0=v[0], v1=v[1], sum=0, delta=0x9E3779B9;
for (i=0; i < num_rounds; i++) {
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 3]);
@sfan5
sfan5 / checkpae.sh
Last active December 20, 2015 10:59 — forked from arsdragonfly/checkpae.sh
Resolves the PlayerArgsEnd missing problem(prints the filenames that have it missing)
#!/bin/bash
# Put this into (worldname)/players folder and execute it
find . -type f -not -name "*.sh" | xargs grep -iL PlayerArgsEnd
@sfan5
sfan5 / collectstatic.sh
Last active July 10, 2022 20:20
Collects media files from mods/games and puts them in a media directory, also creates an index.mth file in the MTHS format
#!/bin/bash
###### Options ######
MINETESTDIR=/home/username/minetest
GAMENAME=minetest_game
WORLDDIR=none
MEDIADIR=./media
LEGACY_SYMLINKS=0
# When settings this up be aware that the Minetest client
@sfan5
sfan5 / README
Last active March 9, 2022 00:56
Minetest Forum statistics
Missing Things:
* jquery.min.js ( http://jquery.com/download/ )
* highstock.js ( http://www.highcharts.com/download )
* A cronjob for executing getvals.py
* A webserver with PHP [with SQLite3]
@sfan5
sfan5 / binclock.py
Last active December 27, 2015 22:21
Binary Clock using PyGame; Shows month, day, hour, minute and second
import pygame, time
from pygame.locals import *
OFFCOLOR = (25,25,25)
ONCOLOR = (42,65,89)
BGCOLOR = (36,36,36)
FIELDSIZE = 25
def rect(s, c, r): # We need to use this because it isn't drawn for some unknown reason when using pygame.draw.rect
for xx in range(r[0], r[2]):
@sfan5
sfan5 / mkapng.py
Last active May 28, 2016 21:13
Creates an APNG from PNGs (all PNGs need to have the same IHDR checksum for this to work)
#!/usr/bin/env python
import sys
import struct
import binascii
def mkchunk(tp, data):
return struct.pack("!L", len(data)) + tp + data + struct.pack("!L", binascii.crc32(tp + data) & 0xffffffff)
def getchunk(f, tp):
f.seek(0)