Skip to content

Instantly share code, notes, and snippets.

View Kami's full-sized avatar
:octocat:
🐕‍🦺 🦮 🇸🇮 🇺🇦 🇹🇼

Tomaz Muraus Kami

:octocat:
🐕‍🦺 🦮 🇸🇮 🇺🇦 🇹🇼
View GitHub Profile
@Kami
Kami / gist:2820793
Created May 28, 2012 19:25
Swiz - serialization example (output - JSON for public)
JSON (for public):
{
"id": "15245",
"is_active": true,
"name": "server #1",
"agent_name": "some agent",
"opts": {
"option1": "defaultval",
"option2": "defaultval",
"option3": "something"
@Kami
Kami / gist:2802822
Created May 27, 2012 08:19
Swiz - object definitions
var swiz = require('swiz');
var O = swiz.struct.Obj;
var F = swiz.struct.Field;
var defs = [
O('Server',
{
'fields': [
F('id', {'src': 'hash_id', 'desc': 'hash ID for the server', 'attribute': true}),
F('is_active', {'src': 'active', 'desc': 'is the server active?', 'coerceTo': 'boolean'}),
@Kami
Kami / gist:2802679
Created May 27, 2012 07:50
Swiz - validation example (output)
Success:
{ hash_id: 'xkCD366',
active: true,
get_name: 'example',
agent_name: 'my server #1',
get_public_address: '42.24.42.24' }
Error - invalid ip:
{ key: 'ipaddress', parentKeys: [], message: 'Invalid IP'
@Kami
Kami / gist:2802676
Created May 27, 2012 07:49
Swiz - validation example
var swiz = require('swiz');
var Valve = swiz.Valve;
var Chain = swiz.Chain;
var O = swiz.struct.Obj;
var F = swiz.struct.Field;
var defs = [
O('Server',
{
'fields': [
@Kami
Kami / gist:2802640
Created May 27, 2012 07:41
Swiz - serialization example (output - XML)
<?xml version="1.0" encoding="utf-8"?>
<server id="15245" name="server #1">
<is_active>true</is_active>
<agent_name>some agent</agent_name>
<public_ips>
<ip>123.45.55.44</ip>
<ip>122.123.32.2</ip>
</public_ips>
<state>active</state>
<opts>
@Kami
Kami / gist:2802638
Created May 27, 2012 07:39
Swiz - serialization example (output - JSON)
JSON:
{
"id": "15245",
"is_active": true,
"name": "server #1",
"agent_name": "some agent",
"public_ips": [
"123.45.55.44",
"122.123.32.2"
],
@Kami
Kami / gist:2802631
Created May 27, 2012 07:34
Swiz - de-serialization example (output)
{ id: 15245,
name: 'server #1',
is_active: true,
agent_name: 'some agent',
public_ips: [ '123.45.55.44', '122.123.32.2' ],
state: 'active',
opts:
{ option1: 'defaultval',
option2: 'defaultval',
option3: 'something' },
@Kami
Kami / gist:2802627
Created May 27, 2012 07:33
Swiz - de-serialization example
var swiz = require('swiz');
var O = swiz.struct.Obj;
var F = swiz.struct.Field;
var defs = [
O('Server',
{
'fields': [
F('id', {'src': 'hash_id', 'desc': 'hash ID for the server', 'attribute': true}),
F('is_active', {'src': 'active', 'desc': 'is the server active?', 'coerceTo': 'boolean'}),
@Kami
Kami / gist:2802590
Created May 27, 2012 07:23
Swiz - serialization example
var swiz = require('swiz');
var O = swiz.struct.Obj;
var F = swiz.struct.Field;
var defs = [
O('Server',
{
'fields': [
F('id', {'src': 'hash_id', 'desc': 'hash ID for the server', 'attribute': true}),
F('is_active', {'src': 'active', 'desc': 'is the server active?', 'coerceTo': 'boolean'}),
@Kami
Kami / gist:2773733
Created May 23, 2012 07:38
sstableloader log
kami@lucid:~$ /opt/cassandra/bin/sstableloader KEYSPACE
log4j:WARN No appenders could be found for logger (org.apache.cassandra.config.DatabaseDescriptor).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Starting client (and waiting 30 seconds for gossip) ...
Streaming revelant part of <keyspace>/cf1-hc-248-Data.db <keyspace>/cf2-253-Data.db <keyspace>/cf3-hc-29-Data.db to [/127.0.0.1]
progress: [/127.0.0.1 0/30 (0)] [total: 0 - 0MB/s (avg: 0MB/s)]Exception in thread "Streaming:1" java.lang.RuntimeException: java.net.SocketException: Connection reset
at org.apache.cassandra.utils.FBUtilities.unchecked(FBUtilities.java:689)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:34)