Skip to content

Instantly share code, notes, and snippets.

View splitbrain's full-sized avatar
🙃

Andreas Gohr splitbrain

🙃
View GitHub Profile
@splitbrain
splitbrain / TSL45315.py
Created March 24, 2015 18:40
TSL45315
import smbus
from time import sleep
# select the correct i2c bus for this revision of Raspberry Pi
revision = ([l[12:-1] for l in open('/proc/cpuinfo','r').readlines() if l[:8]=="Revision"]+['0000'])[0]
bus = smbus.SMBus(1 if int(revision, 16) >= 4 else 0)
class TSL45315:
VAL_COMMAND = 0x80
REG_CONTROL = 0x00 | VAL_COMMAND
@splitbrain
splitbrain / ickeinit.sh
Created December 3, 2012 14:10
initialises the ICKE wiki repositories
#!/bin/sh
#
# Usage: wget -qO- https://raw.github.com/gist/4195252/ickeinit.sh |sh -s <installdir>
DIR="$1"
if [ -z "$DIR" ]
then
echo "Please give install directory as first parameter."
exit
@splitbrain
splitbrain / test.php
Created January 23, 2012 15:33
mpdf pre/list style bug
<?php
$html = '
<pre style="border: 2px solid #ff0000">test outside list</pre>
<ul>
<li>
a pre<br />
<pre style="border: 2px solid #ff0000">test inside list</pre>
</li>
@splitbrain
splitbrain / float.php
Created January 11, 2012 12:09
mpdf float behaviour
<?php
$html = '<html><head></head><body>
<p><img src="http://php.net/images/php.gif" style="float:left"> this is right to the image</p>
<p>Browsers will show this right to the image as well. mpdf does not</p>
@splitbrain
splitbrain / test.php
Created January 11, 2012 10:52
mpdf backslash bug
<?php
$html = '
<p>Here should be one: \\ and here should be two \\\\</p>
<pre>Here should be one: \\ and here should be two \\\\</pre>
';
include("MPDF53/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
A set of shellscripts and and some HTML/JavaScript to create an 16x16 icon browser.
The icons need to be placed in folders named <setname>/ico/
The URLs to each set can be found in <setname>/ico/url
mkcontactsheet.sh
creates the single image montage and the image map. Run it for each set,
after you put the icons into the correct folders
mkindex.sh
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JOptionPane;
@splitbrain
splitbrain / ios2and.php
Created June 4, 2015 10:51
iOS image assets to Andorid DIP buckets
#!/usr/bin/php
<?php
/**
* Very simple script to convert iOS xcode imageset directories to DIP buckets
* for Android development
*/
if(!isset($argv[2])) {
die("Usage: ios2and.php <ios image asset folder> <android res folder>\n");
}
@splitbrain
splitbrain / keybase.md
Created April 2, 2014 10:03
keybase.md

Keybase proof

I hereby claim:

  • I am splitbrain on github.
  • I am splitbrain (https://keybase.io/splitbrain) on keybase.
  • I have a public key whose fingerprint is 6AAD B781 05DD F7AB 7627 E73B 8EAD 3A2A 7700 A618

To claim this, I am signing this object: