Skip to content

Instantly share code, notes, and snippets.

alias docker-cleanup='docker ps -a -q | xargs -I {} docker rm {} ; docker images -q -f dangling=true | xargs -I {} docker rmi -f {}; docker volume ls -qf dangling=true | xargs -I {} docker volume rm {}'
@mikea
mikea / latency.txt
Created May 31, 2012 15:23 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 4x mutex op, 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
@mikea
mikea / betapdf.sql
Last active September 30, 2020 21:53
Computing gamma, beta and beta pdf functions in postgresql
-- numberical recipes 6.1
CREATE OR REPLACE FUNCTION gammaln(xx double precision) RETURNS double precision AS $$
DECLARE
x double precision;
tmp double precision;
ser double precision;
i integer;
cof double precision[] := ARRAY[
57.1562356658629235,
-59.5979603554754912,
@mikea
mikea / babel.conf.js
Created March 10, 2020 22:32
bluebird + webpacj
[
"@babel/plugin-transform-async-to-generator",
{
module: "bluebird",
method: "coroutine",
},
],
diff --git a/pipeline_v2/feature_schema.py b/pipeline_v2/feature_schema.py
index 680e231..1e7d600 100644
--- a/pipeline_v2/feature_schema.py
+++ b/pipeline_v2/feature_schema.py
@@ -55,17 +55,17 @@ column_types = {
'risk_inputs_session_ccn_had_deletion': pd.Int64Dtype(),
'risk_inputs_billing_address_is_commercial': pd.Int64Dtype(),
'risk_inputs_billing_address_resident_is_deceased': pd.Int64Dtype(),
- 'risk_inputs_ip_to_distinct_auth_decline_reasons': pd.Int64Dtype(),
- 'risk_inputs_shipping_address_matches_name': pd.Int64Dtype(),
diff --git a/pipeline_v2/feature_schema.py b/pipeline_v2/feature_schema.py
index 680e231..2186c46 100644
--- a/pipeline_v2/feature_schema.py
+++ b/pipeline_v2/feature_schema.py
@@ -55,7 +55,7 @@ column_types = {
'risk_inputs_session_ccn_had_deletion': pd.Int64Dtype(),
'risk_inputs_billing_address_is_commercial': pd.Int64Dtype(),
'risk_inputs_billing_address_resident_is_deceased': pd.Int64Dtype(),
- 'risk_inputs_ip_to_distinct_auth_decline_reasons': pd.Int64Dtype(),
+ 'risk_inputs_ip_to_distinct_auth_decline_reasons': np.str,
@mikea
mikea / devadvice.md
Last active August 24, 2019 16:32
Development Environment Advice

Invest into your development environment

Efficient setup makes it possible to produce changes in shortest time. Notice when you become (micro-)bored, distracted, frustrated: this is often because you have to do the same thing over and over or have to wait. Fix it.

Here’s some more specific advice on nurturing your development environment:

  • know it better: notice every tool you have to use, and try to study it (read man page, visit site, read docs)
  • keep all the things you need running all the time. don’t reboot your laptop if you can avoid it. Starting things up is a major time barrier. Measure uptime in weeks.
  • develop a morning routine: commit your changes to branches, pull, build, restart, merge all active prs, build&test them, push what you can.
  • get some understanding of bash. if what you do is mechanical (eg visit 3 windows and restart something in all of them) then figure out a way to do it in one command.

Keybase proof

I hereby claim:

  • I am mikea on github.
  • I am mikeaizatsky (https://keybase.io/mikeaizatsky) on keybase.
  • I have a public key ASA43y43bP0S0VqltRyXNrNGXh3gFly33AoWNU0cD_LxTwo

To claim this, I am signing this object:

struct Date {
Date() = delete;
class Reader;
class Builder;
class Pipeline;
};
@mikea
mikea / gist:7259269
Last active December 27, 2015 03:29
I want C[T] to have different method sets based on T. I thought I could use implicits, but can't make it work. Any idea how to fix this example?
class Printer[T](_t: T) {
def t = _t
def print():Unit = { println(t) }
}
class IterablePrinter[T, I <: Iterable[T]](p : Printer[I]) {
def printEach() = p.t.foreach(println)
}
object Test extends App {