Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am JannikArndt on github.
* I am jannikarndt (https://keybase.io/jannikarndt) on keybase.
* I have a public key whose fingerprint is 96D9 85CD 725B DEDD 4247 9494 A050 6AF6 7444 8241
To claim this, I am signing this object:
@JannikArndt
JannikArndt / StringSanitize.swift
Last active May 15, 2021 20:51 — forked from totocaster/StringSanitize.swift
Function that "sanitizes" string to safe filename string that can be used on Mac, Linux and Windows.
var str = "2018/12/06 12:28 \\ - Ourdoor Run: Making a habbit.fgworkout"
extension String {
func sanitized() -> String {
// see for ressoning on charachrer sets https://superuser.com/a/358861
let invalidCharacters = CharacterSet(charactersIn: "\\/:*?\"<>|")
.union(.newlines)
.union(.illegalCharacters)
.union(.controlCharacters)
@JannikArndt
JannikArndt / Akka Http Json4s Unmarshalling - Minimal Example.scala
Created December 13, 2017 12:51
Akka Http Json4s Unmarshalling - Minimal Example in Scala
import akka.http.scaladsl.model.ContentTypes.`application/json`
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import akka.http.scaladsl.testkit.ScalatestRouteTest
import de.heikoseeberger.akkahttpjson4s.Json4sSupport._
import org.json4s.native.Serialization
import org.json4s.{DefaultFormats, _}
import org.scalatest._
@JannikArndt
JannikArndt / Read from and Write to Text File in Scala.scala
Last active August 31, 2017 09:43
Helper class to write to a file in Scala using just one line and the java.nio package.
object File {
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, OpenOption, Paths, StandardOpenOption}
def append(path: String, txt: String): Unit =
write(path, txt, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.APPEND)
def overwrite(path: String, txt: String): Unit =
write(path, txt, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING)
SELECT
permission.class_desc,
permission.permission_name,
permission.major_id,
OBJECT_NAME(permission.major_id),
permission.minor_id,
permission.grantee_principal_id,
principal.name
FROM sys.database_permissions permission
JOIN sys.database_principals principal ON permission.grantee_principal_id = principal.principal_id
#!/usr/bin/env bash
# inspired by
# https://github.com/fwartner/mac-cleanup/blob/master/cleanup.sh
# https://gist.github.com/jamesrampton/4503412
# https://github.com/mengfeng/clean-my-mac/blob/master/clean_my_mac.sh
# https://github.com/szymonkaliski/Dotfiles/blob/master/Scripts/clean-my-mac
# http://brettterpstra.com/2015/10/27/vacuuming-mail-dot-app-on-el-capitan/ / https://github.com/pbihq/tools/blob/master/MailDBOptimiser.sh
bytesToHuman() {

Keybase proof

I hereby claim:

  • I am jannikarndt on github.
  • I am jannikarndt (https://keybase.io/jannikarndt) on keybase.
  • I have a public key ASAq2Gbqv40eg19VYZgvUiY3982pGXauBnstO9DRI0ba5go

To claim this, I am signing this object:

# Contributor License Agreement
The following terms are used throughout this agreement:
**You** - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
**Project** - is an umbrella term that refers to any and all Canal open source projects.
**Contribution** - any type of work that is submitted to a Project, including any modifications or additions to existing work.
@JannikArndt
JannikArndt / cloudSettings
Last active January 6, 2017 13:58
Visual Studio Code Sync Settings GIST
{"lastUpload":"2017-01-06T13:58:57.517Z"}
@JannikArndt
JannikArndt / DragAndDrop.xaml
Created May 10, 2014 11:16
Custom Drag and Drop with multiple Canvas-elements
<Window x:Class="WPFTryOut.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Canvas Name="rootCanvas" ZIndex="1">
<Canvas Name="Canvas2" Width="100" Height="100" ZIndex="0" Background="Aquamarine" Left="30" Top="30" MouseLeftButtonDown="DragStart" MouseMove="Drag" PreviewMouseLeftButtonUp="DragEnd">
<Rectangle Canvas.Left="10" Canvas.Top="10" Width="20" Height="20" Fill="Blue" MouseLeftButtonDown="DragStart" MouseMove="Drag" PreviewMouseLeftButtonUp="DragEnd"></Rectangle>
<Rectangle Canvas.Left="40" Canvas.Top="60" Width="20" Height="20" Fill="Red" MouseLeftButtonDown="DragStart" MouseMove="Drag" PreviewMouseLeftButtonUp="DragEnd"></Rectangle>
</Canvas>