Skip to content

Instantly share code, notes, and snippets.

package ru.d10xa.sample.config;
import org.h2.tools.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import java.sql.SQLException;
@Configuration
buildscript {
repositories {
maven {
def artifactoryUrl = this.hasProperty('artifactory_url') ? artifactory_url : 'http://localhost:8081/artifactory'
url "${artifactoryUrl}/plugins-release"
credentials {
username = this.hasProperty('artifactory_username') ? artifactory_username : 'admin'
password = this.hasProperty('artifactory_password') ? artifactory_password : 'password'
}
name = "maven-main-cache"
package ru.d10xa.hibernate
import org.springframework.data.repository.CrudRepository
import javax.persistence.*
@Entity
class Language {
@Id @GeneratedValue Long id;
String name

Keybase proof

I hereby claim:

  • I am d10xa on github.
  • I am d10xa (https://keybase.io/d10xa) on keybase.
  • I have a public key ASA05WWJEOFJ6lXZ1ihPundpRZm_H8pslAhXxM1P0g5bwgo

To claim this, I am signing this object:

@d10xa
d10xa / AkkaHttpProxyCredentialsMain.scala
Created September 10, 2017 12:52
Akka. Support for HTTP(S) proxies with Authorization
import java.net.InetSocketAddress
import akka.actor.ActorSystem
import akka.http.scaladsl.ClientTransport
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.headers
import akka.http.scaladsl.settings.ConnectionPoolSettings
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.ActorMaterializer
@d10xa
d10xa / eurekasimple.py
Last active December 20, 2017 14:43
Simple client for netflix eureka
import logging
import signal
import sys
import threading
import requests
class Eureka(object):
started = False
import cats.data.EitherNel
import cats.data.NonEmptyList
import cats.implicits._
object SeqEitherNel {
def main(args: Array[String]): Unit = {
def data =
(1 to 5).map {
@d10xa
d10xa / jsoninjson.py
Created January 25, 2019 11:08
Wraps json from stdin into string field
import json, sys; print(json.dumps({sys.argv[1] if len(sys.argv) > 1 else 'data': json.dumps(json.loads(sys.stdin.read()), ensure_ascii=False)}, ensure_ascii=False))
@d10xa
d10xa / Http4sProxyExample.scala
Created March 28, 2020 11:32
http4s + AsyncHttpClient + proxy
import cats.effect.ContextShift
import cats.effect.IO
import cats.effect.Sync
import org.asynchttpclient.DefaultAsyncHttpClientConfig
import org.asynchttpclient.Realm
import org.asynchttpclient.proxy.ProxyServer
import org.asynchttpclient.proxy.ProxyType
import org.http4s._
import org.http4s.client._
import org.http4s.client.asynchttpclient.AsyncHttpClient
import $ivy.`io.get-coursier::coursier:2.0.0-RC6-21`
import coursier._
import java.io.File
import java.io.FileInputStream
import scala.concurrent.ExecutionContext
def extractMainClassName(file: File): Option[String] = {
val jarStream =
new java.util.jar.JarInputStream(new FileInputStream(file))
val mf = jarStream.getManifest
Option(mf.getMainAttributes).flatMap(attrs =>