Skip to content

Instantly share code, notes, and snippets.

View bric3's full-sized avatar
💭
🤨

Brice Dutheil bric3

💭
🤨
View GitHub Profile
@bric3
bric3 / codebreaker.md
Last active November 1, 2015 13:52
recruitment tests

Codebreaker

Implement a simple program that match the requirements below.

The game

Code breaking is all about finding the secret code.

When the game starts the player should be able to guess the secret code by providing a 4 digits number. The game finishes when the player have found the exact match for the secret code.

@bric3
bric3 / create_user_schema.sql
Created March 23, 2015 15:13
Simple user/schema ME Oracle SQL creation script
create role ME_ROLE;
grant
create materialized view,
create session,
alter session,
create table,
create indextype,
create sequence,
create synonym,
@bric3
bric3 / gist:670bd9b3ba9783573751
Last active August 29, 2015 14:24
Opening JMX port at runtime

Comment ouvrir les ports JMX remote à chaud

Copied from : http://blog.alexis-hassler.com/2015/06/ouvrir-jmx-remote-chaud.html

Pour permettre un accès distant au MBeans d'une JVM Oracle ou OpenJDK, il faut la démarrer avec la propriété com.sun.management.jmxremote.port, plus quelques autres propriétés détaillées sur JTips.

java -Dcom.sun.management.jmxremote.port=1099 fr.sewatech.myapp.MyMain
@bric3
bric3 / HibernateDDLGenerator.java
Created August 7, 2015 09:01
DDL Generation, Hibernate 4+, Java 8, Reflections, Works with @Entities + different @typedef annotated package
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.Target;
import org.junit.Test;
import org.reflections.Reflections;
public class HibernateDDLGenerator {
@bric3
bric3 / CacheSizing.java
Last active November 6, 2015 18:03
Calculate the size of a cache using jol (Java Object Layout) (eviction concerns not taken care of)
public class CacheSizing {
public static final int _10_MEGABYTE = 10_000_000;
// The type Value is a Value Object whose max size is known, that is :
// - no string with "unbounded" variable length
// - no Collection with any size
@Test
public void possible_cache_size_value() {
int possible_cache_size_per_server = 10_000;
LoadingCache<String, Value> c = CacheBuilder.newBuilder()
@bric3
bric3 / brew-dependencies
Last active December 10, 2015 10:46
nodegit not compiling issue on osx
==> Downloading https://homebrew.bintray.com/bottles/node-5.2.0.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring node-5.2.0.el_capitan.bottle.tar.gz
==> Caveats
Please note by default only English locale support is provided. If you need
full locale support you should:
`brew reinstall node --with-full-icu`
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
~/work/the/project ± ❯ npm run install-deps [ ✎ (master ᄉ origin)] [▶▶▶▶▶▶▷▷▷▷]
> project@11.0.0 install-deps /Users/brice/work/the/project
> npm-cache install
[npm-cache] [INFO] using /Users/brice/.package_cache as cache directory
[npm-cache] [INFO] creating cache directory
[npm-cache] [INFO] [bower] bower_components located at bower_components per bowerrc
[npm-cache] [INFO] [bower] config file exists
[npm-cache] [INFO] [bower] cli exists
@bric3
bric3 / UTF-8-demo.txt
Last active March 10, 2021 08:14
Shell (commands) tips accumulated over years
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25 CC BY
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
@bric3
bric3 / benchmark-commands.txt
Created March 6, 2016 22:50 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@bric3
bric3 / kafka-move-leadership.sh
Created March 24, 2016 10:25 — forked from miguno/kafka-move-leadership.sh
A simple Ops helper script for Apache Kafka to generate a partition reassignment JSON snippet for moving partition leadership away from a given Kafka broker. Use cases include 1) safely restarting a broker while minimizing risk of data loss, 2) replacing a broker, 3) preparing a broker for maintenance.
#!/usr/bin/env bash
#
# File: kafka-move-leadership.sh
#
# Description
# ===========
#
# Generates a Kafka partition reassignment JSON snippet to STDOUT to move the leadership
# of any replicas away from the provided "source" broker to different, randomly selected
# "target" brokers. Run this script with `-h` to show detailed usage instructions.