Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@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 / 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 / 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 / README.md
Last active May 11, 2016 16:11
Custom/additional maven repos to get some not so common maven hosted JARs

Just an example for others and a note for myself in case I need to reference this in the future.

Steps:

Add the custom/additional maven repos where you can find the JARs (that are not hosted on maven central or other common repo)

<repositories>
   <!-- has some useful JARs not hosted on maven central, a popular alternative repo -->
 
@daluu
daluu / read_apache_storm_config_and_bolt_init_and_process_sample.js
Last active October 31, 2018 06:12
Sample bolt showing how to initialize a bolt and read in Apache Storm topology configuration and process tuple in node.js and how to unit test it
#! /usr/bin/env node
'use strict';
var storm = require("pathTo/storm.js"); //the official storm multilang node client/binding from Apache Storm project
var BasicBolt = storm.BasicBolt;
TestBolt.prototype = Object.create(BasicBolt.prototype);
TestBolt.prototype.constructor = TestBolt;
function TestBolt() {
@daluu
daluu / additional_notes_on_js_async2sync.txt
Last active November 10, 2018 01:02
Dealing with return values for asynchronous calls in javascript (when you're accustomed to synchronous code)
https://blog.cloudboost.io/execute-asynchronous-tasks-in-series-942b74697f9c
https://blog.scottlogic.com/2017/09/14/asynchronous-recursion.html
@daluu
daluu / index.html
Created February 1, 2016 01:43
d3 pareto histogram example with cumulative percentage line (e.g. replica of Excel histogram with pareto and cumulative percentage line options via the data analysis toolpak addon)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
@daluu
daluu / index.html
Created February 1, 2016 01:35
d3 Pareto Chart Example
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
@daluu
daluu / index.html
Last active November 22, 2017 22:50
Cumulative Histogram with CDF line
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
@daluu
daluu / dataset.csv
Last active February 10, 2016 21:08
Histogram with CDF line overlaid using nvd3.js
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Distance
2.4059769174850905
2.7600000000000002
3.8217080187144488
2.3899284588203313
3.7264403738739054
7.63
3.16
3.1600000000000006
3.160000000000001