how to create an outline on text or digits with gd and php

Like this simple example : gd outline

Sample code :




<?php
$string = "10€";
$font = "./arial.ttf";

// Adapted from http://www.phpbuilder.com/columns/cash20030526.php3?print_mode=1
// &
// http://www.php.net/manual/fr/function.imagettftext.php

header('Content-type: image/png');

// Image building
$im = imagecreatetruecolor(70, 70);

// Colors definitions
$white = imagecolorallocate($im, 255, 255, 255);
$yellow = imagecolorallocate($im, 255, 255, 0);
$purple =  imagecolorallocate($im, 89, 3, 255);
//$grey = imagecolorallocate($im, 128, 128, 128);
//$black = imagecolorallocate($im, 0, 0, 0);
//$red = imagecolorallocate($im, 255, 22, 5);

imagefilledrectangle($im, 0, 0, 70, 70, $white);

function imagettftextoutline(&$im,$size,$angle,$x,$y,&$col,
            &$outlinecol,$fontfile,$text,$width) {
    // For every X pixel to the left and the right
    for ($xc=$x-abs($width);$xc<=$x+abs($width);$xc++) {
        // For every Y pixel to the top and the bottom
        for ($yc=$y-abs($width);$yc<=$y+abs($width);$yc++) {
            // Draw the text in the outline color
            $text1 = imagettftext($im,$size,$angle,$xc,$yc,$outlinecol,$fontfile,$text);
        }
    }
    // Draw the main text
    $text2 = imagettftext($im,$size,$angle,$x,$y,$col,$fontfile,$text);
}

imagettftextoutline(
        $im,           // image location ( you should use a variable )
        20,            // font size
        0,             // angle in °
        0,             // x
        25,            // y
        $yellow,
        $purple,
        $font,
        $string,       // pattern
        2              // outline width
);

imagepng($im);
imagedestroy($im);
?>


MyWi under Linux

For you guys want to use this ( best application ever ) cool application from iPhone, don’t waste your time to configure manually or with wicd, wifi-radar or such. Your best bet is to use networkmanager. Most of modern ( all ?! ) distro have this in packages manager.
For debian/ubuntu :

aptitude install network-manager network-manager-kde

( last package is for kde, but there’s interfaces to xfce4, gnome… too )

That use the simpleness of wifi stuff on Window$ on your Linux boxes.

Enjoy !

Edit:for people using Android phones, since version 2.2 Froyo, it’s implemented by default ( see tethering in your network settings )

Acceder aux tty des guests dans VMware

Pour faire ça, il faut taper sur son clavier avec ses p’tits doigts musclés :
ctrl+alt+espace
garder ctrl+alt enfoncé, relâcher espace, appuyer sur la touche fn désirée et puis on lâche tout :)
Pour passer d’un tty à un autre, pas la peine d’appuyer sur ctrl, donc alt+fn.

Walla !

Perl : Changer le mirroir CPAN dans sa conf

Salut,

aujourd’hui j’essayais d’installer WWW::Search::Pagesjaunes mais cpan.perl.org était « down ».
J’ai donc cherché dans quel fichier les dépots étaient renseignés, et c’est plus difficile qu’il n’y parrait.
Voici donc ma méthode :

Nécessite strace, awk et cpan

Ceci va vous retourner le fichier à éditer :

strace -f -e trace=file cpan -i WWW::Search::Pagesjaunes 2>&1 |
awk -F'"' '($0 ~ "CPAN/(My)?Config.pm.*0$") {print $2; exit}'

( On peux mettre n’importe quel module à la place )

Changer

'urllist' => [q[]],

par

