Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View viktorklang's full-sized avatar

Viktor Klang (√) viktorklang

View GitHub Profile
@viktorklang
viktorklang / Moments.Lost
Created August 17, 2016 09:39
Tampermonkey script to hide Twitter Moments
// ==UserScript==
// @name Hide moments
// @namespace http://irrelevant.domainname/
// @version 0.1
// @description Moments Lost
// @author √
// @match https://twitter.com/*
// @grant GM_addStyle
// ==/UserScript==
@viktorklang
viktorklang / gist:1b3032e46afc9abd400a
Last active October 13, 2017 16:43 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@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 / Gistard.scala
Last active June 9, 2017 07:27
Gistard — an sbt autoplugin for depending on Gists — such as Gistard itself
/*
Copyright 2015 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
package gistard.test
object Verify extends App {
println("OK")
}
@viktorklang
viktorklang / git-catchup.zsh
Created October 23, 2014 22:01
Git Catchup
#!/bin/zsh
#########################################################################################################################
# MIT License
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@viktorklang
viktorklang / in-fino-veritas.zsh-theme
Last active July 31, 2023 01:47
In Fino Veritas ZSH theme
#!/usr/bin/env zsh
# in fino veritas
# Borrowing shamelessly from these oh-my-zsh themes:
# fino-time
# pure
# https://gist.github.com/smileart/3750104
# Set required options
@viktorklang
viktorklang / dockless.sh
Created May 27, 2014 12:15
"Permanently" hide the Dock
#!/bin/bash
#########################################################################################################################
# MIT License
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@viktorklang
viktorklang / ToggleDock.applescript
Created May 27, 2014 11:24
AppleScript to toggle the use of Dock.app
(*
MIT License
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*)
on run {input, parameters}
set inactivePath to "/System/Library/CoreServices/Dock.app.bak"
set activePath to "/System/Library/CoreServices/Dock.app"
if application "Dock" is running then
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.