Today I’m going to show you something different.
Qwertee the popular tshirt markeplace is on sale with prices as low as 4 euros. The thing is, it is very annoying to check their prices since they force you to hover each and every tshirt image to reveal the price.
Checking the DOM it was pretty clear what needed to be done to see all the prices at once. So I thought to myself, why not do it in an easy way that more people can enjoy it?
And that’s how I created a tiny chrome extension to check the prices.
How does it work?
The workflow is pretty simple:
- Add three rules to override the display mode of three classes ( price, hover-info and product-price )
- Inject the new style element into <head>
Feel free to check out the code on github and perhaps improve it. It’s free and open source! 🙂
Last Weekend something happened during a morning ride on my bike with some friends and my GPS device turned off for no reason. When I turned it back on I didn’t have the choice of continuing a previous ride and I had to create a new ride.
When I got home and tried to upload the information the Strava I couldn’t find any feature which could let me merge rides and fixe the issue. Instead I ended up having two different rides which really annoyed me.
I started googling around and found someone suggesting that I export the rides and merge the contents of the files. They also suggested that this could be done directly concatenating the files which isn’t true. The trick here is to extract the tracking data from the files (GPX files exported from Strava are XML based) and using the first one as the metadata template.
This was the result of a very simple GPX merger:
#!/usr/bin/env php -q
* StravaMerger © David Gouveia - http://www.davidgouveia.net
* Simple script to merge tracking data from Strava's exported GPX files.
* The backtrack_limit is there because some files could not be parsed due to their size.
* Feel free to raise the limit but be carrefull not to cross the limit.
* Instead of using regex, I could have used a XML cursor to overcome the backtrack limit
* but either I would have to use the php_xml extension or build my own parser.
if ( !trim( $argv ) || trim( !$argv ) || sizeof($argv) < 4 )
die("Usage:\n$argv file1.gpx file2.gpx <fileN.gpx> output.gpx\n" );
for($i = 1; $i < sizeof($argv) - 1; $i++)
echo "Processing $argv[$i] ...";
if (!is_file( $argv[$i] ) ) die( "Invalid file: $argv[$i]\n" );
$gpx = file_get_contents( $argv[$i] );
if ( $i == 1 ) preg_match( "/^(.*?)<trkseg>.*?<\/trkseg>(.*?)$/is", $gpx, $metadata );
preg_match("/<trkseg>(.*?)<\/trkseg>/ims", $gpx, $matches);
if( trim( $matches ) )
$segments .= $matches;
$output_file = $metadata . "<trkseg>" . $segments . "</trkseg>" . $metadata;
file_put_contents($argv[sizeof($argv) -1], $output_file) or die( "Unable to create destination GPX\n" );
print "File " . $argv[sizeof($argv) -1] . " successfully created.\n";
I’m going to put an online version of this script to make it easier to use. 😉
Não sei o que acham do sistema de notificações dos portais da rede IOL mas eu simplesmente não SUPORTO. É extremamente intrusivo, não permite ser desactivado e pior que tudo está sistematicamente a repetir-se (basta fazer um refresh da página e já lá está novamente! *g*).
Felizmente há várias formas de acabar com esta praga, e uma delas é usar o fabuloso plugin AdBlock Plus. Nada mais simples que abrir as opções do plugin no vosso browser favorito (Espero que seja o Firefox ou Chrome :p) e acrescentar as seguintes regras nos filtros:
Et voila! A caixa de noticias irritante desapareceu! 😀
Today I’m going to show you a very small script that allows you to convert any video (as long as it is supported by mplayer) to a GIF.
mplayer is popular media player available for multiple operating systems that support a wide range of video formats. The convert tool is an utility that lets you convert between multiple image formats among other definitions. Since the mplayer takes screenshots using jpeg format, we need to use the convert tool to do the convertion to aGIF format.
Copy the following code, save it to a file and change its permissions (chmod a+x) and you are ready to roll 🙂
shopt -s nocaseglob
if [ ! -d "$TMPDIR" ]
\rm $TMPDIR/* &> /dev/null
if [ $# -lt 3 ]
echo -e "Usage: $0 \nExample:\n$0 00:15:11 10 myvideo.avi 320:240"
if [ -n "$4" ]
echo "Generating screenshots. Please be patitent..."
mplayer -ao null -ss $1 -endpos $2 $3 -vo jpeg:outdir=$TMPDIR/ -vf $SCALE &> /dev/null
if [ -f $TMPDIR/00000001.jpg ]
echo "Finished generating frames. Assembling the animated GIF..."
convert -delay 5 $TMPDIR/*.jpg $TMPDIR/output.gif
echo "Done! Please check the $TMPDIR/output.gif"
echo -e "Oops\! Something went wrong and the frames were not generated. Check your parameters\!"
Just try it and let me know 😉
Estive com uns problemas na empresa relacionados com o sendmail.
Quando nada fazia prever, o sendmail simplesmente crasha começando a recusar activamente todos os pedidos de envio de email.
Criei um script genérico para verificar se uma determinada porta de um servidor está a responder. Basta editar o endereço, porta e opcionalmente definir um timeout máximo para o pedido.
Check For Open Ports - David Gouveia
$address = '127.0.0.1';
$port = 25;
$timeout = 5; //Max time to wait before give up.
$checkport = fsockopen($address, $port, $errnum, $errstr, $timeout);
print "CRITICAL: Host $address at port $port not responding!\n";
print "OK: Host $address at port $port is responding!\n";
Coloquem na pasta dos plugins e não se esqueçam de dar as permissões correctas (755).
Alternativamente podem passar o valor do IP e porta como argumentos via consola.
basta trocar isto :
$address = ’127.0.0.1′;
$port = 25;
por isto :
$address = $argv;
$port = $argv