Skip to content

Instantly share code, notes, and snippets.

View alessandro-fazzi's full-sized avatar
🇺🇦

Alessandro Fazzi alessandro-fazzi

🇺🇦
View GitHub Profile
@alessandro-fazzi
alessandro-fazzi / colorizeMessages.sh
Created July 16, 2012 14:30
colorize bash script's user interactive messages. These are helper functions for scripts
# Text color variables
txtred=$(tput setaf 1) #Red
txtgre=$(tput setaf 2) # Green
txtyel=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtbol=$(tput bold) # Bold
txtres=$(tput sgr0) # Reset
# Helper feedback functions
function info() {
@alessandro-fazzi
alessandro-fazzi / ping_pong.ex
Created October 27, 2017 16:58
Elixir excercise ping pong server
defmodule Match do
def start(max_iterations) when is_integer(max_iterations) and max_iterations > 0 do
spawn(__MODULE__, :init, [max_iterations])
end
def init(max_iterations) do
match = self()
player2 = spawn(Player, :start, [:pong, match])
player1 = spawn(Player, :start, [:ping, match])
@alessandro-fazzi
alessandro-fazzi / (BK).sh
Last active December 14, 2015 12:19
Clone the gist anyway you like in you MediaTemple GridServer and execute it with bash mt_gs_rdiff-backup_installer.sh No params, no questions, just straight. It will install rdiff-backup on your GS instance, enabling you to do remote backups using rdiff-backup. If you have questions or a beer for us twit us @welaika and @Pioneer_Skies
#!/bin/bash
# Clone the gist anyway you like in you MediaTemple GridServer and execute it with
# bash mt_gs_rdiff-backup_installer.sh
# No params, no questions, just straight. Logout and log back after script's ended
# Credits to @weliaka: https://github.com/welaika http://welaika.com http://pisadmin.welaika.com
# Also follow ups on this article are welcome:
# http://pisadmin.welaika.com/post/44637112969/our-definitive-mt-grid-service-backup-solution
cd ~/data/tmp
wget http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-1.2.8.tar.gz
#!/bin/bash
# 20130130
# This is a fork of the original script, adapted to work as bash installer on a
# pre-deployed Centos6 system. It takes args from bash invocation. It is not yet
# documented and all the following comments are originals from RedHat's guys.
# This is *REALLY* a wip and not usable by anyone without a bit of docs.
# We'll write down something when it will a bit tested and refactorized.
# This script configures a host system with OpenShift components.
@alessandro-fazzi
alessandro-fazzi / colorize_bash_echo.sh
Created July 18, 2012 13:12
Unix notes. Personal notes about intresting sysadmin's operations
# Text color variables
txtred=$(tput setaf 1) #Red
txtgre=$(tput setaf 2) # Green
txtyel=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtbol=$(tput bold) # Bold
txtres=$(tput sgr0) # Reset
# Helper feedback functions
function info() {
@alessandro-fazzi
alessandro-fazzi / newvhost.sh
Last active October 6, 2015 06:08
The script is intended to -almost :)- automatically add a new vhost on development env, create a new db and the relative /etc/hosts entry. Sample config is for system LAMP stack but it should be easy to config it for use with LAMPP/MAMPP. Usage: $sudo bash newvhost.sh You want firstly to run $sudo bash newvhost.sh -i $vim ~/.vhostrc and set it u…
#!/bin/bash
# Set a new vhost in lamp for Linux.
# .vhostrc is adaptable for LAMPP: just add in your
# /opt/lampp/etc/httpd.conf a section like this:
#
# # Virtual hosts
# Include etc/extra/sites-enabled/*
#
# and create such dir:
# $sudo mkdir /opt/lampp/etc/extra/sites-enabled/
@alessandro-fazzi
alessandro-fazzi / wpinstall.sh
Created June 15, 2012 14:10
Install latest WordPress release in a specific path wigth a single command
#!/bin/bash
#Install latest WordPress release in a specific path
#and don't bother any more! :)
if [[ ! $1 ]]; then
echo "Please, pass to me destination path as first argument! :)"
exit 1
fi
path=$1
@alessandro-fazzi
alessandro-fazzi / custom_registrations_hooks.php
Created June 8, 2012 10:56
Wordpress Custom registration form width connected custom user profile's meta
<?php
/*
* Queste action aggiungono nel profilo utente i campi personalizzati.
* L'HTML è ovviamente da personalizzare a piacere.
* $user è una variabile passata in automatico dalla action di WP.
* 'custom_info' è la parte personalizzabile...si dovrebbe capire come e dove ;)
***/
add_action( 'show_user_profile', 'my_show_custom_user_info' );
@alessandro-fazzi
alessandro-fazzi / chef-server-virtualbox-bootstrap.sh
Created December 27, 2011 11:04 — forked from bmarini/chef-server-virtualbox-bootstrap.sh
Quick start to setup a chef server on virtualbox (debian)
#!/bin/bash
#
# Install virtualbox:
# - http://www.virtualbox.org/wiki/Downloads
# - Download iso: http://releases.ubuntu.com/10.10/
# - Create a new virtualbox using the iso as the install media
# - Change network adapter to bridged
# - Use ifconfig to get ip address
#
# Once you have a clean install of debien...
@alessandro-fazzi
alessandro-fazzi / bkpdb.conf
Last active September 28, 2015 17:38
Automate dayly/monthly backup of mysql and pgsql dbs
#Inizializzo l'array con tutti i nomi dei DB che mi interessano.
#+Inserire tra le parentesi tonde il nome del database da backuppare
#+rigorosamente uno per riga
#DB MySql
#E' possibile qui usare "all" come magic word per includere tutti i DB presenti. "all" va usata comunque come prima dell'elenco o meglio come unica
dbarray_mysql=(
foo
bar
)