Skip to content

Instantly share code, notes, and snippets.

View YannRobert's full-sized avatar
🏠
Working from home

Yann ROBERT YannRobert

🏠
Working from home
  • Paris, France
View GitHub Profile
import java.nio.charset.Charset;
/**
* <p>Provides Base32 encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a>.
* However it uses a custom alphabet first coined by Douglas Crockford. Only addition to the alphabet is that 'u' and
* 'U' characters decode as if they were 'V' to improve mistakes by human input.<p/>
* <p>
* This class operates directly on byte streams, and not character streams.
* </p>
*
@YannRobert
YannRobert / IssueInRxJavaDefensiveCodeTest.java
Created March 30, 2015 13:06
Does the defensive code in RxJava "merge" operator could be improved?
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import rx.Observable;
import rx.Observer;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;
import java.util.concurrent.CountDownLatch;
@YannRobert
YannRobert / init-graphite-container-volumes.sh
Last active March 1, 2016 10:56
initialisation of volumes for graphite container hopsoft/graphite-statsd
#!/bin/sh
set -e
set -x
LOG_DIR=$HOME/graphite-volumes/var-log
DATA_DIR=$HOME/graphite-volumes/graphite-storage
VOLUMES_INIT_CONTAINER_NAME=graphite-volumes-init
@YannRobert
YannRobert / 20-3proxy.conf
Last active February 26, 2024 23:50
working 3proxy configuration for a personal usage proxy
# /etc/fail2ban/jail.d/20-3proxy.conf
[3proxy]
enabled = true
filter = 3proxy
action = iptables[name=3proxy, port=3128, protocol=tcp]
logpath = /var/log/3proxy/3proxy.log*
maxretry = 3
bantime = 3600 ; 1 hour
findtime = 3600 ; 1 hour
@YannRobert
YannRobert / named.conf
Created July 3, 2015 13:05
named.conf for a forwarding only naming server (to be used as the nameserver by localhost, in order to cache queries)
//
// named.conf
//
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
#!/bin/sh
set -e
set -x
dnf install -y fail2ban
curl -O https://get.docker.com/rpm/1.7.1/fedora-22/RPMS/x86_64/docker-engine-1.7.1-1.fc22.x86_64.rpm
rpm -i ./docker-engine-1.7.1-1.fc22.x86_64.rpm
import com.rabbitmq.client.ConnectionFactory;
import org.junit.Test;
public class ConnectionFactorySettersTest {
// considering the default value for handshakeTimeout is 10000 and the default value for connectionTimeout is 0
// this test is failing
// if we set the connectionTimeout to a higher value than the default value of handshakeTimeout, the test will fail
@YannRobert
YannRobert / 1-openssl-connect-shows-issue.log
Last active October 8, 2015 13:13
TLS certificate issue with carbon.hostedgraphite.com:20030
# openssl s_client -connect carbon.hostedgraphite.com:20030
CONNECTED(00000003)
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com
verify error:num=27:certificate not trusted
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com
verify error:num=21:unable to verify the first certificate
@YannRobert
YannRobert / fail2ban-allstatus.sh
Created December 21, 2015 16:56 — forked from kamermans/fail2ban-allstatus.sh
Show status of all fail2ban jails at once
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done
@YannRobert
YannRobert / save-load-docker-images.sh
Last active December 20, 2021 06:34 — forked from mmrko/save-load-docker-images.sh
Script to (selectively) save/load multiple Docker images
#!/usr/bin/env bash
# Script to (selectively) save/load multiple Docker images to/from a directory.
# Run ./save-load-docker-images.sh for help.
set -e
directory=$PWD
filter=""
compress=0