Skip to content

Instantly share code, notes, and snippets.

@carlessistare
carlessistare / gist:c4ae073859721b781d448364a676b501
Created June 20, 2016 09:53
Git prune non existing branches on remote
git fetch -p
@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: "...="
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")
@carlessistare
carlessistare / list-ssh-tunnels.sh
Created April 16, 2015 10:21
List SSH tunnels
sudo lsof -i -n | egrep '\<ssh\>'
@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 / 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 / Minify-all-windows-ubuntu
Created July 19, 2013 20:28
Minify all windows ubuntu
sudo apt-get install compizconfig-settings-manager