Skip to content

Instantly share code, notes, and snippets.

View ilopmar's full-sized avatar

Iván López ilopmar

  • VMware
  • Madrid, Spain (Remote)
  • X @ilopmar
View GitHub Profile
@rponte
rponte / mybatis-scriptrunner-sample.java
Last active August 28, 2018 09:16
MyBatis ScriptRunner Example
// http://mybatis.googlecode.com/svn/trunk/src/test/java/org/apache/ibatis/submitted/sptests/SPTest.java
Class.forName("org.hsqldb.jdbcDriver");
conn = DriverManager.getConnection("jdbc:hsqldb:mem:sptest", "sa", "");
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/sptests/CreateDB.sql");
ScriptRunner runner = new ScriptRunner(conn);
runner.setDelimiter("]");
runner.setLogWriter(null);
@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@willryan
willryan / MyBaseGebTest.groovy
Created October 11, 2012 16:40
Geb DB test helpers
abstract class MyBaseGebTest extends GebReportingTest {
SessionFactory sessionFactory = ApplicationHolder.application.mainContext.sessionFactory
def inTransaction(closure) {
inNewSession {
TransactionRunner.getInstance().runInNewTransaction(closure)
}
}
def inNewSession(closure) {
@rcmorano
rcmorano / mu
Last active December 14, 2015 07:49
'mu' is a simple script to get real memory usage (not VSZ, not RSS but PSS) of a given PID or process pattern (uses pgrep).Check these didactic URLs for a nice explanation about memory consumption [1] and cache [2]:[1] http://emilics.com/blog/article/mconsumption.html[2] http://blog.scoutapp.com/articles/2010/10/06/determining-free-memory-on-lin…
#!/bin/bash
#
# Copyright (C) 2013, Roberto C. Morano <rcmova@gmail.com>
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
@rcmorano
rcmorano / mutop
Last active December 14, 2015 07:49
'mutop' uses my other script 'mu' to sort any process listed in "ps aux" by memory usage. The last, the most [memory consumer]. COPY PASTE TO DOWNLOAD: wget -O /tmp/mutop.tgz https://gist.github.com/rcmorano/5053427/download; sudo mv /tmp/$(tar zxvf /tmp/mutop.tgz -C /tmp |grep mutop) /usr/local/bin/; sudo chmod +x /usr/local/bin/mutop
#!/bin/bash
#
# Copyright (C) 2013, Roberto C. Morano <rcmova@gmail.com>
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / BootStrap.groovy
Last active December 19, 2015 14:58
How to integrating Vert-x in Grails using a PlatformManager. (Test)
//grails-app/conf/BootStrap.groovy
import org.vertx.java.platform.PlatformLocator
class BootStrap {
def vertxPlatformManager
def init = { servletContext ->
vertxPlatformManager = PlatformLocator.factory.createPlatformManager()
URL[] classpath = [new File('./src/verticles').toURI().toURL()]
vertxPlatformManager.deployVerticle(
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.support import ui
from selenium.common.exceptions import NoSuchElementException, TimeoutException
def create_browser():
profile = webdriver.FirefoxProfile()
profile.set_preference('permissions.default.image', 2)
profile.update_preferences()
return webdriver.Firefox(profile)
@danveloper
danveloper / Application.groovy
Created October 10, 2013 18:00
An example of using the Spring Integration Groovy DSL with a JMS channel adapter to an embedded ActiveMQ JMS broker
package com.danveloper.springboot
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.integration.dsl.groovy.IntegrationContext
import org.springframework.integration.dsl.groovy.builder.AbstractIntegrationBuilderModuleSupport
@robpatrick
robpatrick / CreatedAndLastUpdated.groovy
Created November 3, 2013 12:47
The Grails ORM technology - GORM, has the ability to auto-timestamp GORM objects with the date and time they were created and last updated, details can be found here: http://grails.org/doc/latest/guide/GORM.html#eventsAutoTimestamping Our developers didn't like to have to litter our GORM code with these attributes so I created an AST transformat…
package com.alkalinezoo.transform
import java.lang.annotation.Target
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import org.codehaus.groovy.transform.GroovyASTTransformationClass
/**
* Simple annotation that when used on a class adds two new fields of type {@code java.util.Date}
@mariogarcia
mariogarcia / GradleGroovyConsole
Created February 4, 2014 08:39
Launching a Groovy Console with your Gradle classpath
task(console, dependsOn: 'classes', type: JavaExec) {
main = 'groovy.ui.Console'
classpath = sourceSets.main.runtimeClasspath
}