Skip to content

Instantly share code, notes, and snippets.

View akhikhl's full-sized avatar

Andrey Hihlovskiy akhikhl

  • Apple GmbH
  • Berlin, Germany
View GitHub Profile
akhikhl / serialize.groovy
Created November 15, 2014 20:12
Serializable class in groovy script
// The code below produces ClassNotFoundError. How to fix it?
import groovy.transform.ToString
class P2ModuleSource implements Serializable {
private static final long serialVersionUID = 3526473395612776159L
List uris
P2ModuleSource(List uris) {
this.uris = uris
akhikhl / stacktrace.txt
Created June 26, 2014 08:48
Gradle 2.0-rc-2 exception when reloading gradle project under Netbeans
Issue 1
Requested project: /home/ahi/Projects/SampleProject
Stack trace:
org.gradle.tooling.BuildException: Could not run build action using Gradle installation '/home/ahi/.gvm/gradle/2.0-rc-2'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$
akhikhl / build.gradle
Last active August 29, 2015 14:02
Working gradle script for bintray and maven central upload
// This is working gradle script for uploading artifacts of the given project
// to bintray/jcenter and to maven central (via bintray "sync to maven central" function).
// This script can be included from other scripts via `apply from: 'filename'` syntax.
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'bintray'
import org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact
akhikhl / build.gradle
Created June 11, 2014 09:56
Simplest Gretty setup with Spring Boot
buildscript {
ext {
springBootVersion = '1.1.0.RELEASE'
repositories {
akhikhl / XmlSlurper_vs_JDOM2.groovy
Created May 30, 2014 09:26
XmlSlurper vs JDOM2 performance
@GrabExclude(group='jdom', module='jdom')
@GrabExclude(group='org.jdom', module='jdom')
import org.jdom2.Document
import org.jdom2.Element
import org.jdom2.JDOMException
akhikhl / gist:10540351
Created April 12, 2014 15:09
### Keybase proof
I hereby claim:
* I am akhikhl on github.
* I am akhikhl ( on keybase.
* I have a public key whose fingerprint is 3817 213B F592 2F04 4534 C0EC 125B 5BF8 F575 C5C0
To claim this, I am signing this object:
akhikhl / sierpinsky.turtle
Created February 10, 2014 16:44
Sierpinsky Triangle
learn triangle $x {
fw $x
tr 120
fw $x
tr 120
fw $x
tr 120
learn serpinsky $x, $level {
triangle $x
akhikhl /
Created January 4, 2014 18:13
Sorting map by values. Tested in Processing IDE (
import java.util.Comparator;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.List;
class FloatEntryComparator implements Comparator<Map.Entry> {
public int compare(Map.Entry e1, Map.Entry e2) {
return ((Float)e2.getValue()).intValue() - ((Float)e1.getValue()).intValue();
akhikhl / physical_ball_2d_graphics.groovy
Created December 31, 2013 16:53
2d graphics simulation of a ball in gravity field. Energy conservation law is respected.
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
public class Ball extends JComponent {
akhikhl / sort_map_by_values.groovy
Created December 27, 2013 22:39
Sorting hashmap float -> float by values
import java.util.Map;
rand = new Random();
float random(float minX, float maxX) {
rand.nextFloat() * (maxX - minX) + minX
// Note the HashMap's "key" is a String and "value" is an Integer
HashMap<Float,Float> hm = new HashMap<Float,Float>();