Skip to content

Instantly share code, notes, and snippets.

@aidanhmiles
aidanhmiles / panel_fileinput_demo.py
Last active Nov 8, 2020
This Python script demonstrates how to run analyses on user-submitted data files using Panel. It runs a Holoviz Panel webpage with a single Plotly line chart which is fed by a FileInput that accepts only CSVs.
View panel_fileinput_demo.py
# python 3.7+
# install dependencies:
# pip install panel pandas plotly
# run it: panel serve --show thisfile.py
import io
import param
import panel as pn
import pandas as pd
import plotly.express as px
@aidanhmiles
aidanhmiles / promise-retry-1.js
Created May 11, 2017
One way to retry promises
View promise-retry-1.js
const lodash = require('lodash');
function main () {
// Arbitrary async operation. Sums two coin-flips (random 0 or 1). Only resolves when the sum is 0.
function asyncOperation() {
return new Promise((resolve, reject) => {
let sum = lodash(new Array(2))
.fill(null)
.map(() => Math.round(Math.random()))
@aidanhmiles
aidanhmiles / move_files.sh
Created Jan 31, 2017
Copy files from A to B, preserving directory hierarchy from wherever the script is executed
View move_files.sh
#!/usr/bin/env bash
main() {
local files=()
# Method 1
# while read -r fname; do
# derp+=("$fname")
# done < <(ag -g html base/)
View keybase.md

Keybase proof

I hereby claim:

  • I am aidanhmiles on github.
  • I am aidanhmiles (https://keybase.io/aidanhmiles) on keybase.
  • I have a public key ASCIzh8EBfOMVfl1XSEFphNxSNO2jvfLg1NdvAhlvokWqQo

To claim this, I am signing this object: