Skip to content

Instantly share code, notes, and snippets.

@carlessistare
carlessistare / tuning_nginx_nodejs
Created September 2, 2013 20:34
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
@carlessistare
carlessistare / ssh-key-travis.sh
Last active May 19, 2018 11:39
Output de text to copy to .travis.yml for the splitted secured ssh private key
base64 --wrap=0 ~/.ssh/id_rsa_travis > ~/.ssh/id_rsa_travis_64
cat ~/.ssh/id_rsa_travis_64 | perl -pe 's/(.{100})/$1\n/g' | nl | perl -pe 's/\s*(\d+)\s*(.*)/echo " - secure: `travis encrypt ID_RSA_TRAVIS_$1=$2 --pro`"/' | sh
# OUTPUT
# - secure: "...="
# - secure: "...="
# - secure: "...="
# ...
# - secure: "...="
@carlessistare
carlessistare / gist:c4ae073859721b781d448364a676b501
Created June 20, 2016 09:53
Git prune non existing branches on remote
git fetch -p
@carlessistare
carlessistare / clear-memory-cache.sh
Created October 29, 2013 16:54
Clear memory cache linux
sudo su
sync; echo 3 > /proc/sys/vm/drop_caches
@carlessistare
carlessistare / remove_npm_modules_global.sh
Created October 4, 2013 12:45
This removes all npm modules globally
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
@carlessistare
carlessistare / is_float.js
Created October 2, 2013 15:14
Is float is int
function isInt(n)
{
return n != "" && !isNaN(n) && Math.round(n) == n;
}
function isFloat(n){
return n != "" && !isNaN(n) && Math.round(n) != n;
}
@carlessistare
carlessistare / update_puppet_locally
Created September 17, 2013 16:32
Update puppet catalog locally
sudo puppet apply --modulepath=/opt/node/puppet/modules /opt/node/puppet/manifests/ini.pp
sudo puppet apply --modulepath=/vagrant/puppet/modules /vagrant/puppet/manifests/ini.pp
@carlessistare
carlessistare / Minify-all-windows-ubuntu
Created July 19, 2013 20:28
Minify all windows ubuntu
sudo apt-get install compizconfig-settings-manager
sudo vim /usr/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Terminal=false
Name=Eclipse Kepler
Icon=/opt/eclipse-kepler/icon.xpm
Exec=/opt/eclipse-kepler/eclipse
@carlessistare
carlessistare / install-scribe
Created June 11, 2013 14:46
Install Scribe Server
http://snippets.notmyidea.org/2009/07/30/using-scribe-log-server-with-php/
sudo apt-get install libboost-dev flex bison libtool automake autoconf pkg-config libevent-dev autoconf libtool php5 php-config g++ libcrypto++-dev libssl-dev libboost1.42-all-dev
svn co http://svn.apache.org/repos/asf/thrift/trunk thrift
cd thrift/
Problems with uint32_t