Skip to content

Instantly share code, notes, and snippets.

View themasch's full-sized avatar

Mark Schmale themasch

View GitHub Profile
\documentclass[DIN,10pt,a4paper,fromphone=true]{scrlttr2}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{rechnung}
\usepackage[utf8x]{inputenc}
\setkomavar{fromname}{Mark Schmale}
\setkomavar{fromaddress}{Ihne 3\\58540 Meinerzhagen}
\setkomavar{fromphone}{02358 699}
\setkomavar{subject}{Rechnung \#001}
\firsthead{\null\hfill
@themasch
themasch / rechnung.sty
Created April 28, 2011 19:51
eine von mir für meinen Bedarf gepatchte Version von rechnung.sty
%%
%% This is file `rechnung.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rechnung.dtx (with options: `package')
%%
%% IMPORTANT NOTICE:
%%
@themasch
themasch / stargate-galaxys.user.js
Created April 28, 2011 22:49
simple quick & dirty userscript for fast planet switch
// ==UserScript==
// @match http://*.stargate-galaxys.com/*
// ==/UserScript==
var elements = new Array(),
currentIndex = 0,
selectElement = document.getElementById('planetid'),
currentValue = selectElement.value,
optionElements = selectElement.getElementsByTagName('option'),
formElement = document.getElementById('form');
for(var i=0;i<optionElements.length;i++) {
@themasch
themasch / getar
Created May 23, 2011 12:25
simple shell script to download a tar archive and extract it directly
#!/bin/sh
CURL=`which curl`
TAR=`which tar`
path=$1
shift
params=$*
$CURL $path | $TAR -x $params
@themasch
themasch / upper.c
Created August 9, 2011 15:13
upper stdin
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#define MAXLINE 4096
@themasch
themasch / mix.js
Created November 6, 2011 16:52
a tiny javascript "colorpicker". use it as a bookmarklet
(function() {
document.cE = document.createElement;
var s = [], div = document.cE('div');
var text = document.cE('input');
var col = [0, 0, 0];
var aE = "attachEvent", oc = "onchange", ok = "onkeyup";
var uB = function() {
var c = text.value.match(/\w\w?/g), n, i;
for(i in c) {
s[i].value = col[i] = parseInt(c[i], 16) || 0;
@themasch
themasch / image_rotation.php
Created November 18, 2011 02:03
rotate an image to the correct orientation
$exif = (int)$image->getImageProperty("exif:Orientation");
switch($exif) {
case 2:
$image->flopImage();
break;
case 3:
$image->rotateImage('black', 180);
break;
case 4:
$image->flipImage();
@themasch
themasch / status.php
Created December 27, 2011 02:04
simple swtor server status (incl. controller boilerplate)
<?php
class ServerStatus
{
private $cachePath = './status.cache';
private $cacheLifetime = 60; // in sekunden
private $statusUrl = 'http://www.swtor.com/de/server-status';
public function dispatch($url)
{
@themasch
themasch / CoolStringClass.php
Created September 18, 2012 16:28
it workz!
<?php
class CoolStringClass
{
public function __construct($content)
{
$this->contents = $content;
}
public function __toString()
@themasch
themasch / index.php
Created October 14, 2012 23:26
CMS in 10 Zeilen
<htmlzeugsblafoo>
<?php
$request = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'];
$dirname = __DIR__ . '/';
$request = preg_replace('(^'.$dirname.')', '', $request);
$page = trim($request, '/');
$path = './content/' . $page . '.html';
$allowed = array_merge(glob('./content/*.html'), glob('./content/*/*.html'));
if(in_array($path, $allowed)) include $path;
else include './content/home.html';