Skip to content

Instantly share code, notes, and snippets.

@hutt
hutt / XML Language file test
Created November 7, 2012 20:25
XML Language file test for Sharebase lang files
<?xml version='1.0'?>
<lang>
<exp>
<key>upload_file</key>
<tr>Datei hochladen</tr>
</exp>
<exp>
<key>create_file</key>
<tr>Datei anlegen</tr>
</exp>
@hutt
hutt / Redirect international visitors
Created November 10, 2012 21:25
Redirect other-speaking visitors to other directories/websites.
<?php
if(!isset($_COOKIE['lang'])){
$lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
switch($lang) {
case 'de':
$redirect = '/de';break;
case 'en':
$redirect = '/en';break;
default:
$redirect = '/en'; }
@hutt
hutt / Sharebase translation functions
Created November 13, 2012 15:15
Sharebase's translation functions.
function selectLangfile(){
$dir = opendir("sources");
while ($element = readdir($dir)) {
if (($element != '.') && ($element != '..')) {
if ((is_file('sources/'.$element)) && (substr('sources/'.$element, -3) == 'xml')) {
$langfile[] = $element;
}
}
}
closedir($dir);
@hutt
hutt / gist:4326259
Created December 18, 2012 08:49
Sortieralgorithmus (Java)
/**
*
* Nope.
*
* @version 1.0 vom 18.12.2012
* @Jannis Hutt
*/
import java.io.*;
public class sort12zufall {
public static void main(String[] args) throws IOException {
@hutt
hutt / Twitter easy API functions
Last active December 11, 2017 05:16
Some functions using the Twitter API (v1.1) e.g. getting followers count, tweets, background image etc. Written in PHP; use it and have fun!
function get_followers_count($username) {
$cache_file = CACHEDIR . 'twitter_followers_counter_' . md5 ( $username );
if (is_file ( $cache_file ) == false) {
$cache_file_time = strtotime ( '1984-01-11 07:15' );
} else {
$cache_file_time = filemtime ( $cache_file );
}
@hutt
hutt / textBinASCII.php
Last active March 17, 2024 22:29
Convert string to binary / binary to string
<?php
/*******************************
*
* Convert Text to Binary ASCII
* oder so.
*
*******************************/
header("Content-Type: text/html; charset=utf-8");
function textBinASCII($text){
$bin = array();
include reg51.inc
Init: mov A, #11111111b
mov P1, #11111111b; alle Zeilen dauerhaft high, mit Spalten wird Rotation gesteuert
Eins: mov A, #11110111b
Start: mov P0, A; erste Spalte muss low sein, da nur wenn Spalte low und Zeile high ist dann leuchtet Licht
RR A; Akku nach rechts rotieren
mov P0,A; Akku in P0
CJNE A, #0F7h, Start; Vergleiche A mit 1111 0111d wenn ungleich nach Start springen
khwz()
Prgm
:"init"
Lbl init
:"Zum IO Fenster wechseln"
Disp ""
:"Alles loeschen"
ClrIO
ClrErr
ClrGraph
@hutt
hutt / gist:fe7a5ddf840abcc06fcd
Created April 26, 2015 17:57
Neuer GnuPG Key.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
# Neuer GnuPG Key
Ich, Jannis Hutt, habe meinen GPG Key gewechselt.
Der alte Key 0xDE982BAE0C8061C8, welcher als Hauptidentität die E-Mail Adresse privat@jannishutt.de nutzte, wird von un an nicht mehr benutzt.
Stattdessen benutze ich von nun an den Key 0x9BAD2EA15BCF1DFF.

Keybase proof

I hereby claim:

  • I am hutt on github.
  • I am hutt (https://keybase.io/hutt) on keybase.
  • I have a public key ASAfDTiR_0EYNCmkVoFox6ahBKKpTF_vQeCYs6ss-8aESwo

To claim this, I am signing this object: