Skip to content

Instantly share code, notes, and snippets.

Avatar

Jesse Khorasanee Tehsurfer

View GitHub Profile
View vue-plotly.min.js
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("plotly.js")):"function"==typeof define&&define.amd?define("vue-plotly",["plotly.js"],n):"object"==typeof exports?exports["vue-plotly"]=n(require("plotly.js")):t["vue-plotly"]=n(t["plotly.js"])}("undefined"!=typeof self?self:this,function(t){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=23)}([function(t,n){function e(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}t.exports=e},function(t,n,e){var r=e(14),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this"
@Tehsurfer
Tehsurfer / tabtouch_template.py
Created Jan 6, 2020
This document is to define the inputs and formatting outputs of the soon to be developed tabtouch scraper
View tabtouch_template.py
# This document is to define the inputs and formatting outputs of the soon to be developed tabtouch scraper
# Inputs:
# date: string in form yyyy-mm-dd e.g. '2019-12-31'
# event: sting of even name e.g. 'Albury'
# race: int of race number e.g. 1
# Outputs:
# odds: Either a python dictionary, json file, or json formatted string as defined below
View tabtouch_scrape_example.js
// How to use this example:
// 1. Navigate to a race's odds page. This can be found by navigating to:
// https://www.tabtouch.com.au/racing/<today's date>/<meeting abbreviation>/1
// 2. Paste the code below into the chrome console and run
// Results: First horses name and odds should be printed to console
parent = document.querySelector("tr[data-starter='1']")
View dendrogram-heatmap.py
import plotly.graph_objects as go
import plotly.figure_factory as ff
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import numpy as np
from scipy.spatial.distance import pdist, squareform
import pandas as pd
@Tehsurfer
Tehsurfer / bf_download.py
Created Sep 2, 2019
Downloads a blackfynn collection to folder
View bf_download.py
import requests
from blackfynn import Blackfynn
from config import API_SECRET, API_TOKEN
import os
bf = Blackfynn(api_token=API_SECRET,api_secret=API_TOKEN)
collection = 'N:collection:0eed07e7-d147-4a2c-9411-1ea8f9ceffa5'
folder = 'downloads/'
file_type = '.abf'
@Tehsurfer
Tehsurfer / json_storage.py
Last active Aug 16, 2019
Python functions to create, update and get jsonstorage.net files
View json_storage.py
import requests
# Update or create storage bin
def put_json_storage(to_publish, storage_name):
headers = {'Content-Type': "application/json; charset=utf-8",'dataType': "json"}
data = json.dumps({'data': to_publish})
url = f'https://jsonstorage.net/api/items/{storage_name}'
resp = requests.put(url, headers=headers, data=data)
if resp.status_code == 200 or 201:
print(f'Data successfull uploaded: {resp.json()})')
@Tehsurfer
Tehsurfer / remap_electrodes.py
Created Jun 27, 2019
Used for mapping electrodes from 'book like labelling' to the true positions
View remap_electrodes.py
node_remap_array = [8, 16, 24, 32, 41, 33, 57, 49,
7, 15, 23, 31, 42, 34, 58, 50,
6, 14, 22, 30, 43, 35, 59, 51,
5, 13, 21, 29, 44, 36, 60, 52,
4, 12, 20, 28, 45, 37, 61, 53,
3, 11, 19, 27, 46, 38, 62, 54,
2, 10, 18, 26, 47, 39, 63, 55,
1, 9, 17, 25, 48, 40, 64, 56]
node_remap_dict = {}
@Tehsurfer
Tehsurfer / arrow-nav.js
Last active Jun 10, 2019
Surf2surf.com video navigator
View arrow-nav.js
video = document.getElementsByTagName('video')[1]
window.addEventListener('keyup', function(e){
if (e.which == 37){
video.currentTime -= 5
} if (e.which == 39){
video.currentTime += 5
}
});
View Finding local coordinate vectors
xl = np.array([3,4,0])
xi = xl/np.linalg.norm(xi)
yl = np.array([4,3,0])
norm = np.cross(yl,xi)
zi = norm/np.linalg.norm(norm)
yi = np.cross(zi,xi)
yi = yi/np.linalg.norm(yi)
#Transormation Matrix TM
TM = np.vstack([xi,yi,zi]).T
@Tehsurfer
Tehsurfer / strains.py
Created Jan 17, 2019
Strains calculation (xyz comparing by index)
View strains.py
def getPortData(self, index):
"""
Add your code here that will return the appropriate objects for this step.
The index is the index of the port in the port list. If there is only one
provides port for this step then the index can be ignored.
:param index: Index of the port to return.
"""
# Data can be pasted here to send to other steps for testing, or grabbed from a file if we have larger data
You can’t perform that action at this time.