Skip to content

Instantly share code, notes, and snippets.

@raphw
raphw / Main.java
Last active May 9, 2018 19:07
Method handle invoke special
package main;
import bar.Bar;
import qux.Qux;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Proxy;
import java.util.function.Consumer;
@mebowler
mebowler / consumer.groovy
Last active July 7, 2020 17:34
Kafka Producer/Consumer Reconciliation - Useful for testing cluster reconfiguration ensuring no lost messages.
#!/usr/bin/env groovy
@Grapes([
@Grab('com.h2database:h2:1.3.176'),
@Grab('org.apache.kafka:kafka_2.11:0.10.2.0'),
@GrabConfig(systemClassLoader=true)
])
import java.sql.*
import groovy.sql.Sql
@toomasv
toomasv / regex.red
Last active November 20, 2017 18:22
Regex to parse translator
Red [
Author: "Toomas Vooglaid"
file: "%regex.red"
Purpose: {Regex to parse converter}
History: {Started: 2017-05-09
v.0.1: 2017-05-12 -- first working version with:
start `^^` and end `$` anchors,
non-capturing groups (one level) with alterns,
quantifiers (possessive),
some character-classes.
@raphw
raphw / WeakeningAgent.java
Last active January 23, 2021 11:40
A Java agent for fixing exports for an app that is not yet Java 9 aware.
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Layer;
import java.lang.reflect.Module;
import java.util.*;
public class WeakeningAgent {
public static void premain(String argument, Instrumentation instrumentation) {
boolean full = argument != null && argument.equals("full");
Set<Module> importing = new HashSet<>(), exporting = new HashSet<>();
@yusugomori
yusugomori / Dropout.py
Last active March 13, 2023 05:46
Dropout Neural Networks (with ReLU)
# -*- coding: utf-8 -*-
import sys
import numpy
numpy.seterr(all='ignore')
'''
@marc0der
marc0der / versions.groovy
Last active August 29, 2015 14:23
Add all versions of Groovy on BinTray to GVM/SDKman
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
import wslite.rest.*
def consumerKey = "CONSUMER_KEY"
def consumerToken = "CONSUMER_TOKEN"
def host = "https://bintray.com"
def client = new RESTClient(host)
def releaseClient = new RESTClient("https://gvm-vendor-dev.herokuapp.com")
@graemerocher
graemerocher / migrate-jira-to-github-issues.groovy
Last active November 19, 2024 15:23
JIRA to Github Issues Migration Script
@Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='1.1.0')
@Grab(group='joda-time', module='joda-time', version='2.7')
import wslite.rest.*
import org.joda.time.*
import org.joda.time.format.*
import groovy.xml.*
import groovy.json.*
import static java.lang.System.*
import groovy.transform.*
@vmarcinko
vmarcinko / UndertowServer.java
Created April 28, 2015 06:21
Undertow-Spring MVC integration
package vmarcinko.undertow;
import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.PathHandler;
import io.undertow.server.handlers.RedirectHandler;
import io.undertow.server.handlers.resource.FileResourceManager;
import io.undertow.servlet.Servlets;
import io.undertow.servlet.api.DeploymentInfo;
@mraible
mraible / build.gradle
Created April 17, 2015 23:20
build.gradle with watch
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.5'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
classpath 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.4'
@elifarley
elifarley / 0: jvm-options-java8.conf
Last active January 5, 2024 07:52
JVM options to maximize performance
# See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html
# See https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html
# See https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm
# See http://normanmaurer.me/blog_in_progress/2013/11/07/Inline-all-the-Things/
# See http://stas-blogspot.blogspot.com.br/2011/07/most-complete-list-of-xx-options-for.html
# -XX:+LogCompilation
# -XX:+PrintInlining
-Dfile.encoding=UTF-8