Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@daluu
daluu / some_probability_distributions_graphing_with_d3.js
Last active February 4, 2021 21:28 — forked from paul-english/gist:4752760
Some work graphing a few probability distributions using d3.js
var probability = {
normal: function(x, mean, stddev) {
var y = (1 / (stddev * Math.sqrt(2 * Math.PI))) * Math.pow(Math.E, - (Math.pow(x - mean, 2) / (2 * Math.pow(stddev, 2))));
//console.log('normal', x, mean, stddev, y);
return y;
},
logNormal: function(x, mean, stddev) {
var y = (1 / (x * Math.sqrt(2 * Math.PI * Math.pow(stddev, 2)))) * Math.pow(Math.E, - (Math.pow(Math.log(x) - mean, 2) / (2 * Math.pow(stddev, 2))));
//console.log('logNormal', x, mean, stddev, y);
y = isFinite(y) ? y : 0;
@daluu
daluu / d3.legend.js
Last active March 10, 2020 20:58 — forked from bunkat/index.html
Sample trendline and linear, polynomial, exponential, logarithmic, and power regression analysis using regression.js
// d3.legend.js
// (C) 2012 ziggy.jonsson.nyc@gmail.com
// MIT licence
(function() {
d3.legend = function(g) {
g.each(function() {
var g= d3.select(this),
items = {},
svg = d3.select(g.property("nearestViewportElement")),
@daluu
daluu / gonotes.txt
Last active March 17, 2021 21:00
golang notes/tips
alternate registry to fetch packages outside of go get: https://gopm.io/download?pkgname=golang.org/x/oauth2
alternate web sandbox for go: https://goplay.space/
https://medium.com/@nate510/don-t-use-go-s-default-http-client-4804cb19f779
https://github.com/beyondns/gotips
http://moazzam-khan.com/blog/golang-make-http-requests/
@daluu
daluu / git_gh_notes.md
Last active May 2, 2022 23:07
git and github notes
@daluu
daluu / go_get_private_repos.txt
Last active March 26, 2023 08:51 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
```bash
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
```
@daluu
daluu / custom_rf_docker_image_notes.txt
Created April 7, 2019 22:01
Notes for building custom Robot Framework docker images
Below are various notes to help if building a custom RF docker image that we don't already have publicly available,
e.g. IronPython-based RF docker image, Java/Jython-based RF docker image.
java -jar jython_installer-<version>.jar
# Robot Framework 3.0 supports Jython 2.7 which requires Java 7 or newer.
jython -m ensurepip
jython -m pip install robotframework
@daluu
daluu / docker_notes.txt
Last active August 1, 2023 19:46
Docker notes
docker system prune --volumes
docker run -u`id -u`:`id -g` -v $(pwd):/user/project -v ~/.aws:/user/.aws -v ~/.npmrc:/user/.npmrc -w /user/project -it --entrypoint /bin/bash circleci/node:12
# get compressed size of docker images (after they're pulled locally)
docker save image-name:latest > sizetest.tar
gzip sizetest.tar
ls -lh sizetest.tar.gz
# see https://github.com/docker/docker/issues/1143
@daluu
daluu / zkcheck.sh
Created October 24, 2019 16:21
zk status check
#!/bin/sh
# use either option below
echo ruok | nc zksvr 2181
echo srvr | nc zksvr 2181
@daluu
daluu / py_env_notes.txt
Last active November 14, 2019 16:59
python env notes
various python related commands to run relating to envs
apt-get -y update && apt-get -y --force-yes --fix-missing install build-essential python-dev
pip install virtualenv
virtualenv --system-site-packages -p python3 venv3
source venv3/bin/activate
. venv3/bin/activate