Skip to content

Instantly share code, notes, and snippets.

View alphabraga's full-sized avatar
🎯
Focusing

Alfredo Braga alphabraga

🎯
Focusing
View GitHub Profile
#This is an simple proxy configuration for Ubuntu (tested only in Ubuntu)
#With this configuration you will shurf on web, use apt or aptitude, use curl
#and use the composer (getcomposer.org)
#If you run some command with sudo you can get some trouble
#If you are in trouble use sudo -E
#In ~/.bashrc put these configs
@alphabraga
alphabraga / list files encoding
Last active December 26, 2015 07:59
Command to list files in the current directory and its enconding. Help in projects where the encoding matter
ls -R ./ | awk '/:$/&&f{s=$0;f=0} /:$/&&!f{sub(/:$/,"");s=$0;f=1;next} NF&&f{ print s"/"$0 }'| xargs file -i
@alphabraga
alphabraga / svndiff
Last active December 26, 2015 21:19
make svn diff with colors!
#make svn diff with colors! like git, but frist youn need install colordiff (via apt-get)
svn diff $* | colordiff | more
@alphabraga
alphabraga / output.php
Last active December 28, 2015 00:29
PHP script with cool console output.
<?php
fwrite(STDOUT, "\0337");
for ($i=0; $i <=100 ; $i+=5)
{
fwrite(STDOUT, "\0338" . "{$i}%complete");
usleep(1000000);
}
@alphabraga
alphabraga / bash_profile
Created November 11, 2013 22:09
Show git branch in prompt/console/terminal
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@alphabraga
alphabraga / gist:7798497
Created December 5, 2013 01:04
Better git log. I get where https://coderwall.com/p/euwpig
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@alphabraga
alphabraga / build.xml
Created January 6, 2014 12:34
Example of build.xml for deploy an php web application. Unit tests API Docs Composer install Compress Send code to server
<?xml version="1.0" encoding="UTF-8" ?>
<project name="ProjectName" basedir="." default="build">
<property name="project-name" value="ProjectName" />
<property name="tag-name" value="." />
<property name="dir-build" value="./build" />
<property name="dir-tests" value="tests" />
<property name="dir-tests-logs" value="tests/_reports" />
<property name="dir-logs" value="./build/logs" />
<property name="dir-app" value="./core" />
@alphabraga
alphabraga / consertar tabelas com problemas
Last active January 3, 2016 12:38
Use o comando para otimizar as tabeles de todos os bancos de dados
mysqlcheck -A -o -u username -p databasename
mysqlcheck --all-databases -o -u username -p databasename
mysqlcheck --all-databases -o -u username -p
<?xml version="1.0" encoding="UTF-8"?>
<project name="DB Post Deploy Restore" default="run">
<property file="properties" />
<!-- find out what db's need to be restored and loop through the process for each -->
<target name="run">
<input propertyname="production.user">(Required) Please enter your ssh user name:</input>
<foreach list="${dbs}" param="db" target="prepare" />
@alphabraga
alphabraga / mssql_connect.php
Created February 28, 2014 13:01
Simple code for connect with mssql
error_reporting(-1);
ini_set('display_errors', 'On');
ini_set("display_errors",1);
ini_set("error_reporting",E_ALL);
$conn = mssql_connect('localhost','user', 'pass');
mssql_select_db('database', $conn);