Skip to content

Instantly share code, notes, and snippets.

@cmpscabral
cmpscabral / gist:876b31dc40071b7a2bb9
Created January 27, 2016 17:21
maagento tools svn
mkdir -p media/content/images/cms-images
mkdir -p webservice/uploads
rm -f app/etc/use_cache.ser
mkdir -p var/cache var/report var/locks var/log var/session var/logging
mkdir -p media/catalog/product
svn revert webservice/.htaccess
svn revert webservice/.htpasswd
svn revert app/etc/local.xml
@cmpscabral
cmpscabral / orderaccesslog.sh
Created January 14, 2016 15:40
order access.log lines by IP
cat access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20
@cmpscabral
cmpscabral / mysql_import.sh
Last active January 11, 2016 19:20
mysql import from tar.gz
# tar.gz
tar -xzOf your_db_dump.sql.tar.gz | mysql -u USERNAME -pPASSWORD your_database
# sql.gz
pv mydump.sql.gz | gunzip | mysql -u root -p
watch -n 5 --differences "mysql -u root -p -e 'show processlist'"
@cmpscabral
cmpscabral / mysql_dump_all.sh
Created December 29, 2015 19:13
dump and restore all databases
mysqldump -u root -p --opt --all-databases > alldb.sql
mysqldump -u root -p --all-databases --skip-lock-tables > alldb.sql
@cmpscabral
cmpscabral / newmac.sh
Created November 27, 2015 15:44
new mac configuration file
#!/bin/sh
# _
# | |
# __ _____ ___ __| | ___
# \ \/ / __/ _ \ / _` |/ _ \
# > < (_| (_) | (_| | __/
# /_/\_\___\___/ \__,_|\___|
/Users/mg/Dropbox/mg/setup.sh
zip -r output.zip inputdir -x "**/.svn**"
@cmpscabral
cmpscabral / what-forces-layout.md
Created October 8, 2015 10:46 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@cmpscabral
cmpscabral / open_files_processes.sh
Created July 27, 2015 23:36
open files/processes
watch -n 5 --differences “lsof -n -p 25894 | grep -v /home/lib/mysql”
@cmpscabral
cmpscabral / removesvn.sh
Created July 21, 2015 22:25
remove svn files
find . -name .svn -print0 | xargs -0 rm -r