Skip to content

Instantly share code, notes, and snippets.

[[0.000371072813,0.126366559486,0.131666297854,0.057443915704,0.049873459507,0.092381523695,0.097061581744,0.160873312267,0.028975265018,0.217065868263,0.033786137234,0.127082127468,0.174856870229,0.057544197444,0.023246308691,0.114337751695,0.000000000000,0.141142217245,0.041973490427,0.086934228313,0.040086090934,0.142896935933,0.209812782440,0.063559322034,0.062726176116,0.082770270270],[0.039251257525,0.046302250804,0.000000000000,0.005098572400,0.006574603873,0.001399720056,0.001875586121,0.005314564780,0.013562173986,0.000000000000,0.009056078022,0.003087015242,0.054270038168,0.002625590758,0.020180861391,0.001821309319,0.000000000000,0.011198208287,0.002435708621,0.002656971053,0.033449914806,0.000000000000,0.012911555842,0.000000000000,0.020506634499,0.000000000000],[0.063494681290,0.001929260450,0.017407981117,0.003399048266,0.036641725352,0.000399920016,0.000000000000,0.001005458202,0.070233888608,0.000000000000,0.000696621386,0.004694835681,0.002146946565,0.062926658498,0.032136105860,0.00121420621
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"name";"color"
"a";"#f44336"
"b";"#ff5252"
"c";"#e91e63"
"d";"#ff4081"
"e";"#9c27b0"
"f";"#e040fb"
"g";"#673ab7"
"h";"#7c4dff"
"i";"#3f51b5"
@CarlBoneri
CarlBoneri / b64
Created September 4, 2021 15:38
b64
dGFsbHkgPSBsYW1iZGEgbjogbGlzdCgxIGZvciBfIGluIHJhbmdlKG4pKTtsZW4oW2kgZm9yIGkgaW4gKHRhbGx5KG4pIGZvciBuIGluIFs0LCAxNF0pIGZvciBpIGluIGldKQ==
@CarlBoneri
CarlBoneri / jnbook.txt
Created November 6, 2020 02:41
Blog post re html and js in jupyter
http://jakevdp.github.io/blog/2013/06/01/ipython-notebook-javascript-python-communication/
@CarlBoneri
CarlBoneri / improve_mermaid_for_r.md
Last active September 21, 2020 00:43
fixing mermaidjs shapes and updates in R

After following the below steps..: POST

Workaround for DiagrammeR

The DiagrammeR R-package is fine, but over the years I have had to find tons of workarounds for either the css-styling, and most recently the massive updates and new shapes that are available. So here's some resources to help you out should you run into any of the same issues I have.

Here's how to do it:

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mermaid=e():t.mermaid=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){retur
@CarlBoneri
CarlBoneri / hue_api.R
Last active April 1, 2021 16:36
Access Phillips HUE from terminal... because why not
hue.env <- function(e_name = ".hue", get_var = c("api_url", "bridge_id", "username")){
if(!exists(e_name)){
assign(e_name, new.env(), envir = .GlobalEnv)
}else {
e <- get(e_name, envir = .GlobalEnv)
@CarlBoneri
CarlBoneri / gist:80a1657f98c701bfb8ac6e0cbe1dce0e
Created March 18, 2020 23:54 — forked from rafaan/gist:4ddc91ae47ea46a46c0b
Convert Nested JSON to Pandas DataFrame and Flatten List in a Column
import json
from pandas.io.json import json_normalize
import pandas as pd
with open('C:\filename.json') as f:
data = json.load(f)
df = pd.DataFrame(data)
normalized_df = json_normalize(df['nested_json_object'])
ll_lapply <- function (X, FUN, ..., mc.preschedule = TRUE, mc.set.seed = TRUE,
mc.silent = FALSE, mc.cores = getOption("mc.cores", 2L),
mc.cleanup = TRUE, mc.allow.recursive = TRUE, affinity.list = NULL)
{
cores <- as.integer(mc.cores)
if ((is.na(cores) || cores < 1L) && is.null(affinity.list))
stop("'mc.cores' must be >= 1")
.check_ncores(cores)
if (isChild() && !isTRUE(mc.allow.recursive))
return(lapply(X = X, FUN = FUN, ...))
@CarlBoneri
CarlBoneri / d3js_v4_force_all.markdown
Last active September 5, 2019 09:06
D3JS_v4_force_all