Skip to content

Instantly share code, notes, and snippets.

Simone Scarduzio sscarduzio

Block or report user

Report or block sscarduzio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sscarduzio
sscarduzio / docker-compose.yml
Created Sep 18, 2017
Try XPACK with kibana
View docker-compose.yml
version: "2.0"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
ports:
- "9200:9200"
- "9300:9300"
environment:
- discovery.type single-node
volumes:
@sscarduzio
sscarduzio / LDAP.md
Created May 15, 2017
Current LDAP docs
View LDAP.md

LDAP connector

In this example, users credentials are validate via LDAP. The groups associated to each validated users are resolved using the same LDAP server.

Simpler: authentication and authorization in one rule

readonlyrest:
    enable: true
@sscarduzio
sscarduzio / Missing class Error
Created Nov 11, 2016
Readonlyrest SBT Elasticsearch plugin
View Missing class Error
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -Des.path.home=/me/elasticsearch-readonlyrest-plugin/src/test/eshome -Djava.security.policy=/me/elasticsearch-readonlyrest-plugin/src/main/resources/plugin-security.policy -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0
@sscarduzio
sscarduzio / validated.scala
Last active May 31, 2016
Cannot find |@| ( using "org.typelevel" %% "cats" % "0.6.0")
View validated.scala
import cats.data.{Validated, Xor}
import cats.syntax.apply._ // For |@| syntax
import cats.std.list._ // For semigroup (append) on List
object ValidatedExample {
import Xor.{left, right}
import Validated.{invalid, valid}
// We are going to compare the behaviour of Xor and Validated. First we
// define some instances. Then we combine them using flatMap
@sscarduzio
sscarduzio / Main.scala
Created May 15, 2016
Cats Free Monad. One algebra, many interpreters.
View Main.scala
/**
* Created by sscarduzio on 15/05/2016.
*/
package free
object Main extends App {
// Algebra
sealed trait KVStoreA[A]
@sscarduzio
sscarduzio / SearchService.scala
Created Jan 27, 2016
Refactor ensime-server indexer (excerpt)
View SearchService.scala
// Proposed code
override def receive: Receive = {
// ... snip ...
for {
indexed <- Future.sequence(batch.map {
case (_, f) =>
if (!f.exists()) Future.successful(f -> Nil)
else searchService.extractSymbolsFromClassOrJar(f).map(f ->)
})
.recoverWith { case t: Throwable => log.error(s"failed to index batch of ${batch.size} files", t); Future.failed(t)}
@sscarduzio
sscarduzio / GenericMonadTransformer.scala
Last active Dec 21, 2015
Daniel's transformer won't work with future
View GenericMonadTransformer.scala
package test
import scala.util.Try
import scalaz._
import scalaz.std.option._
import scalaz.std.list._
sealed trait CoPConst {
type Point[A]
}
@sscarduzio
sscarduzio / pom.xml
Created Dec 19, 2015
Maven configuration for enabling Elasticsearch integration tests (took me 2 hours)
View pom.xml
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
@sscarduzio
sscarduzio / sbtmkdirs.sh
Last active Jul 13, 2016 — forked from alvinj/sbtmkdirs.sh
A shell script to create an SBT project directory structure
View sbtmkdirs.sh
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# Info: http://alvinalexander.com/sbtmkdirs
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@sscarduzio
sscarduzio / AWS Lambda Python ZIP packager
Last active Feb 16, 2018
When your python script has dependencies, you need to make a ZIP to upload in AWS Lambda.
View AWS Lambda Python ZIP packager
#!/bin/bash
### NB: This script assumes you have set up your project in virtualenv!
# Configure here your python script with dependencies
ACTUAL_PYTHON_SCRIPT=rss.py
WORKDIR_SUFFIX="__LAMBDA_PACK_SCRIPT"
rm -rf $TMPDIR/*$WORKDIR_SUFFIX
WORKDIR=`mktemp -d --suffix $WORKDIR_SUFFIX`
You can’t perform that action at this time.