Skip to content

Instantly share code, notes, and snippets.

View FetchMainClassForAllVersions.sc
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 =>
@d10xa
d10xa / Http4sProxyExample.scala
Created Mar 28, 2020
http4s + AsyncHttpClient + proxy
View Http4sProxyExample.scala
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
View my-coursier-channel.json
{
"jadd": {
"repositories": [
"central"
],
"dependencies": [
"ru.d10xa::jadd:latest.stable"
]
},
"fsumo": {
@d10xa
d10xa / jsoninjson.py
Created Jan 25, 2019
Wraps json from stdin into string field
View jsoninjson.py
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))
View SeqEitherNel.scala
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 / eurekasimple.py
Last active Dec 20, 2017
Simple client for netflix eureka
View eurekasimple.py
import logging
import signal
import sys
import threading
import requests
class Eureka(object):
started = False
@d10xa
d10xa / AkkaHttpProxyCredentialsMain.scala
Created Sep 10, 2017
Akka. Support for HTTP(S) proxies with Authorization
View AkkaHttpProxyCredentialsMain.scala
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
View keybase.md

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:

View Application.groovy
package ru.d10xa.hibernate
import org.springframework.data.repository.CrudRepository
import javax.persistence.*
@Entity
class Language {
@Id @GeneratedValue Long id;
String name
View H2ServerConfig.java
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
You can’t perform that action at this time.