Skip to content

Instantly share code, notes, and snippets.

@jpcercal
jpcercal / Terminal Proxy Setup
Last active August 29, 2015 14:17
Terminal Proxy Setup
# Credentials
export PROXY_SERVER_IP="proxyserver.com"
export PROXY_SERVER_PORT="3128"
export PROXY_USERNAME="your-user"
export PROXY_PASSWORD="your-password@123"
PROXY_CONFIG="http://${PROXY_USERNAME/\@/%40}:${PROXY_PASSWORD/\@/%40}@${PROXY_SERVER_IP}:${PROXY_SERVER_PORT}/"
# System
export {http,HTTP,https,HTTPS}_{proxy,PROXY}=$PROXY_CONFIG
@jpcercal
jpcercal / gist:e70bc2629a280e7504a0
Created February 20, 2015 21:49
Clear Memcached
echo "flush_all" | nc -q 2 localhost 11211
@jpcercal
jpcercal / gist:049de2d58a6bceaa539b
Last active August 29, 2015 14:05
Git Filemode
git config core.fileMode false
@jpcercal
jpcercal / gist:177022261216831b1351
Last active August 29, 2015 14:05
Import database MySQL with Progress Bar
# apt-get install pv
# pv -t -p <your-filename>.sql | mysql -u <your-username> -p -D <your-database-name>
pv -t -p database.sql | mysql -u root -p -D test
@jpcercal
jpcercal / DefaultController.php
Last active August 29, 2015 14:04
Create date from string
<?php
setlocale(LC_ALL, NULL);
setlocale(LC_ALL, 'pt_BR');
$time = "segunda-feira, 28 de julho de 2014 10h10min07s UTC-3";
$timeParts = explode(',', $time);
$timeParsed = strptime(
@jpcercal
jpcercal / Git Rebase
Created July 17, 2014 21:28
Git Rebase - Caso HWIOAuthBundle - BufferApp
git checkout master && \
git branch -D test2 && \
git checkout -b test2
git ls-files | xargs git update-index --add --chmod=-x
git commit -m "Local mode changed" && \
git checkout -- . && \
git rebase -i HEAD~4