Skip to content

Instantly share code, notes, and snippets.

View davidepedranz's full-sized avatar

Davide Pedranz davidepedranz

View GitHub Profile
@GaryRogers
GaryRogers / logstash.config
Last active December 6, 2016 16:09
Logstash Redis warning pattern
# Redis Debug Config to match on normal and warning Redis log lines.
input {
stdin { codec => "plain" }
}
filter {
grok {
# Extends the normal redis pattern to account for warnings as well.
match => [ "message", "\[%{POSINT:pid}\] %{REDISTIMESTAMP:timestamp} # %{LOGLEVEL:level} %{GREEDYDATA:mymessage}"]
match => [ "message", "\[%{POSINT:pid}\] %{REDISTIMESTAMP:timestamp} \* %{GREEDYDATA:mymessage}"]
@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
@grabbou
grabbou / .travis.yml
Created August 19, 2014 08:27
Code coverage integration for CodeClimate / TravisCI & Mocha
language: node_js
node_js: ["0.11", "0.10"]
env:
CODECLIMATE_REPO_TOKEN: <your_token>
before_script:
- npm install -g istanbul
- npm install -g mocha
- npm install -g codeclimate-test-reporter
@kachayev
kachayev / concurrency-in-go.md
Last active May 4, 2025 05:48
Channels Are Not Enough or Why Pipelining Is Not That Easy
@deanishe
deanishe / workflow-install.py
Last active July 29, 2024 18:06
Script to install/symlink Alfred workflows. Useful for workflow developers.
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 <[email protected]>.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
@lalyos
lalyos / README.md
Last active February 28, 2023 03:38
proxy docker /var/run/docker.sock to port 2375 with socat

The new Docker daemon uses port: 2376 with TLS enable by default. Sometimes I want to play with curl on the old plain http port 2375. The trick is: use socat in a container to proxy the unix socket to a real port.

docker run -d \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --name docker-http \
  deb socat -d -d TCP-L:2375,fork UNIX:/var/run/docker.sock
@praseodym
praseodym / AESGCMUpdateAAD2.java
Last active May 13, 2024 10:20
JDK8 AES-GCM code example
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits
@denji
denji / golang-tls.md
Last active May 14, 2025 16:19 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@noelwelsh
noelwelsh / Example.scala
Created February 20, 2015 16:06
Robust Error Handling in Scala
import scalaz.\/
import scalaz.syntax.either._
object Example2 {
// This example simulates error handling for a simple three tier web application
//
// The tiers are:
// - the HTTP service
// - a user authentication layer
// - a database layer
@owainlewis
owainlewis / Application.scala
Last active September 19, 2018 09:16
Play framework HTTP token based authentication
package controllers.api
import play.api.mvc.{ Controller, Action }
import models._
import dao._
object Discussion extends Controller with TokenAuthentication {
def index = withAPIToken { user => { request =>
Ok(Json.toJson(DiscussionDAO.all))