Skip to content

Instantly share code, notes, and snippets.

View afeijo's full-sized avatar
🏠
Working from home

Alessandro Feijó afeijo

🏠
Working from home
View GitHub Profile
@afeijo
afeijo / drush_bash.sh
Created January 25, 2012 13:20 — forked from barraponto/drush_bash.sh
Drush Bash Tricks
# Drush-Bash tricks 0.2
# Copyright Nuvole 2010, Capi Etheriel 2012.
# License: GPL 3, see http://www.gnu.org/licenses/gpl.html
# For a quick start: copy this entire file to the end of the .bashrc
# file in your home directory and it will be enabled at your next
# login. See http://nuvole.org/node/26 for more details and options.
# Drupal and Drush aliases.
# To be added at the end of .bashrc.
@afeijo
afeijo / linux notes
Created June 15, 2012 21:55
Feijo linux notes
#duplicar DVD
k9copy
#medir uso da conexão
bmon
# contar arquivos
ls -R | wc -l
# atualizar postfix aliases
@afeijo
afeijo / .screenrc
Created June 16, 2012 02:39
My .screenrc and .bashrc files
startup_message off
vbell off
autodetach on
#escape /
defscrollback 5000
#caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= %c"
hardstatus alwayslastline
hardstatus string '%{= kG}%{C}Screen: %{c}%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{C} %d-%m %{W}%c %{g}]'
@afeijo
afeijo / mysql.sh
Created June 27, 2012 13:17
Mysql automated backup
#!/bin/bash
##########################################################################
#
# mysql_backups.sh: A shell script to back up all MySQL databases in
# one shot, nightly, and keep a rolling 3 weeks of
# backups hot, online in the backup archive.
#
# Written by David A. Desrosiers
# Contact desrod@gnu-designs.com
# Last updated Jun 27 2012 by Alessandro Feijó @afeijo
@afeijo
afeijo / sites.sh
Created June 27, 2012 13:20
Backup all sites files
#!/bin/bash
# crontab example:
# 2 */12 * * * /bin/sh /home/user/scripts/sites.sh
# Local directory for dump files
LOCALDIR=$HOME/backups/sites
#
#####################################
### Edit Below If Necessary #########
#####################################
@afeijo
afeijo / new_module.sh
Last active December 21, 2015 04:58
Bash script to create the skeleton files for a new Drupal 7 module
#!/bin/bash
# usage: download the script, place it in the modules folder, and execute with your new module name as the parameter.
# bash new_module.sh CustomModule
mkdir $1
cd $1
## .info file
echo "name = $1" > $1.info
@afeijo
afeijo / .vimrc
Last active February 9, 2018 12:25
My VIM configuration
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent
if has("autocmd")
" Drupal *.module and *.install files.
augroup module
autocmd BufRead,BufNewFile *.module set filetype=php
@afeijo
afeijo / .ps1_color
Last active August 14, 2020 01:22
My colored linux prompt
# download me or copy & paste into your root folder, name it .ps1_color
# add the line below into your ~/.profile or ~/.bashrc
# source ~/.ps1_color
# ANSI color codes
RS="\[\033[0m\]" # reset
HC="\[\033[0;1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
@afeijo
afeijo / new drupal project
Created September 20, 2017 01:07
Create a new Drupal project
if [[ $# -eq 0 ]] ; then
echo 'you forgot the new site name'
exit 0
fi
echo 'Creating site $1'
time drush dl --destination=/www --drupal-project-rename=$1
cd $1
mysql -e 'create database $1'
time drush si --account-name=admin --account-pass=102030 --account-mail=feijo@mindcore.org --site-name="$1" --db-url=mysqli://root:1234@localhost/$1 -y
# this works for debian, ubuntu and similar
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab