Skip to content

Instantly share code, notes, and snippets.

@tluyben
tluyben / csv2deviceids.pl
Created June 13, 2013 10:38
Convert a CSV to Apple iOS import plist format. The format in the samples from Apple is not complete and thus does not work. This one does (at least it does now).
#!/usr/bin/perl
$file = $ARGV[0];
$skip = $ARGV[1];
$prefix = $ARGV[2];
if (!$file or not -f $file) {
print "Usage: ./csv2deviceids.pl filename.csv [skip first n lines] [prefix]\n";
exit;
}
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.
Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
maximum inquementum tum biguttam egresso scribe.
meo maximo vestibulo perlegamentum da.
da duo tum maximum conscribementa meis listis.
dum listis decapitamentum damentum nexto
fac sic
nextum tum novumversum scribe egresso.
lista sic hoc recidementum nextum cis vannementa da listis.
cis.
@tluyben
tluyben / gist:5604660
Last active December 17, 2015 11:49
Sinusscroller in Monkey
Function UpdateAd()
If Not gameScreen.adsOn Return
If _MouseClick() And _MouseIn(New Vector2D(0, SCREEN_HEIGHT-80), New Vector2D(SCREEN_WIDTH, 80))
LaunchNativeBrowser(ADLINK, ADLINK)
End
End
Function RenderAd()
If Not gameScreen.adsOn Return
SetColor 0,0,0
@tluyben
tluyben / gist:5563410
Created May 12, 2013 12:33
open msx compile zipit
#!/bin/sh
cd /home/openwrt/openmsx-openmsx
export STAGING_DIR=/home/openwrt/src/zipit/openwrt-zipit/staging_dir
export CXX=/home/openwrt/src/zipit/openwrt-zipit/staging_dir/toolchain-arm_v5te_gcc-4.6-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-g++
make clean
rm -fR derived/*
make staticbindist OPENMSX_TARGET_CPU=arm CXX=$CXX OPENMSX_FLAVOUR=zipit LINK_MODE=3RD_STA_MIN
@tluyben
tluyben / gist:5553685
Created May 10, 2013 10:48
/etc/profile.d/zipit-mmc.sh
export PATH=/mnt/mmcblk0p1/usr/bin:/mnt/mmcblk0p1/bin:$PATH
export LD_LIBRARY_PATH=/mnt/mmcblk0p1/usr/lib
@tluyben
tluyben / gist:5553679
Created May 10, 2013 10:46
/etc/config/fstab
config 'mount'
option 'target' '/mnt/mmcblk0p1'
option 'device' '/dev/mmcblk0p1'
option 'fstype' 'ext2'
option 'options' 'ro'
option 'enabled' '1'
option 'enabled_fsck' '0'
@tluyben
tluyben / unpack ipk
Created May 10, 2013 10:30
Unpacking all ipkgs in some root directory
#!/usr/bin/perl
$d = $ARGV[0];
while(glob("$d/*.ipk")) {
chomp;
`tar xf $_`;
`tar pxzf data.tar.gz`;
}
@tluyben
tluyben / gist:5472601
Last active December 16, 2015 17:48
Monkey SoundPool repeat trying in a Thread.
// add on top of gxtkAudio
class PlaySampleThread extends Thread {
SoundPool pool;
gxtkSample sample;
gxtkAudio.gxtkChannel chan;
float lv, rv;
int loops;
public PlaySampleThread(SoundPool pool, gxtkSample sample, gxtkAudio.gxtkChannel chan, float lv, float rv, int loops) {
Field parentCache:GuiVector2D
'summary: This returns the rendering position of this control. The result is presented on Device coordinates. (screen pixels)
Method CalculateRenderPosition:GuiVector2D()
If _cacheRenderPosCalcuation = Null Then _cacheRenderPosCalcuation = New GuiVector2D
_cacheRenderPosCalcuation.SetValues (Position.X, Position.Y)
If parentCache = Null
parentCache = New GuiVector2D()