Skip to content

Instantly share code, notes, and snippets.

View christophschubert's full-sized avatar

Christoph Schubert christophschubert

  • Conduktor
  • Bremen
View GitHub Profile
@christophschubert
christophschubert / README.md
Created August 9, 2023 09:34
Docker compose environment to start Confluent REST Proxy and produce some message using JSON

Docker compose environment with Confluent REST Proxy and Control Center

Usage

docker compose up -d 
# please be patient...
@christophschubert
christophschubert / log4j2.properties
Created September 17, 2022 05:05
A simple log4j2 properties file to quickly paste into project. Uses the Console appender.
appenders=console
appender.console.type=Console
appender.console.name=Console
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%c] - %msg%n
# root logger
rootLogger.level=info
rootLogger.appenderRefs=stdout
rootLogger.appenderRef.stdout.ref=Console
@christophschubert
christophschubert / summarize_ccloud_sr_versions.py
Last active June 7, 2021 04:41
Confluent schema registry below version 6.1 does not provide any endpoint to count the total number of schema versions in the SR.
# Get basic summary of versions in Confluent Cloud schema registry.
# You need to provide the SR url as well as SR apikey and api secret (lines 6 - 8 below).
import requests
from requests.auth import HTTPBasicAuth
sr_apikey = ''
sr_apisecret = ''
sr_url = ''
auth = HTTPBasicAuth(sr_apikey, sr_apisecret)
@christophschubert
christophschubert / GeneratePermutations.java
Created March 18, 2021 12:49
Generate all permutations of Java List. Uses Java 11 var.
public class GeneratePermutations {
static <E> List<E> addToCopy(List<E> original, int pos, E e) {
final var r = new ArrayList<>(original);
r.add(pos, e);
return r;
}
public static <E> List<List<E>> generatePermutations(List<E> original) {
if (original.isEmpty()) {
return List.of(new ArrayList<>());
@christophschubert
christophschubert / MultiMachine-Vagrantfile
Last active April 6, 2020 03:51
Create multiple machines in a single Vagrantfile and ensure that we can ssh into them without using vagrant.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# create multiple machines in a single Vagrantfile and ensure that we can ssh into them without using vagrant.
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.ssh.insert_key = false
config.ssh.private_key_path = ["~/.vagrant.d/insecure_private_key", "~/.ssh/terraform"]
@christophschubert
christophschubert / README.md
Created June 9, 2017 08:26 — forked from joyrexus/README.md
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

@christophschubert
christophschubert / beautiful_idiomatic_python.md
Last active April 21, 2017 04:42 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers