Skip to content

Instantly share code, notes, and snippets.

set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'tpope/vim-fugitive'
Bundle 'altercation/vim-colors-solarized'
Bundle 'scrooloose/syntastic'
Bundle 'spectator/openssl.vim'
@rottenbytes
rottenbytes / doc.md
Last active December 16, 2015 19:39
Changing couchbase moxi port, the undocumented way

why

If you have some memcached servers and want to transition to couchbase, you'll get into trouble because moxi, the couchbase memcached proxy will try to bind port 11211. I didn't find any way to change this port in the official documentation.

How

Finding out how moxi comes to life

ps tells us moxi is spawned by an erlang process, the main couchbase one, ns_server.

┌────────┬──┬──┬──┬───┬─────┬──────┬────┬─────┬─────┬─────┬──────┬─────┬─────┬─────┐
time us sy cl bcl mem rss keys cmd/s exp/s evt/s hit%/s hit/s mis/s aofcs
├────────┼──┼──┼──┼───┼─────┼──────┼────┼─────┼─────┼─────┼──────┼─────┼─────┼─────┤
16:49:01 - - 4 2 502kB 1.90MB 0 - - - - - - 0B
16:49:03 2 3 4 2 502kB 1.89MB 0 643 0 0 - 0 0 0B
└────────┴──┴──┴──┴───┴─────┴──────┴────┴─────┴─────┴─────┴──────┴─────┴─────┴─────┘
16:49:05 1 3 4 2 502kB 1.88MB 0 618 0 0 - 0 0 0B
16:49:07 2 3 4 2 430kB 1.89MB 0 656 0 0 - 0 0 0B
16:49:10 1 4 4 2 502kB 1.89MB 0 631 0 0 - 0 0 0B
16:49:12 2 2 4 1 502kB 1.89MB 0 653 0 0 - 0 0 0B
@rottenbytes
rottenbytes / check_ls.sh
Created November 12, 2013 19:59
Check if the logstash indexing is right on time
curl -s "a.b.c.d:9200/logstash-2013.11.12/_search?pretty" -d '{
"query": {
"match_all": {}
},
"from": 0,
"size": 1,
"fields": [ ],
"sort": {
"@timestamp" : "desc"
}
-- Calculate From : http://munin-monitoring.org/browser/munin/plugins/node.d/postgres_streaming_.in
-- with help : http://www.postgresql.org/docs/9.3/static/monitoring-stats.html#PG-STAT-REPLICATION-VIEW
-- http://eulerto.blogspot.fr/2011/11/understanding-wal-nomenclature.html
create or replace function CalculateNumericalOffset(text)
returns bigint
language sql
as $$
select ('x'||lpad( 'ff000000', 16, '0'))::bit(64)::bigint
* ('x'||lpad( split_part( $1 ,'/',1), 16, '0'))::bit(64)::bigint
-- Calculate From : http://munin-monitoring.org/browser/munin/plugins/node.d/postgres_streaming_.in
-- with help : http://www.postgresql.org/docs/9.3/static/monitoring-stats.html#PG-STAT-REPLICATION-VIEW
-- http://eulerto.blogspot.fr/2011/11/understanding-wal-nomenclature.html
create or replace function CalculateNumericalOffset(text)
returns bigint
language sql
as $$
select ('x'||lpad( 'ff000000', 16, '0'))::bit(64)::bigint
* ('x'||lpad( split_part( $1 ,'/',1), 16, '0'))::bit(64)::bigint
.DS_Store
*.log
Gemfile.lock
java -cp clojure.jar clojure.main -e "(use 'clojure.xml) (->> (java.io.File. \"pom.xml\") (clojure.xml/parse) (:content) (filter #(= (:tag %) :version)) (first) (:content) (first) (println))"
#!/usr/bin/env ruby
require "elasticsearch"
require "getoptlong"
def help()
puts "Usage : snapshot.rb [options]"
puts "Options :"
puts " --host : specifies host to connect to"
puts " --repository : repository for the snapshot. must exist before calling this script"
@rottenbytes
rottenbytes / dumper.rb
Last active August 29, 2015 14:10
quickly dump kibana dashboard
#!/usr/bin/env ruby
require "bundler/setup"
require "elasticsearch"
require "json"
require "getoptlong"
def help()
puts "Usage : dashboard_dumper.rb [options]"
puts "Options :"