Skip to content

Instantly share code, notes, and snippets.

View marcellodesales's full-sized avatar

Marcello DeSales marcellodesales

View GitHub Profile
mdesales@ubuntu [11/30/201423:36:56] ~/dev/github-intuit/docker-images/platform/mule-3.4/source (master *) $ go run trying.go
Will start downloading file1... It might take 3787
Will start downloading file2... It might take 8639
Will start downloading file3... It might take 5633
FINISHED: file1 downloaded in 3787
FINISHED: file3 downloaded in 5633
FINISHED: file2 downloaded in 8639
[file1 downloaded in 3787 file3 downloaded in 5633 file2 downloaded in 8639]
8.641097774s
#!/usr/bin/env python
# Compare a file on S3 to see if we have the latest version
# If not, upload it and invalidate CloudFront
import fnmatch
import os
import boto
import pprint
import re
@marcellodesales
marcellodesales / formatted.sh
Last active November 14, 2023 19:22
One-liner REST server using netcat - nc
rm -f out
mkfifo out
trap "rm -f out" EXIT
while true
do
cat out | nc -w1 -l 1500 > >( # parse the netcat output, to build the answer redirected to the pipe "out".
export REQUEST=
while read line
do
line=$(echo "$line" | tr -d '[\r\n]')
@marcellodesales
marcellodesales / Auth value incorrect
Last active August 29, 2015 14:07
npm publish on NEXUS 2.10.0 - Packets captured using Wireshark
Based on https://www.ietf.org/rfc/rfc2045.txt, something needs to be transformed.
$ echo 'admin:admin123' | openssl base64
YWRtaW46YWRtaW4xMjMK
$ Accepted:
YWRtaW46YWRtaW4xMjM=
Last character used was "=".
@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 [email protected]
3 info using [email protected]
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,
@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.

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 / 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;
@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.") =