Skip to content

Instantly share code, notes, and snippets.

View stelcheck's full-sized avatar

Marc Trudel stelcheck

View GitHub Profile
@stelcheck
stelcheck / gist:6161424
Created August 6, 2013 02:12
Cozycloud / Trying to run Vagrant Manually...
└──╼ vagrant -v
There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:
/Users/mt/Sources/cozymyadmin/Vagrantfile:31: syntax error, unexpected ':', expecting kEND
config.vm.network :private_network, ip: "192.168.50.4"
^
/Users/mt/Sources/cozymyadmin/Vagrantfile:36: syntax error, unexpected ':', expecting kEND
...etwork :forwarded_port, guest: 9101, host: 9101 # Cozy Data ...
^
{
"_id": "31bde843db0e16877560b19b5800c021",
"_rev": "4-f42e5293293b107cbf1bff8934adb450",
"title": "IMG-20121219-WA0004.jpg",
"description": "undefined",
"albumid": "31bde843db0e16877560b19b58008e5f",
"docType": "Photo",
"_attachments": {
"raw": {
"content_type": "image/jpeg",
@stelcheck
stelcheck / gist:6866552
Created October 7, 2013 11:50
set_fact or shell?
- name: If undefined set bootstrap to the first node of the cluster
set_fact:
bootstrap: "{{ groups[cluster_name]|first }}"
when: bootstrap == False or bootstrap is not defined
tags:
- couchbase
- bootstrap
- name: Check if the current machine is part of the cluster
shell: >
@stelcheck
stelcheck / gist:6881400
Created October 8, 2013 08:25
yum and copy
- name: Copy required core collectd RPM packages
copy: >
src={{ item }}-{{ version }}.rpm
dest=/tmp/{{ item }}-{{ version }}.rpm
with_items: packages
tags:
- collectd
- pkgs
- libs
@stelcheck
stelcheck / gist:7723362
Created November 30, 2013 19:24
CouchDB error
[Sat, 30 Nov 2013 19:23:17 GMT] [error] [<0.81.0>] ** Generic server disksup terminating
** Last message in was {'EXIT',#Port<0.1748>,normal}
** When Server state == [{data,[{"OS",{unix,linux}},
{"Timeout",60000},
{"Threshold",100},
{"DiskData",
[{"/",8256952,19},
{"/dev/shm",3756944,0},
{"/var/lib/couchdb",103212320,45}]}]}]
** Reason for termination ==
var ByteBuffer = require('bytebuffer');
var flatbuffers = require('./flatbuffers').flatbuffers;
var schema = require('./schema_generated.js').MyGame;
var count = 100000;
var builder = new flatbuffers.Builder();
var name = builder.createString('Holtzinger');
schema.Monster.startMonster(builder);
schema.Monster.addPos(builder, schema.Vec3.createVec3(builder, 1, 2, 3))
var mySecret = "All your base";
var found = false;
while (!found) {
var b = new Buffer(1000);
var str = b.toString('utf8')
if (str.indexOf(mySecret) > -1) {
found = true;
console.log('Found:', str);
}
@stelcheck
stelcheck / example.js
Last active September 7, 2016 11:34
CIDR from netmask
function hammingWeight(i) {
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return ((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
function netmaskToCIDR(netmask) {
let chunks = netmask.split('.')
if (chunks.length != 4) {
return false;
defmodule Conversation do
use GenFSM
def start_link() do
IO.puts "Starting FSM"
GenFSM.start_link(__MODULE__, nil)
end
def hello(pid) do
GenFSM.send_event(pid, :hello)
---
# This file will be used by the different build scripts and tools
# to define outputs and destination
### GitHub repository
# The GitHub repository information will be used when building the
# documentation and pushing releases
###
github:
# User or organization name