Skip to content

Instantly share code, notes, and snippets.

View iiSeymour's full-sized avatar
🧬

Chris Seymour iiSeymour

🧬
  • Oxford Nanopore Technologies
  • Oxford
  • X @iiSeymour
View GitHub Profile
>>> import numpy as np
>>> read = np.array([
[0., 97., 0., 0.,],
[0., 4., 4., 87.,],
[71., 10., 2., 6.,],
[8., 5., 65., 9.,],
[7., 62., 11., 6.,],
[4., 19., 7., 55.,],
[51., 9., 6., 17.,],
[15., 4., 49., 12.,],
@iiSeymour
iiSeymour / LSTM.py
Created March 8, 2023 13:55
LSTM.py
import torch
import time
torch.backends.cudnn.benchmark = True
BATCH_SIZE = 64
LAYER_SIZE = 384
TIME_SERIES_LEN = 1600
NUM_LAYERS = 5
WARMUP_ROUNDS = 5
BENCHMARK_ROUNDS = 10
@iiSeymour
iiSeymour / benchmark_separable_convs.py
Last active March 3, 2023 02:29
Compare 1D Separable Convolutions in PyTorch and Tensorflow
#!/usr/bin/env python
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
import torch
import numpy as np
import tensorflow as tf
from time import perf_counter
@iiSeymour
iiSeymour / model.py
Created June 27, 2019 14:04
Symbolic patching for exporting torch.{min,max} with onnx
import torch
import torch.onnx.symbolic
def sym_patch(func, op1, op2):
def replace(g, node, dim_or_y=None, keepdim=None):
ops = func(g, node, dim_or_y, keepdim)
if type(ops) == tuple:
if ops[0].node().kind() == "onnx::ATen":
dim = torch.onnx.symbolic._get_const(dim_or_y, 'i', 'dim')
@iiSeymour
iiSeymour / logstash_trac.conf
Created October 19, 2013 23:57
Logstash configuration for filtering trac logs
filter {
grok {
type => "trac"
match => [ "message", "%{DATE-US} %{TIME},%{INT} Trac.%{WORD}. %{WORD:level}: %{GREEDYDATA:text}" ]
}
multiline {
type => "trac"
pattern => "%{DATE-US} %{TIME},%{INT} Trac.%{WORD}. ERROR: %{GREEDYDATA:text}"
@iiSeymour
iiSeymour / spotify.el
Last active December 19, 2015 10:29 — forked from mattdeboard/spotify.el
Play, pause and navigate Spotify tracks without leaving emacs.
;;; package --- Summary
;;; Small minor mode to control spotify from emacs.
;;; Commentary:
;;; Forked from mattdeboard, modified by iiSeymour.
;;; Save as ~/.emacs.d/spotify.el and throw a (require 'spotify) in your ~/.emacs
;;; Key Bindings:
;;; F9 - spotify-playpause()
;;; F8 - spotfiy-next()
#!/usr/bin/env python
#
# Short Python example of why `ls | wc -l` works by @iiSeymour
#
# try:
# python isatty.py
# and:
# python isatty.py | cat
#
# Explanation http://www.ginac.de/~kreckel/fileno/
@iiSeymour
iiSeymour / keybase.md
Created August 27, 2014 13:20
I am me.

Keybase proof

I hereby claim:

  • I am iiSeymour on github.
  • I am iiseymour (https://keybase.io/iiseymour) on keybase.
  • I have a public key whose fingerprint is 3589 AD45 A74E 7520 AD32 55FE ADB7 73F1 3207 A97E

To claim this, I am signing this object:

@iiSeymour
iiSeymour / boxplot.py
Last active August 29, 2015 14:05
Geckoboard Highchart Boxplot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
__URL__ = "http://push.geckoboard.com/v1/send/"
def push(chart, widgit_id, api_key):
@iiSeymour
iiSeymour / step.ipynb
Created June 4, 2014 16:46
mpld3 step
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.