Skip to content

Instantly share code, notes, and snippets.

View asherp's full-sized avatar

Asher Pembroke asherp

View GitHub Profile
@asherp
asherp / jupyter_pass.py
Created March 25, 2021 17:45
Sets up a jupyter notebook server password by from the environment variable JUPYTER_PASSWORD (python3 compatible)
# -*- encoding: utf-8 -*-
# modified for python3 https://stackoverflow.com/a/48806794/2793333
import os
import fileinput
import hashlib
import random
from ipython_genutils.py3compat import cast_bytes, str_to_bytes
# Get the password from the environment
@asherp
asherp / nft_bitcoiners.md
Last active April 7, 2021 04:03
NFTs: A Bitcoiner's Perspective

NFTs: A Bitcoiner's Perspective

Non-fungible tokens (NFTs) are becoming a popular way for artists to monetize their content. Recently, many bitcoiners have maligned the model as illigitimate, calling them scams or the like. As someone who attempted the same model with colored coins in 2012, I would have thought bitcoiners would understand why this model not only fits within the ethos of bitcoin, but is very likely to succeed for similar reasons. I believe success in the NFT model only improves the likelihood of mainstream success of bitcoin. Ironically, bitcoin influencers are using the same arguments made against bitcoin to denounce NFTs. Let's examine each of these arguments and how they have been applied to bitcoin in the past. My hope is that this will sway bitcoiners to not write them off as a mere phase akin to ICOs, but as a growing part of the virtual economy and a sign of things to come.

Addressing Technical Concerns

Technical implementations are not the issue

Some bitcoiners take issue wi

@asherp
asherp / FrechetDistance.py
Last active March 12, 2021 22:26
Frechet Distance (iterative version)
"""Original Code from Tim Wylie http://www.cs.montana.edu/~timothy.wylie/frechet/
A. Pembroke added modifications to combine frechet distance with closest ordered pairs
and implemented an iterative version of the original recursive discrete frechet calculation, df_iterative.
"""
##############################################################################################################
##############################################################################################################
## File: fpact_frechet.py
## Author: Tim Wylie
## Copyright: Tim Wylie
@asherp
asherp / lsqlin.py
Last active August 27, 2019 15:53
python3 implementation of matlab's lsqlin. requires cvxopt
#!/usr/bin/python
# Derived from: https://github.com/KasparP/PSI_simulations/blob/master/Python/SLAPMi/lsqlin.py
# See http://maggotroot.blogspot.ch/2013/11/constrained-linear-least-squares-in.html for more info
'''
A simple library to solve constrained linear least squares problems
with sparse and dense matrices. Uses cvxopt library for
optimization
'''
__author__ = 'Valeriy Vishnevskiy'
__email__ = 'valera.vishnevskiy@yandex.ru'
@asherp
asherp / time_avg.py
Created June 15, 2018 15:41
windowed time average
def windowed_time_average(data, window = 3):
window = 3
results = []
for i in range(len(data)):
if i < window:
results.append(np.sum(data[:i+1])/window)
else:
results.append(np.sum(data[i-window+1:i+1])/window)
return np.array(results)
@asherp
asherp / plotly_camera_on_update.py
Last active June 13, 2018 18:38
Demonstrates saving state of previous camera when a new graph loads
import dash
from dash.dependencies import Input, Output, State, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
class dccType(object):
@asherp
asherp / plotly_dash_objects.py
Last active October 1, 2020 20:21
object-orient plotly dash elements
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
class dccType(object):
"""
Object-Orient dash component
"""
def __init__(self, divtype, component_property='value', string=str, **kwargs):
@asherp
asherp / filled_line_plot.py
Last active June 9, 2018 14:59
Filled line color plot [plotly]. Uses interpolating bezier shape to mask a color contour plot.
'''Bezier interpolation method based on
http://www.antigrain.com/research/bezier_interpolation/
'''
import numpy as np
import plotly.graph_objs as go
import colorlover as cl
def roll_forward(a, steps = 1, axis = 0):
return np.roll(a, steps, axis = axis)
@asherp
asherp / designer.html
Created October 4, 2014 20:46
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;
@asherp
asherp / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;