Skip to content

Instantly share code, notes, and snippets.

@pcn
pcn / 1.Find and remove the first node
Last active August 29, 2015 13:55
Testing moving cassandra from CFN to bare
```
$ kcs s create Cassandra CassandraPriamCluster.template PN ACount=2 DCount=2 ECount=2 InstanceCount=1
```
The resulting cluster looks something like this:
```
(python)7235 pn@pn-mbp 11:44 ~/dvcs/github/chef-repo/environments $ hss s pn-cassandra -terminated
0. running 2014-01-31T16:27 i-b281df92 ec2-184-72-147-62.compute-1.amazonaws.com Kerberos cassandra_pn_kcs,base,pn_kcs,pn-cassandra,pn-cassandra
1. running 2014-01-31T16:27 i-b181df91 ec2-54-226-107-205.compute-1.amazonaws.com Kerberos cassandra_pn_kcs,base,pn_kcs,pn-cassandra
2. running 2014-01-31T16:24 i-d0bd21f1 ec2-184-72-73-37.compute-1.amazonaws.com Kerberos cassandra_pn_kcs,base,pn_kcs,pn-cassandra,pn-cassandra
@pcn
pcn / _etc_initramfs-tools_scripts_local-top_assemble-md-arrays
Last active August 29, 2015 13:56
How to raid a cassandra cluster in ec2
#!/bin/sh
# the kernel doesn't seem to automatically
# discover arrays with the >v0.90 md superblock
# format - if I understand this properly.
# So, do this as a script from the initramfs
mdadm --assemble --scan
@pcn
pcn / run
Created February 13, 2014 17:41
carbon-relaj failing on *config* reading
$ lein run -c /tmp/foo
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
^[[BUnable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
Config-file is /tmp/foo
Config-file is /tmp/foo
nil
Exception in thread "main" java.lang.NullPointerException, compiling:(core.clj:34:33)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3457)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:408)
@pcn
pcn / try-a-threading-in-clojure
Last active August 29, 2015 13:56
what does -> do in clojure, when I want to update keys in a map and pass that down? Does it re-bind?
(def file-config-map {"channel-queue-size" "128",
"send-dir" "/tmp/foo/send",
"spool-dir" "/tmp/foo",
"file-rotation-period-ms" "1000",
"temp-dir" "/tmp/foo/temp",
"channel-timeout" "250",
"lineproto-port" "2003",
"target-list" "host-a,host-b,host-c,host-d"})
(defn parse-int [maybe-a-string]
@pcn
pcn / tmux.conf
Last active August 29, 2015 13:57 — forked from spicycode/tmux.conf
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys emacs
set -g history-limit 10000
setw -g mode-keys emacs
setw -g mode-mouse off
@pcn
pcn / .tmux.conf
Created March 11, 2014 04:50 — forked from snuggs/.tmux.conf
# SCREENSHOT EXAMPLE: http://grab.by/bzg3
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
@pcn
pcn / 7050
Last active August 29, 2015 13:57
7150 history
[admin@LV-7050s ~]$ history
1 curl http://nae-dev.statelessnetworks.com/uninstall | /usr/bin/python
2 sudo service ProcMgr reload
3 curl http://nae-dev.statelessnetworks.com/install | /usr/bin/python
4 sudo service ProcMgr reload
5 cat /mnt/flash/.nae_settings
6 nslookup nae-dev.statelessnetworks.com
7 ping 199.59.109.225
8 cd /var/log
9 ls
require 'rbvmomi'
class KnifeVspherePlugin
def data=(cplugin_data)
@mac_address = cplugin_data
end
def reconfig_vm(target_vm)
if (!@mac_address)
abort ("MAC address not provided")
@pcn
pcn / 1. installing_viper
Last active August 29, 2015 13:57
Installing vmware's viper (vmware api bindings for perl)
Installing vmware's viper api for perl on ubuntu 12.04
tar -xzf VMware-VIPerl-1.6.0-104313.x86_64.tar.gz
cd vmware-viperl-distrib/
sudo apt-get install libclass-methodmaker-perl
sudo apt-get install libcrypt-ssleay-perl
sudo apt-get install libsoap-lite-perl
sudo apt-get install libdata-uuid-libuuid-perl
sudo apt-get install zlib1g-dev
sudo apt-get install libxml2
@pcn
pcn / crash
Created May 13, 2014 18:51
Crash in gonetacts in getting in touch with oauth services
$ ./gonetact --cache=~/.gonetact/cache.json --client-id=~/.gonetact/client.json
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x451469]
goroutine 1 [running]:
runtime.panic(0x656d40, 0x948ca8)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
code.google.com/p/goauth2/oauth.(*Transport).RoundTrip(0x0, 0xc210040340, 0x1, 0x424b45, 0x60)
/home/spacey/.gopath/src/code.google.com/p/goauth2/oauth/oauth.go:249 +0x29
net/http.send(0xc210040340, 0x7f1921bc35d8, 0x0, 0x0, 0x0, ...)