Skip to content

Instantly share code, notes, and snippets.

View jeandat's full-sized avatar
😁
Coding

Jean DAT jeandat

😁
Coding
View GitHub Profile
@jeandat
jeandat / gitconfig.md
Last active April 7, 2019 11:17
Global git configuration

Git Configuration

I put this configuration on every machine I work on in ~/.gitconfig.

It set the global scope ; equivalent to git config --global <key> <value>.

[user]
	name = jeandat
	email = jean.dat@gmail.com
@jeandat
jeandat / count_lines_number.md
Last active October 16, 2015 12:21
Count lines number in a project

Count lines number in files

By combining the power of git and bash, we can have in an instant an estimation of lines number in a project.

For instance to count lines number in versionned perl files:

$ git ls-files | egrep ".*(driver|core).*pl$" | xargs wc -l
  • git ls-files will only return files versionned which is a first interesting filter.
@jeandat
jeandat / enable_mysql_log_in_table_general_log.sql
Last active October 16, 2015 12:24
It is possible to activate mysql log in order to see all executed queries. Several options : table or file.
-- For those blessed with MySQL >= 5.1.12:
-- If you prefer to output to a table:
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
-- Take a look at the table mysql.general_log
-- If you prefer to output to a file:
@jeandat
jeandat / git_branch_in_prompt.sh
Last active October 16, 2015 12:29
Show the current git branch in prompt (bash) to avoid checking the branch every time or worse use the wrong branch.
# Add current git branch in prompt
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOUR="\[\033[0m\]"
PS1="$GREEN\u@$(hostname)$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$NO_COLOUR\$ "