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 / 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() {
#!/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 / (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
@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 / 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 / cloudSettings
Last active February 6, 2019 10:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-02-06T10:52:19.643Z","extensionVersion":"v3.2.4"}
@alessandro-fazzi
alessandro-fazzi / cloudSettings
Last active July 25, 2019 09:18
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-07-25T09:18:20.382Z","extensionVersion":"v3.4.1"}
@alessandro-fazzi
alessandro-fazzi / Gemfile
Created July 28, 2021 17:46
LightService Organizer with dependency injection
source 'https://rubygems.org'
gem 'light-service'
gem 'dry-auto_inject'
gem 'pry-byebug'
# CLOSURES IN RUBY Paul Cantrell https://innig.net
# Email: username "paul", domain name "innig.net"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself an unreasonable Ruby test by deleting all
# the comments, then trying to guess the output of the code!
#
# (Naive HR departments, please do not use that idea as a hiring quiz.)
@alessandro-fazzi
alessandro-fazzi / main.rb
Created November 23, 2022 15:31
avo-qh/class_variants without the gem
ButtonClasses = Struct.new(:classes, :variants, :defaults, keyword_init: true) do |klass|
def render(**settings)
result = []
# Add the default classes if any provided
result << classes if classes
# Keep the applied variants so we can later apply the defaults
applied_options = []