Skip to content

Instantly share code, notes, and snippets.

@aveuiller
aveuiller / 00_producer.java
Last active June 27, 2021 14:01
medium_kafka_apprentice_cookbook
public class Main {
public static void main(String[] args) throws Exception {
// Configure your producer
Properties producerProperties = new Properties();
producerProperties.put("bootstrap.servers", "localhost:29092");
producerProperties.put("acks", "all");
producerProperties.put("retries", 0);
producerProperties.put("linger.ms", 1);
producerProperties.put("key.serializer", "org.apache.kafka.common.serialization.LongSerializer");
producerProperties.put("value.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer");
@aveuiller
aveuiller / 00_concepts_abstraction_table.md
Last active September 20, 2021 09:09
medium_Kubernetes_Apprentice_Cookbook
Abstraction Layer Physical Layer Uses Namespace Description
Pod Container A Pod is the minimal work unit of Kubernetes, it is generally equivalent to one applicative container but it can be composed of multiple ones.
Replicaset
@aveuiller
aveuiller / luci_getbuild_example.sh
Created March 2, 2021 09:50
LUCI ci.chromium.org
$ curl 'https://cr-buildbucket.appspot.com/prpc/buildbucket.v2.Builds/GetBuild' \
-H 'authority: cr-buildbucket.appspot.com' \
-H 'accept: application/json' \
-H 'dnt: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36' \
-H 'content-type: application/json' \
-H 'origin: https://ci.chromium.org' \
-H 'sec-fetch-site: cross-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
@aveuiller
aveuiller / main_fully_injected.java
Last active January 12, 2021 21:59
medium_dependency_injection
public static void main(String[] args) {
// Creating the injection module configured above.
Injector injector = Guice.createInjector(new WeatherModule());
// We ask for the injection of a WeatherContract,
// which will create an instance of ThermometerContract
// with the named TemperatureUnit under the hood.
WeatherContract weather = injector.getInstance(WeatherContract.class);
}
@aveuiller
aveuiller / five_days_a_month_after.py
Created January 12, 2021 21:34
medium_flaky_tests
def current_time():
# Centralized method to retrieve the current datetime
return arrow.get()
def compute_stats():
# Compute some statistics about stored data
month = current_time().floor('month')
data = retrive_data(month)
return len(data)
@aveuiller
aveuiller / advanced_controller_queries.sh
Last active January 20, 2021 22:31
medium_Spring_Boot_Apprentice_Cookbook
curl -i "localhost:8080/hello/jack?amount_exclamation=4"
HTTP/1.1 200
{"message":"Hello jack!!!!"}
# -d automatically creates a POST request.
$ curl -i "localhost:8080/hello" -d '{"name": "Bob"}' -H "Content-Type: application/json"
HTTP/1.1 200
{"message":"Hello Bob"}
@aveuiller
aveuiller / apps_selection-select_projects.sh
Last active September 26, 2018 14:31
Tandoori helper scripts
#!/bin/bash
cat apps-todo.csv | wc -l^C
./finished_projects.sh > ../apps-selection/paprika-finished
cd -
cat paprika_finished | xargs -iX grep -e "^X," all.csv > apps-todo.csv
# Todo: create tandoori_finished
@aveuiller
aveuiller / Test.java
Created September 21, 2017 08:50
Configuration example to make script engine work with Android
package test.app;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
@aveuiller
aveuiller / allApps.csv
Last active August 24, 2017 13:24
Put together Tandoori's tools to provide an automated way of creating a developer smells summary
afwall ukanth/afwall
AmazeFileManager arpitkh96/AmazeFileManager
andFHEM klassm/andFHEM
android-cache-cleaner Frozen-Developers/android-cache-cleaner
Android-IMSI-Catcher-Detector CellularPrivacy/Android-IMSI-Catcher-Detector
Android-Password-Store zeapo/Android-Password-Store
Android-Remote clementine-player/Android-Remote
andstatus andstatus/andstatus
Anki-Android ankidroid/Anki-Android
AnyMemo helloworld1/AnyMemo
@aveuiller
aveuiller / packageAndroid.sh
Last active April 30, 2022 14:11
Extract the Android .odex files and package a new android.jar with the retrieved classes
#!/bin/sh
##
# Usage:
# ./convert.sh /path/to/framework /path/to/out $apiVersion $arch
#
# $arch is mandatory only in case of an ART system and defines the boot folder to use (arm, x86, x86_64).
##
frameworkDir=$1
# Final output directory