Skip to content

Instantly share code, notes, and snippets.

View pensierinmusica's full-sized avatar

Alessandro Zanardi pensierinmusica

View GitHub Profile
@pensierinmusica
pensierinmusica / node_updater.sh
Last active March 27, 2016 17:58
Node & npm updater: updates Node JS and all global packages to latest
#!/bin/bash
# This script makes keeping nvm managed Node JS and its global packages up to date a breeze.
# Requires nvm, the Node version manager (https://github.com/creationix/nvm).
source ~/.nvm/nvm.sh # Change according to where your nvm executable is located
export NODE_CURRENT=$(nvm_ls_current)
export NODE_LATEST=$(nvm_remote_versions | grep '^v' | tail -1)
# Update global NodeJS to 'latest'. Migrates all installed global packages into the new Version.
@pensierinmusica
pensierinmusica / gclone.rb
Last active August 29, 2015 13:56
Helper to clone all GitHub repos from a given user
#!/usr/bin/env ruby
### Helper to clone all GitHub repos from a given user (requires Ruby)
# Insert here the GitHub username that you want to clone repos from
username = ""
# Insert your GitHub API access token, if needed (e.g. to access private repos)
#(http://help.github.com/articles/creating-an-access-token-for-command-line-use)
access_token = ""
@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
@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 / network-tuning.conf
Last active January 18, 2024 22:37
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 / 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 / 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 / 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 / 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 / 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