Skip to content

Instantly share code, notes, and snippets.

View willgarcia's full-sized avatar
🌴

William Garcia willgarcia

🌴
  • Brisbane, Australia
View GitHub Profile
@willgarcia
willgarcia / gist:4e7e1c1388c097218c02
Created July 3, 2014 20:16
postgres taille schémas
SELECT schemaname, pg_size_pretty(t.taille::bigint) AS taille_table,pg_size_pretty(t.taille_index::bigint) AS taille_index, pg_size_pretty(t.taille_totale::bigint) AS taille_totale_table
FROM (SELECT schemaname,
sum(pg_relation_size(schemaname || '.' || tablename)) AS taille,
sum(pg_indexes_size(schemaname || '.' || tablename)) AS taille_index,
sum(pg_total_relation_size(schemaname || '.' || tablename)) AS taille_totale
FROM pg_tables
WHERE schemaname != 'my_schema'
GROUP BY schemaname) as t ORDER BY taille_totale DESC
@willgarcia
willgarcia / gist:ddabac40f855728900ba
Created June 23, 2014 10:42
regex contains / not contains
^(?=.*contains.*)(?!.*notcontains).*
@willgarcia
willgarcia / gist:ddb4e02657da61b502c0
Last active August 29, 2015 14:02
recursive wget from an http folder
wget -r --no-parent --user=user --password=pass --reject "index.html*" http://mysite.com/uploads/
@willgarcia
willgarcia / gist:7035606aec4c4f4317ea
Last active August 29, 2015 14:02
rsync avec symlinks
rsync -avz -e ssh /var/lib/jenkins root@myhost:/var/lib/jenkins.prod
@willgarcia
willgarcia / gist:5861f559fdeba77422fa
Created May 27, 2014 12:12
upgrade php56 centos
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum -y --enablerepo=remi-php56 --enablerepo=remi update php libicu-last php-intl
@willgarcia
willgarcia / gist:bdc72a4780219c9223bc
Created May 20, 2014 21:01
sed replace in files
find /home/bruno/old-friends -type f -exec sed -i 's/ugly/beautiful/g' {} \;
# installation centos
http://www.liquidweb.com/kb/how-to-install-docker-on-centos-6/
# registry docker
git clone https://github.com/dotcloud/docker-registry.git
cd docker-registry
cp config_sample.yml config.yml
pip install -r requirements.txt
@willgarcia
willgarcia / new_gist_file_0
Created May 12, 2014 14:39
git filter branch
git filter-branch --tree-filter 'rm -rf tests/' --tag-name-filter cat --prune-empty -- --all
git push -f
git push -f --tags
@willgarcia
willgarcia / gist:f8b5a62837aea8558cb6
Last active August 29, 2015 13:59
centos-vm-clean
yum clean all
[ -f /root/.bash_history ] && rm -f /root/.bash_history
find /var/log -type f -name "*.log" | while read f; do echo -ne '' > $f; done;
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
count=`df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}'`;
@willgarcia
willgarcia / gist:d0031ee68f7d0f8b628a
Created April 8, 2014 09:34
migration a directory from a SRC repo to DEST repo
#!/bin/bash
SRC_REPO=[URL SRC]
SRC_DIR=tests
OUTPUT_REPO=[URL DEST]
TMP_DIR=$(mktemp -d)
git clone $SRC_REPO $TMP_DIR;
git filter-branch --prune-empty --subdirectory-filter $SRC_DIR master