Skip to content

Instantly share code, notes, and snippets.

View bonifaido's full-sized avatar

Nándor István Krácser bonifaido

View GitHub Profile
@bonifaido
bonifaido / output.txt
Last active May 29, 2018 14:59
Difference between taking something by value or by pointer in Go
&main.Something{}
(*interface {})(0xc42000e1e0)
@bonifaido
bonifaido / kubernetes-client-go-exec.go
Last active May 11, 2018 18:49
This code, I have written at least 3 times, now, I don't want to forget it anymore.
package main
import (
"os"
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/remotecommand"

Keybase proof

I hereby claim:

  • I am bonifaido on github.
  • I am bonifaido (https://keybase.io/bonifaido) on keybase.
  • I have a public key whose fingerprint is ACAF F068 22B1 1BAD 7B9C 3271 02F8 89AD 8E38 8232

To claim this, I am signing this object:

@bonifaido
bonifaido / build-openjdk9-osx.sh
Last active January 25, 2018 04:38
Build OpenJDK 9 Zero(Shark) on Mac OS X Yosemite (bash build-openjdk9-osx.sh)
#!/bin/bash
# Latest Mercurial, OS X Command Line Tools, JDK 8 and libffi are needed
# Tested with OSX 10.10.3 and Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
brew install mercurial
brew install libffi
brew link libffi --force
# only needed if you build the zeroshark variant
# brew install llvm
# brew link llvm --force
hg clone http://hg.openjdk.java.net/jdk9/jdk9
@bonifaido
bonifaido / 9003176.patch
Created May 24, 2013 16:24
Fix for javac 9003176: Class reference duplicates in constant pool
diff --git a/src/share/classes/com/sun/tools/javac/jvm/Pool.java b/src/share/classes/com/sun/tools/javac/jvm/Pool.java
--- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java
+++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java
@@ -28,6 +28,7 @@
import java.util.*;
import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type.ClassType;
/** An internal structure that corresponds to the constant pool of a classfile.
@bonifaido
bonifaido / FixMessageUtil.java
Last active December 16, 2017 20:27
This utility class converts QuickFIX/J Messages into a human readable format.
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
@bonifaido
bonifaido / ExchangerTest.java
Last active October 6, 2017 12:16
Playing with Java Exchangers.
package me.nandork.exchangertest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Exchanger;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@bonifaido
bonifaido / IsolatedClassLoader.java
Created March 2, 2013 19:21
An isolated class loader after http://blog.markturansky.com/archives/21 Usage: javac IsolatedClassLoader.java && java -ea IsolatedClassLoader
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
public class IsolatedClassLoader extends URLClassLoader {
private static URL[] classPathAsURLArray() {
@bonifaido
bonifaido / DelayedDocumentListener.java
Last active December 12, 2015 06:38
Good for autocompletion/searching
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class DelayedDocumentListener implements DocumentListener {
private final Timer timer;
private DocumentEvent lastEvent;
@bonifaido
bonifaido / pom.xml
Last active December 10, 2015 02:08
Simple POM for standalone JARs.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>app</artifactId>
<version>0.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>
</properties>
<dependencies>