Skip to content

Instantly share code, notes, and snippets.

View kanuku's full-sized avatar

Fernando Benjamin kanuku

View GitHub Profile
@schaloner
schaloner / JsonBinder.java
Created March 31, 2017 09:55
Supporting PostgreSQL JSON types in jOOQ using Jackson. Adapted from the GSON example found at https://www.jooq.org/doc/3.9/manual/code-generation/custom-data-type-bindings/
package be.objectify.example.jooq;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Types;
import java.util.Objects;
import com.fasterxml.jackson.databind.JsonNode;
import org.jooq.Binding;
import org.jooq.BindingGetResultSetContext;
import org.jooq.BindingGetSQLInputContext;
@framis
framis / Entity.java
Created November 2, 2016 00:19
JPA to Json Converter
@Entity
public class Entity {
@Id
@GeneratedValue
private Long id;
@Convert(converter = JpaJsonConverter.class)
private Map<String, String> customMap;
}
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@djspiewak
djspiewak / streams-tutorial.md
Created March 22, 2015 19:55
Introduction to scalaz-stream

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

@karmanov
karmanov / gist:499e0dfdf8e5ce119ad4
Created July 20, 2014 08:07
spring.jpa.hibernate.ddl-auto values
validate: validate the schema, makes no changes to the database.
update: update the schema.
create: creates the schema, destroying previous data.
create-drop: drop the schema at the end of the session.
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
@jdennaho
jdennaho / SSHDServer.java
Last active April 18, 2021 14:23
How to use a PublickeyAuthenticator with Apache MINA SSHD
private static final String knownKey = "{SSH2.PUBLIC.KEY}";
public void start() {
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(22999);
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
public boolean authenticate(String username, PublicKey key, ServerSession session) {
if(key instanceof RSAPublicKey) {
@jnape
jnape / FutureEither.scala
Created April 3, 2013 09:03
Making dealing with Future[Either[L, R]] palatable in Scala
package com.thoughtworks.futureeither
import concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import concurrent.duration.FiniteDuration
import java.util.concurrent.TimeUnit
class FutureEither[L, R](private val future: Future[Either[L, R]]) {
def flatMap[R2](block: R => FutureEither[L, R2]): FutureEither[L, R2] = {