Skip to content

Instantly share code, notes, and snippets.

Avatar

Lari Hotari lhotari

  • DataStax
  • Espoo, Finland
  • 07:24 (UTC +02:00)
  • Twitter @lhotari
View GitHub Profile
@lhotari
lhotari / pre-push
Created Apr 14, 2014
git pre-push hook script to prevent unintentional force pushs
View pre-push
#!/bin/bash
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
View manifest.yml
---
applications:
- name: grailsorg-dev
memory: 2G
instances: 1
path: site-2.3.0.war
timeout: 120
buildpack: https://github.com/cloudfoundry/java-buildpack.git
env:
JAVA_OPTS: -Dinitial.admin.password=verysecure -Dload.fixtures=true -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US
View Test3Controller_jdk7.java
15:13:23.848 INFO jd.cli.Main - Decompiling ./build/classes/test/org/codehaus/groovy/grails/web/servlet/mvc/Test3Controller.class
package org.codehaus.groovy.grails.web.servlet.mvc;
import grails.artefact.Artefact;
import grails.artefact.Enhanced;
import grails.web.Action;
import grails.web.controllers.ControllerMethod;
import groovy.lang.Closure;
import groovy.lang.GroovyObject;
import groovy.lang.MetaClass;
View delete_remote_issue_links.groovy
@lhotari
lhotari / gist:8d615fc20aa852247f35
Created Dec 9, 2014
install_vagrant_on_macosx.sh
View gist:8d615fc20aa852247f35
brew install caskroom/cask/brew-cask
brew cask install virtualbox
brew cask install vagrant
vagrant plugin install vagrant-cachier
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-omnibus
View generate_plugins_markdown.groovy
/*
* Script for generating Markdown for
* https://github.com/grails/grails-core/wiki/Travis-CI-status
*/
@GrabResolver(name='grailsCore', root='https://repo.grails.org/grails/core/', m2Compatible='true')
@Grab(group='org.slf4j', module='slf4j-nop', version='1.7.10')
@Grab(group='org.grails', module='grails-datastore-rest-client', version='4.0.0.M3')
import grails.plugins.rest.client.RestBuilder
def githubApiToken = System.getenv('GH_API_TOKEN')
View keybase.md

Keybase proof

I hereby claim:

  • I am lhotari on github.
  • I am lhotari (https://keybase.io/lhotari) on keybase.
  • I have a public key whose fingerprint is 53A8 9613 1119 4A6B 0A44 97D9 E535 CAAF 8594 137E

To claim this, I am signing this object:

@lhotari
lhotari / DiagnosticCommandMBeanHelper.java
Created May 6, 2015
dumping threads in code on Java8+
View DiagnosticCommandMBeanHelper.java
import javax.management.DynamicMBean;
import javax.management.MBeanException;
import javax.management.ReflectionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class DiagnosticCommandMBeanHelper {
public static String threadPrint() throws ReflectionException, MBeanException {
try {
@lhotari
lhotari / PatchedHibernatePluginSupport.groovy
Created Sep 28, 2012
GRAILS-9411 and GRAILS-9412 monkey patch for Grails 2.1.1
View PatchedHibernatePluginSupport.groovy
// src/groovy/grailspatch/PatchedHibernatePluginSupport.groovy
/*
* Copyright 2004-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@lhotari
lhotari / JsonWorkaroundBootStrap.groovy
Created Nov 22, 2013
GRAILS-10823 workaround. add this file to grails-app/conf directory
View JsonWorkaroundBootStrap.groovy
import org.codehaus.groovy.grails.web.json.JSONObject
class JsonWorkaroundBootStrap {
def init = { servletContext ->
// activate workaround for GRAILS-10823
println("activating workaround for GRAILS-10823 - use this only for Grails 2.3.3")
org.springframework.util.ReflectionUtils.findField(JSONObject, "useStreamingJavascriptEncoder").with {
accessible = true
set(null, false)
}