Skip to content

Instantly share code, notes, and snippets.

View jbarop's full-sized avatar

Johannes Barop jbarop

View GitHub Profile
@jbarop
jbarop / Main.java
Created February 21, 2019 09:35
filtering collector
package com.company;
import java.util.HashSet;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
@jbarop
jbarop / Vagrantfile
Created April 20, 2018 12:35
postgres vm
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/fedora-27"
config.vm.network "forwarded_port", guest: 5432, host: 5432, host_ip: "127.0.0.1"
config.vm.provision "shell", inline: <<-SHELL
dnf install https://download.postgresql.org/pub/repos/yum/9.5/fedora/fedora-27-x86_64/pgdg-fedora95-9.5-5.noarch.rpm --assumeyes
import java.util.concurrent.TimeUnit.MILLISECONDS
import java.util.concurrent.TimeUnit.NANOSECONDS
interface HasData {
var data: Long
}
class DataImplWithoutPadding : HasData {
@Volatile
@jbarop
jbarop / echo_server.kt
Last active May 25, 2020 20:16
A simple echo server using non blocking IO in Kotlin
import java.net.InetSocketAddress
import java.nio.ByteBuffer
import java.nio.channels.SelectionKey
import java.nio.channels.Selector
import java.nio.channels.ServerSocketChannel
import java.nio.channels.SocketChannel
import java.util.*
/**
* Represents a server.
@jbarop
jbarop / hack.sh
Last active August 29, 2015 14:19 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jbarop
jbarop / clone.sh
Created April 9, 2014 15:37
Clone a PostgreSQL schema from command line
pg_dump -d database -n public -f /tmp/public.sql
psql -d database -c 'ALTER SCHEMA public RENAME TO new_schema;'
psql -d database -c 'CREATE SCHEMA public;'
psql -d database -f /tmp/public.sql
rm /tmp/public.sql
public class MyFancyGwtTestSuite extends GWTTestSuite {
/**
* List of all {@link GWTTestCase}s
*/
private final static Set<Class<? extends GWTTestCase>> allGwtTestCases = new HashSet<Class<? extends GWTTestCase>>();
/**
* Find all {@link GWTTestCase}s in the "<code>com.devbliss.idpool.gwt</code>" package and return
* a suite containing these tests.