Skip to content

Instantly share code, notes, and snippets.

View phdoerfler's full-sized avatar

Philipp Dörfler phdoerfler

View GitHub Profile
@seyonv
seyonv / Focusmate_num_sessions_v1.rb
Last active January 19, 2022 15:08
File to get the current total number of sessions in Focusmate
require 'json'
require 'pry'
require 'uri'
require 'net/http'
class FocusMateNumSessions
# Step 1. Create a file somewhere in your filesystem.
# Call it fm_token_file.txt. Insert the path to the file into the line below
# Make sure to look at the reference .txt file and just paste
# that over.
@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.
@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
@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 \

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.

@kpmeen
kpmeen / TablePrinter.scala
Last active March 5, 2022 12:52
Scala code for generating an ASCII table for a given data set. The implementation handles ANSI colours by depending on Fansi (https://github.com/lihaoyi/fansi) by Li Haoyi.
import fansi.Str
import org.slf4j.LoggerFactory
import scala.util.Try
import scala.util.control.NonFatal
object TablePrinter {
val logger = LoggerFactory.getLogger(TablePrinter.getClass)
@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
@tinkerware
tinkerware / Vagrant provision block
Last active January 21, 2019 01:11
Install Latest Java 7 and Java 8 on Ubuntu 14.04 LTS
config.vm.provision "shell", inline: <<-SHELL
apt-get -y -q update
apt-get -y -q upgrade
apt-get -y -q install software-properties-common htop
add-apt-repository ppa:webupd8team/java
apt-get -y -q update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get -y -q install oracle-java8-installer
apt-get -y -q install oracle-java7-installer