Skip to content

Instantly share code, notes, and snippets.

View pensierinmusica's full-sized avatar

Alessandro Zanardi pensierinmusica

View GitHub Profile
@pensierinmusica
pensierinmusica / .bash_profile
Last active December 20, 2015 05:49
My bash profile
# Original version
PATH="/usr/local/sbin:${PATH}"
export PATH
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Make global packages available to Node
export NODE_PATH="/usr/local/lib/node_modules"
@pensierinmusica
pensierinmusica / serverlog.sh
Last active December 20, 2015 07:29
A simple Bash script to log server crashes
## Subsitute "SERVER" with your server app and "FILE" with your filename
if [ ! -d ./logs ]; then
mkdir logs
fi
SERVER FILE 2> ./logs/server-crash.last
printf '\n On ' >> ./logs/server-crash.last
echo `date` >> ./logs/server-crash.last
printf '\n------------------------------------\n' >> ./logs/server-crash.last
cat ./logs/server-crash.last | tee -a ./logs/server-crash.log
@pensierinmusica
pensierinmusica / debiansetup.sh
Last active December 20, 2015 08:39
My debian server set-up script
# Execute this script as root user #
#--- Check that system is up to date ---#
apt-get update
apt-get upgrade
#--- Install desired software ---#
apt-get install sudo
@pensierinmusica
pensierinmusica / nginx-conf
Created August 8, 2013 07:03
Nginx template configuration file for "sites-available"
## Subsitute text between ** with correct values
# the IP(s) on which your server is running.
upstream *nameforservice* {
server 127.0.0.1:*yourport* max_fails=0 fail_timeout=10s;
keepalive 512;
}
# the nginx server instance
server {
@pensierinmusica
pensierinmusica / monit-conf
Last active February 7, 2016 09:55
Monit control file (http://mmonit.com/monit/)
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file and a complete list of statements and
## options, please have a look in the Monit manual.
@pensierinmusica
pensierinmusica / php.ini
Created August 9, 2013 06:08
Standard Apache PHP configuration file
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@pensierinmusica
pensierinmusica / responsive-show-hide.css
Last active December 20, 2015 22:09
A super lightweight library to show and hide elements on HTML based on responsive design.
/*CSS Responsive design show-hide*/
/*
USAGE
The class "res" has two modes, "show" and "hide".
The intended direction is from a larger to a smaller device.
Assign the class "res-show" to any HTML tag when you want the wrapped content
to be hidden on larger devices and shown on smaller ones.
@pensierinmusica
pensierinmusica / network-tuning.conf
Last active August 21, 2024 10:45
Linux sysctl configuration file for NginX
## Place this file in "/etc/sysctl.d/network-tuning.conf" and
## run "sysctl -p" to have the kernel pick the new settings up
# Avoid a smurf attack
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Turn on protection for bad icmp error messages
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Turn on syncookies for SYN flood attack protection
@pensierinmusica
pensierinmusica / debian-node-daemon
Last active January 18, 2016 20:45
Debian daemon init script for node.js app/server
#!/bin/bash
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@pensierinmusica
pensierinmusica / .inputrc
Created February 10, 2014 11:27
Tab autocomplete settings for "~$/.inputrc"
# Tab autocomplete settings for "~$/.inputrc"
set completion-ignore-case on
set show-all-if-ambiguous on
TAB: menu-complete