Skip to content

Instantly share code, notes, and snippets.

View rahilb's full-sized avatar

Rahil Bohra rahilb

View GitHub Profile
@rahilb
rahilb / definition.hjson
Last active September 9, 2019 15:14
Gantt Chart in Vega for tracing time spent per label (kubernetes.container_name.keyword) for a given search
{
$schema: https://vega.github.io/schema/vega/v3.0.json
"padding": 5,
"title": "Trace by App",
data: [
{
name: events
url: {
%context%: true
%timefield%: @timestamp
@rahilb
rahilb / links.md
Last active August 2, 2018 16:03
misc
@rahilb
rahilb / General.md
Created February 17, 2018 10:58
TensorFlow Notes

Make sure related data is put into the same bucket

  • Assign related items to the same data partition
    • e.g. chunks of the same file, audio spoken by the same person etc

This will make sure your network has been contaminated by seeing testing samples during the traing phase.

e.g. the following function from tensorflow examples assigns files stably to partitions, ignoring a regex in the file name:

@rahilb
rahilb / Caching.scala
Created August 8, 2017 11:58
guava scalaz memo
def guavaMemo[K, V](ttl: CacheTtl): Memo[K, V]
= Memo.memo[K, V] { method: (K => V) =>
val builder: CacheBuilder[AnyRef, AnyRef] = CacheBuilder.newBuilder()
builder.expireAfterWrite(ttl.time, ttl.unit)
val cache = builder.build().asInstanceOf[Cache[K, V]]
def ret(key: K): V = cache.get(key, new Callable[V] {
override def call(): V = {
method(key)
}

awk '{print "(""\x27""amelco\x27,""\x27"$1"\x27,""\x27"$2"\x27,""\x27"$3"\x27,"$4",1),"}' filename = Excel copy-pasta to sql inserts!

@rahilb
rahilb / parsec-azure-template.json
Created May 7, 2017 19:25 — forked from danapplegate/parsec-azure-template.json
An Azure template to automate the creation of a Parsec-ready server and network firewall Windows Server 2016 instance.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"defaultValue": "parsec-azure",
"type": "string"
},
"userName": {
"defaultValue": "parsec",
@rahilb
rahilb / Macro.scala
Created January 4, 2017 12:14
Macro
import FieldList._
import shapeless.{HList, LabelledGeneric}
import scala.language.experimental.macros
import scala.reflect.macros.blackbox
object Foo {
def foo_impl[T, L <: HList](c: blackbox.Context)
(t: c.Expr[T])
(gen: c.Expr[LabelledGeneric.Aux[T, L]],
@rahilb
rahilb / comments.md
Last active November 7, 2016 15:35
Onzo

Implemented using typeclasses.

Implementation:

  1. Define the problem with types :
  • Encoder[A] & Decoder[A]. Encoder takes an A, and produces an AttributeValue. Decoder does the opposite.
  • KeyLike[A] coproduct for things that can be keys.
  • NamedKeyLike[A] a key that has a name, an encoder, and a decoder.
  • PrimaryKey - I suppose it's the Primary Key of the table
import eu.fakod.neo4jscala.{TypedTraverser, SingletonEmbeddedGraphDatabaseServiceProvider, Neo4jWrapper}
import sys.ShutdownHookThread
trait ProgramBase {
val name: String
}
case class Series(name: String) extends ProgramBase
case class Episode(name: String) extends ProgramBase