Skip to content

Instantly share code, notes, and snippets.

View marcellodesales's full-sized avatar

Marcello DeSales marcellodesales

View GitHub Profile
> db.SondeDataContainer.stats()
{
"ns" : "netbeams.SondeDataContainer",
"count" : 2419200,
"size" : 1170892976,
"storageSize" : 1358632416,
"nindexes" : 20,
"ok" : 1
}
> db.SondeDataContainer.find( {"observation.pH":4.52, "observation.Battery":1.4} ).explain()
{
"cursor" : "BasicCursor",
"startKey" : {
},
"endKey" : {
},
"nscanned" : 2419200,
@marcellodesales
marcellodesales / build.gradle
Created April 24, 2012 10:55
This is a structure of a gradle project that uses a version-controlled Maven repository.
/*
* The plugins used for this build.
*/
/*
* Provides the compile, test, jar, etc tasks
*/
apply plugin: 'java'
/*
* Generates the Eclipse project files.
@marcellodesales
marcellodesales / output.txt
Created April 25, 2012 06:07
Sqrt function (Newton's method) using the Google's GO language... Exercise 43...
http://tour.golang.org/#43
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating:
To begin with, just repeat that calculation 10 times and see how close you get to the answer for various values (1, 2, 3, ...).
The approximation function for the SQRT function returns the given values for the SQRT(4)...
@marcellodesales
marcellodesales / WordcountTest.go
Created April 25, 2012 06:32
Wordcount implementation on Google's GO
http://tour.golang.org/#44
PASS
f("I am learning Go!") =
map[string]int{"am":1, "I":1, "learning":1, "Go!":1}
PASS
f("The quick brown fox jumped over the lazy dog.") =
map[string]int{"jumped":1, "lazy":1, "dog.":1, "brown":1, "over":1, "the":1, "fox":1, "quick":1, "The":1}
PASS
f("I ate a donut. Then I ate another donut.") =
@marcellodesales
marcellodesales / AccountIntegrationTest.java
Created May 1, 2013 17:15
Gradle, Embedded Tomcat, Jacoco, Java 7: Works for unit tests (JUnit), but does not work for integration tests (RestAssured) when run. * gradle test = works (Unit test class uses the service classes locally) * gradle integrationTest = Does not work, even though Tomcat starts running locally on a daemon thread and it is successfully stopped. Cove…
package com.example.account;
import static com.jayway.restassured.RestAssured.*;
import static com.jayway.restassured.matcher.RestAssuredMatchers.*;
import static org.hamcrest.Matchers.*;
import net.sf.json.JSONObject;
import org.junit.Test;

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@marcellodesales
marcellodesales / force-directed graph-README.md
Last active January 2, 2016 15:39 — forked from mbostock/.block
force-directed graph

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

@marcellodesales
marcellodesales / npm-debug.log
Created October 6, 2014 21:03
Trying to publish a NodeJs module for Nexus 2.10.0 SNAPSHOT: Fails to publish
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'publish' ]
2 info using npm@1.3.10
3 info using node@v0.10.25
4 verbose publish [ '.' ]
5 verbose cache add [ '.', null ]
6 verbose cache add name=undefined spec="." args=[".",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,