Skip to content

Instantly share code, notes, and snippets.


Jason Kraus zbyte64

  • Kraus Dev House
  • Fresno, CA USA
View GitHub Profile
andy-thomason /
Created May 14, 2019
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

colllin /
Last active Jan 1, 2020
PyTorch AdamW optimizer
# Based on
import torch
import math
class AdamW(torch.optim.Optimizer):
"""Implements AdamW algorithm.
It has been proposed in `Fixing Weight Decay Regularization in Adam`_.
def tf_pca(x):
Compute PCA on the bottom two dimensions of x,
eg assuming dims = [..., observations, features]
# Center
x -= tf.reduce_mean(x, -2, keepdims=True)
# Currently, the GPU implementation of SVD is awful.
# It is slower than moving data back to CPU to SVD there
uchidama / pillow_with_opencv_findContours.ipynb
Last active Mar 1, 2022
Pillow to Opencv to find Contours, and back to Pillow Image.
View pillow_with_opencv_findContours.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
mcchae /
Created Aug 24, 2017
Python OpenCV Image diff
# python --first images/original_01.png --second images/modified_01.png
# import the necessary packages
from skimage.measure import compare_ssim
import argparse
import imutils
import cv2
# construct the argument parse and parse the arguments
aaearon /
Last active Mar 14, 2022
Convert HDHomeRun Prime Listings to M3U Format
# this script will convert the hdhomerun listings (channels) to
# m3u format for use with external media players. before running
# this script, be sure to modify the <<config>> variable settings
# below.
# Suggested Usage: This script should be run on a cron to keep
# the channel lineup to date. Below is an example of how to execute this script:
# python /path/to/script/ > /path/to/playlist.m3u
AndrewJHart /
Created Apr 13, 2016
JWT authentication middleware for django rest framework that populates the request.user object
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.models import AnonymousUser
from rest_framework.request import Request
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
Replacement for django session auth get_user & auth.get_user for
kylemcdonald /
Created Jan 3, 2016
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
import PIL.Image
from cStringIO import StringIO
import IPython.display
import numpy as np
def showarray(a, fmt='png'):
a = np.uint8(a)
f = StringIO()
PIL.Image.fromarray(a).save(f, fmt)
domenic / readable-stream-progress.js
Last active Feb 10, 2020
XHR-esque progress events on top of streams
View readable-stream-progress.js
function processBodyChunkwiseWithProgress(res, processChunk) {
const dummyEventTarget = document.createElement("div"); // why isn't EventTarget constructible? :(
const lengthComputable = res.headers.has("Content-Length");
const total = res.headers.get("Content-Length") || 0;
let loaded = 0;
// Using
const fireProgressThrottled = _.throttle(fireProgress, 50, { trailing: false });
RobertoSchneiders /
Last active Oct 26, 2021
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI 1.0.

If you are using the Circle CI 2.0, take a look at this article from ryansimms

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

    The aws user must have the right permissions. This can be hard, maybe, this can help you.