Skip to content

Instantly share code, notes, and snippets.

View jpetitcolas's full-sized avatar

Jonathan Petitcolas jpetitcolas

View GitHub Profile
@jpetitcolas
jpetitcolas / gist:5657280
Created May 27, 2013 14:12
Find biggest files on your Linux filesystem
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
@jpetitcolas
jpetitcolas / .bashrc
Last active December 17, 2015 23:58
My .bashrc
# Utilities alias
alias vi="vim"
alias ack="ack-grep"
alias phpunit="phpunit --colors"
alias ll="ls -al"
alias fuck='sudo $(history -p \!\!)'
@jpetitcolas
jpetitcolas / gist:5704809
Created June 4, 2013 09:40
Prevent Git to commit file mode changes
git config --global core.filemode false
<!DOCTYPE html>
<title>Testing query selectors</title>
<ul id="fruits">
<li>Banana</li>
<li>Peach</li>
<li>Lemon</li>
<li>Pineapple</li>
</ul>
<script>
$("#fruits li:nth-child(3)").css("color", "green");
@jpetitcolas
jpetitcolas / gist:5788244
Created June 15, 2013 14:01
Restart Samba
sudo service smbd restart
sudo service nmbd restart
@jpetitcolas
jpetitcolas / uncompress-phar.php
Created June 25, 2013 07:14
Uncompress a PHAR
// $ php -a
$p = new Phar('/path/to/phar');
$p->extractTo('/my-uncompressed-phar');
@jpetitcolas
jpetitcolas / gist:5898951
Created July 1, 2013 07:22
Delete GIT merged local branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@jpetitcolas
jpetitcolas / gist:5967887
Created July 10, 2013 16:37
Encode/decode a base64 encoded string in PostGreSQL
-- Decoding
SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table;
-- Encoding
SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table;
@jpetitcolas
jpetitcolas / new_gist_file
Created July 15, 2013 18:03
Install Composer in /usr/local/bin
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/
sudo ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
@jpetitcolas
jpetitcolas / install.sh
Created July 18, 2013 07:04
Install PostGreSQL
# Install PostGreSQL
sudo apt-get install postgresql
# Create user
sudo -i -u postgres
psql
CREATE USER username;
ALTER ROLE username WITH CREATEDB;
# Create database