Skip to content

Instantly share code, notes, and snippets.

View kebman's full-sized avatar
🕺
Coding & Dancing WCS

kebman kebman

🕺
Coding & Dancing WCS
View GitHub Profile
@kebman
kebman / compounding1.py
Created August 2, 2019 03:05
Calculate compounding interest with this short Python script.
#!/usr/local/bin/python3.7
principal = 10000.0
interest_rate = 5.0
time_units = 10
def get_percentage(inputf, percentage):
return inputf * percentage / 100.0
def get_compounding(principalf, n):
@kebman
kebman / RastaniRibbon.pine
Created June 30, 2019 01:40
The Rastani Ribbon, based on Alessio Rastani's moving averages
// See: Here's Exactly WHEN I am Buying Bitcoin. Alessio Rastani. Published on 8 Jun 2019. https://youtu.be/TiUUJxdynaY
study(title = "Rastani Ribbon", shorttitle="Rastani Ribbon", overlay=true)
src0 = close, len1 = input(21, minval=1, title="MA Length")
src1 = close, len2 = input(55, minval=1, title="MA Length")
src2 = close, len3 = input(100, minval=1, title="EMA Length")
src3 = close, len4 = input(100, minval=1, title="MA Length")
src4 = close, len0 = input(200, minval=1, title="MA Length")
sma1 = sma(src1, len1)
@kebman
kebman / USDNOKslider.html
Last active September 16, 2018 22:02
USD/NOK Currency Slider in HTML5
<!DOCTYPE html>
<html>
<head>
<title>USD/NOK Slider</title>
<meta charset="utf-8">
<style type="text/css">
.slidecontainer {
width: 20em; /* Width of the outside container */
}
/* Slider */
@kebman
kebman / EURUSDslider.html
Created September 16, 2018 22:00
EUR/USD Currency Slider in HTML5
<!DOCTYPE html>
<html>
<head>
<title>EUR/USD Slider</title>
<meta charset="utf-8">
<style type="text/css">
.slidecontainer {
width: 20em; /* Width of the outside container */
}
/* Slider */
@kebman
kebman / EURNOKslider.html
Created September 16, 2018 22:00
EUR/NOK Currency Slider in HTML5
<!DOCTYPE html>
<html>
<head>
<title>EUR/NOK Slider</title>
<meta charset="utf-8">
<style type="text/css">
.slidecontainer {
width: 20em; /* Width of the outside container */
}
/* Slider */
@kebman
kebman / mousePos2.html
Created August 9, 2018 13:13
Short HTML5 + JavaScript that tracks mouse position only while the mouse button is clicked down
<!DOCTYPE html>
<html>
<head>
<title>Track Mouse Position II</title>
<meta charset="utf-8">
<style type="text/css"></style>
</head>
<body>
<header>
<h1>Track Mouse Position II</h1>
@kebman
kebman / mousePos1.html
Created August 9, 2018 13:11
Short HTML5 + JavaScript that tracks mouse position
<!DOCTYPE html>
<html>
<head>
<title>Track Mouse Position I</title>
<meta charset="utf-8">
<style type="text/css"></style>
</head>
<body>
<header>
<h1>Track Mouse Position I</h1>
@kebman
kebman / coinbaseData.html
Last active August 2, 2018 09:59
Visualisation of Coinbase Pro market data using JavaScript Canvas
<!DOCTYPE html>
<html>
<head>
<title>Coinbase Pro Market Data</title>
<meta charset="utf-8">
<style type="text/css"></style>
</head>
<body>
<header>
<h1>Coinbase Pro Market Data</h1>
@kebman
kebman / median.js
Created July 22, 2018 20:10
Find the median of an array of numbers using JavaScript
function median(arr) {
let middle = Math.floor((arr.length-1)/2);
if (arr.length % 2) {
return arr[middle]; // odd
} else {
return (arr[middle]+arr[middle+1])/2; // even
}
}
@kebman
kebman / slowServer.js
Last active July 18, 2018 01:15
A minimal ‘slow’ server to test API calls with callbacks and promises
'use strict';
/*
* Before you start, make sure you've done the following:
* mkdir slowServer
* cd slowServer
* $ npm init
* $ npm install express --save
* Then copy this file to the slowServer directory
*/