Skip to content

Instantly share code, notes, and snippets.

View viktorklang's full-sized avatar

Viktor Klang (√) viktorklang

View GitHub Profile
@viktorklang
viktorklang / service-checklist.md
Created September 20, 2016 12:06 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@viktorklang
viktorklang / gist:f1f60e7a7481671132755d024be8d91b
Created September 3, 2021 10:54
Improving MacBook trackpad sensitivity
defaults write -g com.apple.trackpad.scaling -float 5.0
@viktorklang
viktorklang / SlackLauncher.sh
Created July 16, 2019 08:42
Launcher script for Slack on macOS which warns you if you open if while on battery power
#!/usr/bin/env bash
if [[ $(pmset -g ps | head -1) =~ "Battery Power" ]]; then
osascript -e 'display notification "You are starting Slack while running on battery power" with title "Battery Drain Source Detected" subtitle ""'
fi
open /Applications/Slack.app
@viktorklang
viktorklang / gbr.txt
Created June 30, 2015 08:43
shell alias for showing git branches sorted by last activity date
alias gbr='git for-each-ref --sort="-authordate:iso8601" --format=" %(color:green)%(authordate:iso8601)%09%(color:white)%(refname:short)" refs/heads'
@viktorklang
viktorklang / InterruptibleCancellableFuture.scala
Last active June 1, 2020 13:45
Interruptible-Cancellable-scala.concurrent.Future
/*
Copyright 2018 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@viktorklang
viktorklang / linearize.scala
Created August 14, 2012 10:02
A Linearized version of Sequence
import scala.concurrent._
import scala.collection.mutable.Builder
import scala.collection.generic.CanBuildFrom
import language.higherKinds
/**
* Linearize asynchrnously applies a given function in-order to a sequence of values, producing a Future with the result of the function applications.
* Execution of subsequent entries will be aborted if an exception is thrown in the application of the function.
*/
def linearize[T, U, C[T] <: Traversable[T]](s: C[T])(f: T => U)(implicit cbf: CanBuildFrom[C[T], U, C[U]], e: ExecutionContext): Future[C[U]] = {
package my.concurrent.multimap
import scala.reflect.Manifest
import java.util.concurrent.{ConcurrentSkipListSet, ConcurrentHashMap}
import java.util.{Set => JSet}
import scala.collection.JavaConversions._
import annotation.tailrec
class Index[K <: AnyRef,V <: AnyRef : Manifest] {
@viktorklang
viktorklang / CQRS_ES_Actor.scala
Created February 1, 2011 15:05
CQRS and EventSourcing using Akka Actors
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {
@viktorklang
viktorklang / doc.md
Created December 19, 2018 16:03 — forked from fwbrasil/doc.md
Scala `Future` optimizations (8/8/2018 snapshot)

Scala Future optimizations


Flavio W. Brasil, July 2017

Problem