Skip to content

Instantly share code, notes, and snippets.

Any modern, innovative and worth learning framework or programming
language implements a subset of Smalltalk's features but lacks its
vision and design principles.
@arturoherrero
arturoherrero / monitor-load.sh
Created January 20, 2014 20:37
Email notification for monitor load
#!/usr/bin/env bash
mail="[email protected]"
maxload="9"
hostname=`hostname`
load=`w | head -n1 | awk '{print $10}' | cut -d"," -f1`
if [ $load -gt $maxload ]
then
echo "$hostname - High load found" |
@arturoherrero
arturoherrero / tree
Created March 16, 2014 22:41
Directory structure as tree
#!/usr/bin/env bash
shopt -s globstar
for file in **/*
do
slash=${file//[^\/]}
case "${#slash}" in
0) echo "|-- ${file}";;
1) echo "| |-- ${file}";;
@arturoherrero
arturoherrero / full_path_to_itself
Last active August 29, 2015 13:57
Bash script to get the full path to itself
#!/usr/bin/env bash -e
script_path=$( cd $(dirname $0) ; pwd -P )
@arturoherrero
arturoherrero / gist:eba78d6f0df7b25304c4
Created June 26, 2014 11:09
Reject dangerous changes in Git repositories by default
https://secure.phabricator.com/D7689
+---------------------------------------------------------------+
| * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * |
+---------------------------------------------------------------+
\
\ ^ /^
\ / \ // \
\ |\___/| / \// .\
\ /V V \__ / // | \ \ *----*

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@arturoherrero
arturoherrero / backup.sh
Last active August 29, 2015 14:10
Using rsync to backup my data
rsync -r --delete -h --progress --stats /Users/arturo/Documents /Volumes/Arthur/
@arturoherrero
arturoherrero / remove.sh
Created December 25, 2014 20:41
Delete files
http://stackoverflow.com/q/11289551/462015
# Delete hundred of thousands of files:
$ rm -f /home/apps/ishows/images/
/bin/rm: cannot execute [Argument list too long]
$ find /home/apps/ishows/images/ -type f | xargs /bin/rm
# Delete files that was last accessed n*24 hours ago, e.g. +5 days
@arturoherrero
arturoherrero / gist:136ae94b24482676edc7
Created March 26, 2015 11:49
Rename .css.sass to .sass files
for f in *.css.sass; do
mv "$f" "$(basename "$f" .css.sass).sass"
done
@arturoherrero
arturoherrero / deploy_to_heroku.sh
Last active August 29, 2015 14:23
Deploy Rails app to Heroku environments
#!/usr/bin/env bash
deploy_to_production() {
read -p "Are you sure? " -r
if [[ $REPLY =~ ^(yes|y|Y)$ ]]; then
git push production master && heroku run rake db:migrate -a app-production
fi
}
deploy_to_staging() {