Skip to content

Instantly share code, notes, and snippets.

View tindzk's full-sized avatar

Tim Nieradzik tindzk

View GitHub Profile
@matsu-chara
matsu-chara / OptionValueAccessor.scala
Last active November 20, 2015 10:00
ネストしたjsonのような構造(必須でない要素あり)に簡単にアクセスするための ?メソッド
package OptionValueAccessor
import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
object OptionValueAccessor {
implicit class OptValue[A, B](val self: Option[A])(implicit ev: A <:< {def value: B}) {
def ? : Option[B] = macro Impl.optValImpl[A, B]
}
@txels
txels / rebase-onto.md
Last active December 19, 2018 02:00
Rebase a git branch onto another

Change the base branch for your current branch

Some cases:

  • you started a bugfix out of develop, but it should be applied to a release branch
  • you started on a branch and want to rebase it on some colleague's changes

Command

@wdullaer
wdullaer / Monokai.colorscheme
Last active March 21, 2022 20:43
Monokai Konsole Colourscheme
[Background]
Color=40,40,40
[BackgroundIntense]
Color=40,40,40
[Color0]
Color=73,72,62
[Color0Intense]
@wenkokke
wenkokke / rendertree.hs
Last active April 1, 2017 18:15
Pandoc filter which renders simple brace-delimited trees in codeblocks to LaTeX's Tikz-QTree...
#!/usr/bin/env runhaskell
-- cabal depedencies:
--
-- * containers
-- * pandoc-types
-- * uu-parsinglib
--
{-# LANGUAGE RankNTypes #-}
@milessabin
milessabin / gist:aae285025a32fac0f5c1
Last active August 26, 2017 10:28
Trivial type safe heterogenous map using only dependent method types, singleton-typed String literal keys and implicits.
scala> trait Assoc[K] { type V ; val value: V }
defined trait Assoc
scala> def mkAssoc[V0](k: String, v: V0): Assoc[k.type] { type V = V0 } =
| new Assoc[k.type] { type V = V0 ; val value = v }
mkAssoc: [V0](k: String, v: V0)Assoc[k.type]{type V = V0}
scala> implicit def nameAssoc = mkAssoc("Name", "Mary")
nameAssoc: Assoc[String("Name")]{type V = String}
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
@debasishg
debasishg / gist:8172796
Last active April 20, 2025 12:45
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@paulp
paulp / coll.scala
Last active December 30, 2015 15:18
trait Collections {
type CC[+X] // the overarching container type (in scala: any covariant collection, e.g. List, Vector)
type Min[+X] // the minimum type constructor which can be reconstituted to CC[X] (in scala: GenTraversableOnce)
type Opt[+X] // the container type for optional results (in scala: Option)
type CCPair[+X] // some representation of a divided CC[A] (at simplest, (CC[A], CC[A]))
type ~>[-V1, +V2] // some means of composing operations (at simplest, Function1)
type Iso[A] = CC[A] ~> CC[A] // e.g. filter, take, drop, reverse, etc.
type Map[-A, +B] = CC[A] ~> CC[B] // e.g. map, collect
type FlatMap[-A, +B] = CC[A] ~> Min[B] // e.g. flatMap
@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
@travisbrown
travisbrown / macro-interp.scala
Created March 11, 2013 19:13
String interpolation with macro-supported access to positions.
sealed trait Piece
case class Place(p: String) extends Piece
case class Name(n: String) extends Piece
case class LocatedPieces(located: Seq[(String, Piece, (Int, Int))])
object S2 extends ReflectionUtils {
import scala.language.experimental.macros
import scala.language.reflectiveCalls
import scala.reflect.macros.Context