Skip to content

Instantly share code, notes, and snippets.

View netanelrabinowitz's full-sized avatar
✌️

Netanel Rabinowitz netanelrabinowitz

✌️
View GitHub Profile
SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d
SETUVAR __fish_init_3_x:\x1d
SETUVAR fish_color_autosuggestion:7596E4
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:164CC9
SETUVAR fish_color_comment:007B7B
SETUVAR fish_color_cwd:purple
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:02BDBD
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_show_informative_status 1
end
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1
end
import ammonite.ops._
import mill._
import mill.util.Ctx
import mill.modules.Jvm
trait FlywayModule extends JavaModule {
def flywayMigrationPaths: T[Seq[PathRef]] = T { resources() }
def flywayUser: T[String]
def flywayPassword: T[String]
def flywayJdbcUrl: T[String]
@netanelrabinowitz
netanelrabinowitz / tf_NFM.py
Created November 22, 2018 20:01 — forked from nzc/tf_NFM.py
nffm模型的tf版实现
"""
Created on Dec 10, 2017
@author: jachin,Nie
A tf implementation of NFM
Reference:
[1] Neural Factorization Machines for Sparse Predictive Analytics
Xiangnan He,School of Computing,National University of Singapore,Singapore 117417,dcshex@nus.edu.sg
Tat-Seng Chua,School of Computing,National University of Singapore,Singapore 117417,dcscts@nus.edu.sg
@netanelrabinowitz
netanelrabinowitz / trimmed_list.lua
Created April 18, 2018 08:48
aerospike udf for insert an element to a list with max upper bound and trim size list
--
-- User: netanelrabinowitz
-- Date: 17/04/2018
-- Time: 16:31
--
function insert_trimmed_list(rec, bin, max_size, trimmed_size, value, ttl)
local l = rec[bin]
if (l == nil) then
l = list()
sealed abstract class Memo[K, V] {
def apply(z: K => V): K => V
}
object Memo {
def memo[K, V](f: (K => V) => K => V): Memo[K, V] = new Memo[K, V] {
def apply(z: K => V) = f(z)
}
def mutableHashMapMemo[K, V]: Memo[K, V] = mutableMapMemo(new mutable.HashMap[K, V])
@netanelrabinowitz
netanelrabinowitz / SimpleFinalEncodingExample.scala
Last active April 3, 2018 20:02
A simple final encoding example with an extension and an applied optimization
// http://2017.flatmap.no/talks/hauck/
object SimpleFinalEncodingExample {
sealed trait Expr[A] {
def lit(x: Int): A
def neg(e: A): A
def add(e1: A, e2: A): A
}
sealed trait ExprMul[A] {
@netanelrabinowitz
netanelrabinowitz / Clopen.scala
Created December 26, 2017 16:26
“clopen” typeclasses
/**
* User: netanelrabinowitz
* Date: 26/12/2017
* Time: 15:00
*/
//https://typelevel.org/blog/2017/12/20/who-implements-typeclass.html
sealed trait ISOAdder[A]
/**
* User: netanelrabinowitz
* Date: 16/12/2017
* Time: 14:11
*/
import shapeless._
import shapeless.ops.hlist
import shapeless.labelled.{field, FieldType}
@netanelrabinowitz
netanelrabinowitz / LabelledGenerics.scala
Last active November 21, 2018 18:33
Labelled Generics Json Encoder
/**
* User: netanelrabinowitz
* Date: 16/12/2017
* Time: 11:39
*/
sealed trait JsonValue
case class JsonObject(fields: List[(String, JsonValue)]) extends JsonValue
case class JsonArray(items: List[JsonValue]) extends JsonValue
case class JsonString(value: String) extends JsonValue