Skip to content

Instantly share code, notes, and snippets.

View phdoerfler's full-sized avatar

Philipp Dörfler phdoerfler

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 8, 2024 16:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@bittner
bittner / keyboard-keys.md
Created February 28, 2019 22:50
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@YordanGeorgiev
YordanGeorgiev / logback.example.xml
Last active April 18, 2024 11:06
[minimal-logback.xml-example] how-to configure the logback.xml minimalistically #scala #xml #logback #logging #configuration
<!-- all you need to know about log levels src: https://i.stack.imgur.com/Z5mag.png -->
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<logger name="com.datastax.driver.core.QueryLogger.SLOW" level="DEBUG" />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %msg %n</pattern>
</encoder>
</appender>
@Piasy
Piasy / install_ffmpeg.sh
Last active April 14, 2024 05:40
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \
@yannhowe
yannhowe / .gitlab.ci.yml
Created September 26, 2016 18:06
.gitlab.ci.yml for SSH with private key.
# Image neeeds to have ssh-client
image: docker:git
services:
- docker:dind
stages:
- staging
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
@normoes
normoes / get_files_and_info_from_docker_container.md
Created March 1, 2019 15:12
Get files and information from a docker container

This can be used to retreive files/binaries/information from docker containers.

#!/bin/bash

set -Eeuo pipefail

mkdir ./binary || true

# build most recent docker image
@bobthecow
bobthecow / tab.bash
Last active November 10, 2023 08:47
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@guilgaly
guilgaly / 1 - scalac options 2.13.scala
Last active September 21, 2023 14:45
Scala compiler options I typically use
val scalacOptions = Seq(
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-Ybackend-parallelism", //
"8",
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
// "-Ymacro-annotations", // Enable support for macro annotations, formerly in macro paradise.