Skip to content

Instantly share code, notes, and snippets.


Shane Barratt sbarratt

View GitHub Profile
sbarratt /
Created May 9, 2019
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
y = net(x)
sbarratt /
Last active Nov 14, 2022
A script to export all FTX history
import pandas as pd
import time
import requests
import time
import hmac
from requests import Request
import sys
import json
import os
sbarratt /
Created Sep 26, 2022
ERC-20 Transfers as a Sparse Matrix
from ctc import evm
from scipy import sparse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
transfers = await evm.async_get_erc20_transfers(
sbarratt / keyboardhook.cpp
Created May 31, 2016
Create a keyboard hook using Win32 System API and log what the user types into a console.
View keyboardhook.cpp
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <iostream>
HHOOK hHook{ NULL };
enum Keys
ShiftKey = 16,
sbarratt /
Last active Jun 30, 2022
This script provides coordinate transformations between geodetic, ecef and enu in python. Based on
This script provides coordinate transformations from Geodetic -> ECEF, ECEF -> ENU
and Geodetic -> ENU (the composition of the two previous functions). Running the script
by itself runs tests.
based on
import math
a = 6378137
b = 6356752.3142
sbarratt / flash.go
Created Apr 11, 2021
flashbots http attempt
View flash.go
package main
import (
sbarratt /
Created Nov 3, 2017
K-means script that works with NaN entries.
Author: Shane Barratt
K-means script that works with NaN entries.
import numpy as np
import IPython as ipy
import matplotlib.pyplot as plt
View Presentation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sbarratt /
Last active Aug 15, 2016
Implementation of the 3-Base Periodicity Property:
import matplotlib.pyplot as plt
from numpy.fft import fft
from numpy.fft import fftshift
import numpy as np
import random
dictionary = ['A','C','G','T']
def generate_random_sequence(N):
return [dictionary[random.randint(0,len(dictionary)-1)] for _ in range(N)]
"""CNN from"""
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
import tensorflow as tf
def weight_variable(shape):
initial = tf.random_normal(shape, stddev=0.05)
return tf.Variable(initial)