Skip to content

Instantly share code, notes, and snippets.

View fmamud's full-sized avatar
💻

Felipe Mamud fmamud

💻
View GitHub Profile
@fmamud
fmamud / build.gradle
Created May 15, 2016 01:08
TDC 2016 Floripa - Palestra Gradle: o melhor amigo no build do seu software
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.apache.commons:commons-lang3:3.4'
}
@fmamud
fmamud / Ls.groovy
Last active April 22, 2016 15:19
Add unix ls command to groovysh
// open groovysh
// execute :rc ls
import org.codehaus.groovy.tools.shell.CommandSupport
import org.codehaus.groovy.tools.shell.Groovysh
class Ls extends CommandSupport {
protected Ls(final Groovysh shell) {
super(shell, ':ls', ':dir')
}
@fmamud
fmamud / github_pr_count.groovy
Last active July 1, 2016 18:10
Get all closed PR from private repository
@Grab('org.codehaus.gpars:gpars:1.2.1')
import static groovyx.gpars.GParsPool.*
import groovy.json.JsonSlurper
orgid = 0
orgname = 'X'
username = ''
token = 'X'
@fmamud
fmamud / vararg_closure.groovy
Last active March 28, 2016 21:23 — forked from kdabir/vararg_closure.groovy
Closures as Varargs in groovy
def hello (...c) {
c.each {it.call()}
}
hello ({println 'hello'},{println 'namaste'}, {println 'hola'})
@fmamud
fmamud / GetGrabConfig.ps1
Created November 12, 2015 02:32
Get file grapeConfig.xml
iwr -OutFile ~/.groovy/grapeConfig.xml https://gist.githubusercontent.com/lalyos/9366690/raw/grapeConfig.xml
@fmamud
fmamud / configProxy.txt
Created November 12, 2015 02:28
Configure JAVA_OPTS
# Windows
set JAVA_OPTS=-Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=8080
# Unix
export JAVA_OPTS=-Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=8080
@fmamud
fmamud / historylangs.groovy
Last active November 12, 2015 02:01
History languages using Geb and Wikipedia
@Grapes([
@Grab("org.gebish:geb-core:0.12.2"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.45.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.45.0")
])
import geb.Browser
Browser.drive {
go "https://en.wikipedia.org/wiki/Groovy_(programming_language)"
@fmamud
fmamud / HttpFileGet.java
Last active November 9, 2015 17:41
Retrieve an image with a connection via proxy and uses the Java API NIO.2 to save the inputstream in a file on disk.
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Paths;
public class HttpFileGet {
@fmamud
fmamud / FibInfiniteLoop.java
Last active November 9, 2015 17:36
Fibonacci with infinite loop
public class FibInfiniteLoop {
static void fib(long n) {
int a = 0, b = 1;
while (a < n) {
System.out.printf("%d %n", a);
a = b;
b = a + b;
}
}
@fmamud
fmamud / bora.erl
Created October 27, 2015 19:04
Erlang Bora module
-module(bora).
-export([echo/1,fibonacci/1,mysum/1, reverse/1]).
echo(Any) -> Any.
fibonacci(0) -> 1;
fibonacci(1) -> 1;
fibonacci(N) -> fibonacci(N-1) + fibonacci(N-2).