Skip to content

Instantly share code, notes, and snippets.

@carlessistare
carlessistare / ssh-key-travis.sh
Last active May 19, 2018
Output de text to copy to .travis.yml for the splitted secured ssh private key
View ssh-key-travis.sh
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: "...="
View get-couchbase-keys-from-file.coffee
Couchbase = require 'couchbase'
fs = require('fs')
readline = require('readline')
stream = require('stream')
async = require('async')
elasticsearch = require('elasticsearch')
host = "xxx"
cluster = new Couchbase.Cluster("couchbase://#{host}")
couchbase = cluster.openBucket("users")
View list-ssh-tunnels.sh
sudo lsof -i -n | egrep '\<ssh\>'
View clear-memory-cache.sh
sudo su
sync; echo 3 > /proc/sys/vm/drop_caches
@carlessistare
carlessistare / remove_npm_modules_global.sh
Created Oct 4, 2013
This removes all npm modules globally
View remove_npm_modules_global.sh
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
View is_float.js
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 Sep 17, 2013
Update puppet catalog locally
View update_puppet_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 / tuning_nginx_nodejs
Created Sep 2, 2013
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
View tuning_nginx_nodejs
# 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.
View Minify-all-windows-ubuntu
sudo apt-get install compizconfig-settings-manager