Skip to content

Instantly share code, notes, and snippets.

💭
🤨

Brice Dutheil bric3

💭
🤨
Block or report user

Report or block bric3

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
View file-birth.sh
#!/usr/local/bin/java --source 11 --add-opens java.base/sun.nio.fs=ALL-UNNAMED
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFileAttributes;
public class FileBirth {
public static void main(String[] args) throws Throwable {
@bric3
bric3 / Node.java
Created Mar 13, 2019 — forked from norswap/Node.java
Fast Java Reflection
View Node.java
package demo;
public interface Node {}
@bric3
bric3 / checknetwork.gradle
Last active Jan 7, 2019
Makes gradle go automatically go offline
View checknetwork.gradle
/**
* Makes gradle go automatically offline.
*
* Store in $HOME/.gradle/init.d/checknetwork.gradle
*/
apply plugin : CheckNetwork
class CheckNetwork implements Plugin<Gradle> {
void apply(Gradle gradle) {
@bric3
bric3 / slack_history.py
Last active Jun 29, 2018 — forked from minniel/slack_history.py
Download Slack Channel/PrivateChannel/DirectMessage History
View slack_history.py
from slacker import Slacker
import json
import argparse
import os
import shutil
import copy
import requests
import urllib3
#from io import open
from datetime import datetime
@bric3
bric3 / WeakeningAgent.java
Created Oct 1, 2016 — forked from raphw/WeakeningAgent.java
A Java agent for fixing exports for an app that is not yet Java 9 aware.
View WeakeningAgent.java
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Layer;
import java.lang.reflect.Module;
import java.util.*;
public class WeakeningAgent {
public static void premain(String argument, Instrumentation instrumentation) {
boolean full = argument != null && argument.equals("full");
Set<Module> importing = new HashSet<>(), exporting = new HashSet<>();
@bric3
bric3 / Sleeper.java
Created Sep 7, 2016
Trying different ways to accurately sleep in java
View Sleeper.java
public class Sleeper {
private static final long SLEEP_PRECISION = TimeUnit.MILLISECONDS.toNanos(2);
private static final long SPIN_YIELD_PRECISION = TimeUnit.MILLISECONDS.toNanos(2);
public static void main(String... args) throws InterruptedException {
final BlockingQueue SLEEPER = new ArrayBlockingQueue(1);
System.out.println("Blocking Queue");
for (int i = 0; i < 100; i++) {
long start = System.nanoTime();
View InstrumentationTest.java
package bob.yop;
import static net.bytebuddy.implementation.MethodDelegation.to;
import static net.bytebuddy.matcher.ElementMatchers.nameContains;
import static net.bytebuddy.matcher.ElementMatchers.named;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import org.apache.kafka.common.network.NetworkReceive;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
@bric3
bric3 / kafka-move-leadership.sh
Created Mar 24, 2016 — 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.
View kafka-move-leadership.sh
#!/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.
View benchmark-commands.txt
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 / db-tips.md
Last active Jul 22, 2019
Shell (commands) tips accumulated over years
View db-tips.md

DB

SQL

Create table using with

with user_count as (
  select
You can’t perform that action at this time.