'urllist' => [q[http://cpan.shadowcatprojects.net/]],

Vous pouvez remplacer l’URL du dépot par un de cette liste :
www.cpan.org et aussi mettre plusieurs dépots :

urllist' => qw[http://foo/ftp.cpan.org/ ftp://bar/ftp.cpan.org/ http://base/],

Walla, si ca vous est utile, tant mieux ;)

fax4free, envoi de fax via freebox en CLI ou via menu contextuel

Edit : Le sous projet fax4free a été regroupé dans le projet plus complet cups2freefax : http://redmine.sputnick-area.net/wiki/cups2freefax

voici un script perl qui permet d’envoyer des fax gratuitement via sa freebox ( voir ancien article http://www.sputnick-area.net/wordpress/?p=32 ). Cela prends en compte les modifications apportées sur le site de free en 2009.

wlassistant installation for kde4

Hi,

I’ve found a workaround to install wlassistant on debian likes (debian, ubuntu…) with kde4.
Follow this 2 few steps :

wget "http://ftp.fr.debian.org/debian/pool/main/w/\
wlassistant/wlassistant_0.5.7-2_i386.deb"
dpkg --ignore-depends=kicker -i wlassistant_0.5.7-2_i386.deb

Regards, sputnick.

java.lang.OutOfMemoryError: Java heap space

If you are encountering this problem, the JVM size is too small.

Change value of Xms & Xmx to a higher value.

DEPRECATED proof of concept: Download mp3 stuff from www.deezer.com / PERIME preuve de concept: telecharger les mp3 de www.deezer.com

English speakers:
Hi.

the following bash script extract mp3 right from the flash files from www.deezer.com.

The script need to be executed once (daemon mode) before browsing www.deezer.com, or instead, need to be executed each times you want to add a track (one shot mode).

En Francais :

Salut,

le script bash que voilà, permet de récuperer les mp3 en provenance des flash de www.deezer.com. Il suffit soit de le lancer une fois (mode daemon) avant de naviguer sur www.deezer.com, ou bien au contraire de le lancer a chaque fois que l’on veux ajouter un track (mode one-shot).

	Syntaxe :
	./deezer-colector.bash [-d --direct h]

	Aide :
	--direct -d ne demandent pas pour jouer le son avec mplayer,
	on assume qu'on recupere a la volee direct sur deezer
	et on ne quitte pas quand tous les tracks ont été encodés,
	mais on lance $SCRIPT en mode daemon.
	Dans ce dernier cas, il faut donc quitter avec ^C.

	-h ou --help affiche cette aide

	Divers :
	Le script n'extrait pas deux fois les memes tracks
	sauf si ~/.deezer-collector.bash.log est efface.

Download :
download deezer-collector.bash here

cd command improvement

Hi there.

I’ve coded a little function to put in ~/.bashrc that is implemented using arguments to go in last dirs playing with pushd and popd :
Example 1 :
cd

Example 2 :
cd 2

Example 3 :
cd 3

The function can also cd to a dir if the argument is a file.

cd(){
    # Todo deal with options -L / -P

    shopt -s extglob
    [[ -f "$1" ]] && { pushd 1>/dev/null  "$(dirname "$1")"; return; }

    if [[ "$1" ]]; then
        arg="$1"
        if [[ $arg == -+([[:digit:]]) ]]; then
            arg=$(tr -d '-' <<< "$arg")
            cd "${DIRSTACK[arg]}" &>/dev/null
        else
            pushd "$arg" &>/dev/null
        fi
    else
        cd ~ &>/dev/null
        return
    fi

}

Listening to drum/electro tracks on web records shops without having to click…Ecouter les magasins de disques drum/electro en streaming sans aucun clic…

English speakers :
Hey DJ’s, what is coming next might interest you.Think about all the time you waste clicking/searching/clicking-again/googling just to listen to your records on redeye, chemical-records, juno, toolbox…
A lot of time is wasted just for few music listenings. Moreover, you never know what you’ve already listened to.
As a response, I developed a script bash/perl that does the job. You just need to be running Linux or OSX. Windows stays out of the crowd.
You need bash, perl, curl, wget as dependencies
I bet all those are already installed in a typical OS installation.

Download :
http://stardust.3.free.fr/guest/b4z44r /selector.pl.bash
All comments from dev or users are welcome :)

Records shops :

- redeye
- chemical
- toolbox
- stamina
- juno
- hard to find records

Example :

$ ./selector.pl.bash -h
    Description :
    This script is written ( in bash & perl ) to allow
    playback of remote tracks on web records shops such as
        - Redeye-records
        - Chemical-records
        - Juno
        - Toolbox...

    This script remembers which tracks are already played
    and does not play them again ( later ).
    The following commands are valid during track playback.

    Usage :
        e         display ( echo ) current track ( URL )
        n         next track
        l         last track
        r         rewind
        f         forward
        space     pause
        d         get timestamp of current track
        D         delete track from purchase list
        y         add track to purchase list
        p         display the purchase list
        h         this help message
        v         display the current version of the script

Credits :
Written by sputnick in da FreAkY lApPy lAb (c) 2008
gilles.quenot < AT > gmail < DOT > com
Documentation Contributor : Unop from #bash on freenode

License :
This program is free software; you can redistribute it and/or
    modify it under the terms of version 2 of the GNU
   General Public License published by the Free Software
   Foundation.
(see http://www.gnu.org/licenses/gpl.html).

French speakers

Oyé DJs, ce qui va suivre pourrais vous interesser.
Essayez de compter le temps à cliquer/chercher/recliquer, googler pour ecouter vos disques sur redeye, chemical-records, juno, toolbox (…) alors qu’un script peut s’en charger pour nous?On arrive vite a accumuler beaucoups de temps passé pour pas grand chose hors écoute pure. De plus, on ne sait jamais vraiment ce que l’on a déjà écouté ou pas. En ce sens, j’ai developpé un script bash/perl ( 2 en 1 ) qui permet de faire la blague.
Il suffit d’avoir un ordi sous Linux ou Mac OS X. N’essayez pas sous Window$, ça le fera pas ;)
Il vous faut bash, perl, curl, wget comme dépendances… Mais je ne doute pas que tout ceci fasse déjà partie de la trousse à outil de base de tout libriste qui se respecte ;)

Telecharger :
http://stardust.3.free.fr/guest/b4z44r /selector.pl.bash

( penser a prendre une nouvelle version regulierement, ça bouge pas mal )

Tous retours ( users, dev ) sont les bienvenus ;)

Edit 12.07.2008

A new feature is added :
A search string for “toolbox record shop”.
Example :
new feature for toolsy