Skip to content

Instantly share code, notes, and snippets.

View Deltachaos's full-sized avatar

Maximilian Ruta Deltachaos

View GitHub Profile
@Deltachaos
Deltachaos / start.sh
Created October 17, 2011 18:02
sample start script template
#!/bin/bash
PNAME="tail"
PNAMEFULL="Tail"
PPATH="${HOME}"
PBIN="tail -f /var/log/dmesg.log"
PLOG="${PPATH}/${PNAME}.log"
PIDPATH="${PPATH}/${PNAME}.pid"
USESCREEN=0
@Deltachaos
Deltachaos / pdftack.sh
Created March 3, 2012 10:59
Shell Script which uses pdflatex to stitch pdf files together
#!/bin/bash
######################################################################
# Copyright (c) 2012 Maximilian Ruta <mr@xtain.net> #
# #
# Permission is hereby granted, free of charge, to any person #
# obtaining a copy of this software and associated documentation #
# files (the "Software"), to deal in the # Software without #
# restriction, including without limitation the rights to use, copy, #
# modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the #
@Deltachaos
Deltachaos / mediathekdwl.sh
Created March 11, 2012 19:09
Mediathek download
#!/bin/sh
if [ ${#} -eq 0 ]; then
echo "Usage: ${0} URL [filename]"
exit
fi;
URL="${1}"
CONTENT=$(curl "${URL}")
MEDIAURLS=$(echo "${CONTENT}" | egrep '^[[:space:]]+mediaCollection\.addMediaStream\(0,[[:space:]]*2,[[:space:]]*' | sed -r 's/^[[:space:]]+mediaCollection\.addMediaStream\(0,[[:space:]]*2,[[:space:]]*"(.*)",[[:space:]]*"(.*)"\);/\1\n\2/')
MEDIAAPP=$(echo "${MEDIAURLS}" | head -n 1)
@Deltachaos
Deltachaos / install-openvpn-certs.sh
Created March 18, 2012 08:26
Script to Setup OpenVPN
#!/bin/bash
if which lsb_release; then
DISTRIB_ID=$(lsb_release -i | sed -n 's/Distributor ID\:\t//p')
else
echo "You nead to install /etc/lsb-release to run this"
fi;
SERVER="vpn.xtain.net"
DNS="10.8.0.1"
@Deltachaos
Deltachaos / motd.sh
Created March 24, 2012 12:20
MOTD of XTAIN servers
#!/bin/bash
VERSION=0.0.2
LANG=C
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`uname -p`
CPUS=$(cat /proc/cpuinfo | sed -nr 's/^model name[[:space:]]+:[[:space:]]+(.*)/\1/p')
ARCH=`uname -m`
DATE=`date`
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@Deltachaos
Deltachaos / types.js
Created March 27, 2012 20:17
StrongTypes for JavaScript
/**
* StrongTypes (http://github.com/fireflyjs/strongtypesjs)
* Copyright 2012, Maximilian Ruta <mr@xtain.net> (http://deltachaos.de/)
*
* This is a Type System for JavaScript. It is desinged to run
* on node.js and in the Browser. Tested with:
* • Chromium 15
* • Firefox 8
* • Opera 11.52
* • Internet Explorer 9
@Deltachaos
Deltachaos / yt18.html
Created April 24, 2012 21:16
Translate a "18bla, you must login to see this video" Videolink into blupp viewable without login (http://yt18.natenom.name)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>yt18</title>
<style type="text/css">
body {
background-color: #abcdef;
overflow: hidden;
text-decoration: bold;
@Deltachaos
Deltachaos / hover-menu.css
Created April 26, 2012 10:24
DokuWiki hover für Menü Einträge
div#p-x-navigation div.dtree a.nodeFdUrl:hover, div#p-x-navigation div.dtree a.nodeFdUrl:focus, div#p-x-navigation div.dtree a.nodeFdUrl.hover,
div#p-x-navigation div.dtree a.nodeUrl:hover, div#p-x-navigation div.dtree a.nodeUrl:focus, div#p-x-navigation div.dtree a.nodeUrl.hover,
div#p-x-navigation div.dtree a.nodeSel:hover, div#p-x-navigation div.dtree a.nodeSel:focus, div#p-x-navigation div.dtree a.nodeSel.hover,
div#p-x-navigation div.dtree a.node:hover, div#p-x-navigation div.dtree a.node:focus, div#p-x-navigation div.dtree a.node.hover,
div#p-x-navigation div.dtree a.navSel:hover, div#p-x-navigation div.dtree a.navSel:focus, div#p-x-navigation div.dtree a.navSel.hover{
position:absolute;
z-index: 2;
background-color: #fff;
background-color: rgba(255, 255, 255, 0.99);
padding: 5px;
function testCompositeImage() {
echo "<h2>compositeImage</h2>";
$this->ImageMagickCanvas = new ImageMagickCanvasLib(400, 500, 'red');
//$this->ImageMagickCanvas->setBackgroundColor('red');
$this->ImageMagickCanvas->ellipse(10, 10, 100, 200);
$res = $this->ImageMagickCanvas->newLayer(130, 200, 'yellow');
$res->loadFromFile(dirname(__FILE__).DS.'imagick'.DS.'test.jpg');