Skip to content

Instantly share code, notes, and snippets.

View dublado's full-sized avatar
📭
Send me a Telegram

Thiago Machado dublado

📭
Send me a Telegram
View GitHub Profile
@dublado
dublado / transparent.php
Created August 21, 2011 23:56
Creating a 1×1 transparent GIF response in PHP
<?php
//saves ip address and timestamp
$str=date("Y-m-d H:i:s") . ": ". $_SERVER['REMOTE_ADDR'] . "n";
file_put_contents("ip_list.txt", $str, FILE_APPEND);
Sourced from:
header("content-type: image/gif");
//43byte 1x1 transparent pixel gif
echo base64_decode("R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
@dublado
dublado / getgist.sh
Last active October 5, 2022 21:55
fazer baixar todos os gists de um usuário
#install and configure gh before to backup 10 gists
gistlimit=10
sample=$(gh gist list --limit $gistlimit | awk '{ print $1 }')
for row in $(echo "${sample}"); do
echo $row
if [ ! -d $row ]
then
git clone https://gist.github.com/$row
@dublado
dublado / ResizeImage.php
Last active October 5, 2022 21:24
resize png keeping transparency
<?php
function Resize($ImageFile,$OriginalFile)
{
$ext=basename($OriginalFile);
$ext=explode(".",$ext);
$ext=array_pop($ext);
$ext=strtolower($ext);
if ($ext=="jpg" or $ext=="jpeg" or $ext=="jpe")
$img=imagecreatefromjpeg($ImageFile);
elseif ($ext=="png")
@dublado
dublado / gist:1477584
Created December 14, 2011 17:34
cria tumbnail a partir de um tamanho
convert NvMj2m.JPG -resize 71x50^ -gravity Center -crop 71x50+0+0 +repage NvMj2m_smallnew.JPG
@dublado
dublado / gist:1477590
Created December 14, 2011 17:36
cria thumbnail preenchendo canvas com cor branca
convert 1.jpg -resize 450x450 -background white -gravity center -extent 450x450 1_g.jpg
for img in *; do convert $img -resize 180x180 -background white -gravity center -extent 180x180 $img|echo $img ; done
@dublado
dublado / gist:1478009
Created December 14, 2011 19:14
downgrade svn
wget http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/change-svn-wc-format.py
chmod +x change-svn-wc-format.py
./change-svn-wc-format.py /my/broken/WC/path/. 1.5 --verbose
@dublado
dublado / gist:1478194
Created December 14, 2011 19:54
batch rename
find ./Music/ \( -name "*\?*" -o -name "*:*" -o -name "*\;*" -o -name "*\**" \) | xargs -n1 -I{} rename ? "" {}
@dublado
dublado / gist:1478434
Created December 14, 2011 20:47
Analytics conversão entre servers
IF LINK onclick="pageTracker._link(this.href); return false;"
IF POST onSubmit="javascript:pageTracker._linkByPost(this)"
@dublado
dublado / gist:1478440
Created December 14, 2011 20:48
wordpress url mudança / change wordpress url
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
@dublado
dublado / gist:1478442
Created December 14, 2011 20:49
analytics e-commerce
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', ' _gaq.push(['_setAccount', 'UA-10895797-1']);']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'0000', // NUMERO GERADO PARA downgrade svn PRE-RESERVA
'', //
'300.39', // VALOR DA RESERVA
'',