This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Script to upload files to S3. | |
* @author Tomas Salazar | |
*/ | |
@GrabResolver(name='jets3t', root='http://www.jets3t.org/maven2', m2Compatible='true') | |
@Grab(group='net.java.dev.jets3t', module='jets3t', version='0.9.0') | |
import org.jets3t.service.impl.rest.httpclient.RestS3Service | |
import org.jets3t.service.security.AWSCredentials | |
import org.jets3t.service.model.* | |
accessKey = 'Cambiar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def command = """cat /var/lib/jenkins/.ssh/id_rsa.pub"""// Create the String | |
def proc = command.execute() // Call *execute* on the string | |
proc.waitFor() // Wait for the command to finish | |
// Obtain status and output | |
println "return code: ${ proc.exitValue()}" | |
println "stderr: ${proc.err.text}" | |
println "stdout: ${proc.in.text}" // *out* from the external program is *in* for groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cardinalToRoman( int num){ | |
def TreeMap map = [1:"I", 5: "V", 10 : "X", 100 :"C"] | |
def getLatestKey = {int nu -> | |
def val = null | |
for (Map.Entry entry : map.descendingMap().entrySet()) { | |
def residuo = nu % entry.key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package atoms.fat.media | |
import grails.converters.JSON | |
import org.joda.time.DateTime | |
class Media implements Serializable { | |
String url | |
String name | |
DateTime dateCreated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BootStrap { | |
def grailsApplication | |
grailsApplication.getArtefacts("Domain").each{dc-> | |
//here we register custom marshallers declared in domain classes | |
if(dc.hasProperty("marshaller")){ | |
dc.clazz.marshaller() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def concurrent(int count, Closure closure) { | |
def values = [] | |
def futures = [] | |
ExecutorService executor = Executors.newFixedThreadPool(count) | |
CyclicBarrier barrier = new CyclicBarrier(count) | |
for (int i = 0; i < count; i++) { | |
futures.add(executor.submit(new Callable() { | |
public def call() throws Exception { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Construir una api REST, para hacer altas, bajas cambios de usuarios, documentar la API. | |
Utilizar las siguientes tecnologias. | |
* Spring Boot | |
* PostgreSQL hibernate o Gorm | |
* Gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boot2docker ip →Get lP | |
docker info | |
docker rm <name> | |
docker stop <name> | |
docker start <name> | |
docker attach <name> | |
docker ps -a | |
docker logs -f <name> | |
docker top <name> | |
docker inspect <name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git@github.com:gextech/json-schema-2-groovy-pojo.git | |
git@github.com:gextech/json-schema-java-mapper-utils.git | |
git@github.com:atomsfat/raml2code.git | |
git@github.com:atomsfat/raml2code-fixtures.git | |
git@github.com:gextech/raml2code-jaxrs-interfaces.git | |
git@github.com:gextech/raml2code-retrofit.git | |
git@github.com:gextech/ram2code-utils.git | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Mobile detect https://gist.github.com/dalethedeveloper/1503252 | |
if(req.http.User-Agent ~ ".*(Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune).*") | |
{ | |
set req.http.X-ua = "mobile"; | |
}else{ | |
set req.http.X-ua = "desktop"; | |
} | |
sub vcl_hash { | |
hash_data(req.http.X-ua + ":" + req.url ); |