Skip to content

Instantly share code, notes, and snippets.

View ichramm's full-sized avatar

Juan Ramirez ichramm

View GitHub Profile
@ichramm
ichramm / pca_animation.m
Created November 4, 2021 18:13 — forked from anonymous/pca_animation.m
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@ichramm
ichramm / datomic-erasing-data-migration.clj
Created June 14, 2021 14:08 — forked from vvvvalvalval/datomic-erasing-data-migration.clj
Erasing data from Datomic via a manual data migration
;; # EMULATING DATOMIC EXCISION VIA MANUAL DATA MIGRATION
;; *************************************
;; ## Introduction
;; *************************************
;; This Gist demonstrates a generic way to migrate an entire Datomic database
;; from an existing 'Origin Connection' to a clean 'Destination Connection',
;; while getting rid of some undesirable data and otherwise preserving history.
@ichramm
ichramm / gist:e46440e3bdfe93a0859f67d9a766f046
Created April 28, 2020 13:31 — forked from cemerick/gist:3750288
Extending defrecord types in Clojure
;; Records are just types that provide default implementations of certain
;; key interfaces that allow them to stand in for maps.
;; This set of interfaces/protocols is not closed though; you can certainly make them
;; useful in places where maps aren't, e.g. w/ sequential destructuring:
=> (defrecord Point [x y]
clojure.lang.Indexed
(nth [_ i] (case i 0 x 1 y
(throw (IndexOutOfBoundsException.))))
(nth [_ i default]
@ichramm
ichramm / errors.clj
Created April 22, 2020 20:45 — forked from adambard/errors.clj
An example of functional error handling in clojure.
(ns example.errors)
(defn clean-address [params]
"Ensure (params :address) is present"
(if (empty? (params :address))
[nil "Please enter your address"]
[params nil]))
(defn clean-email [params]
"Ensure (params :email) matches *@*.*"
@ichramm
ichramm / completion-for-gradle.md
Last active October 22, 2015 14:40 — forked from nolanlawson/completion-for-gradle.md
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@ichramm
ichramm / latency.markdown
Last active August 27, 2015 17:49 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ichramm
ichramm / config.json
Last active August 29, 2015 14:08 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#27810A",
"@brand-success": "#5cb85c",