Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Kraus zbyte64

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

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.

https://www.genomicsplc.com

@colllin
colllin / adamw.py
Last active Jan 1, 2020
PyTorch AdamW optimizer
View adamw.py
# Based on https://github.com/pytorch/pytorch/pull/3740
import torch
import math
class AdamW(torch.optim.Optimizer):
"""Implements AdamW algorithm.
It has been proposed in `Fixing Weight Decay Regularization in Adam`_.
Arguments:
View tensorflow_pca.py
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
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
mcchae / image_diff.py
Created Aug 24, 2017
Python OpenCV Image diff
View image_diff.py
# USAGE
# python image_diff.py --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
aaearon / hdhr-listings-to-m3u.py
Last active Mar 14, 2022
Convert HDHomeRun Prime Listings to M3U Format
View hdhr-listings-to-m3u.py
#
# 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/hdhomerun-prime-listings-to-m3u.py > /path/to/playlist.m3u
#
@AndrewJHart
AndrewJHart / jwt_authentication.py
Created Apr 13, 2016
JWT authentication middleware for django rest framework that populates the request.user object
View jwt_authentication.py
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
kylemcdonald / showarray.py
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.
View showarray.py
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)
IPython.display.display(IPython.display.Image(data=f.getvalue()))
@domenic
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 http://underscorejs.org/#throttle
const fireProgressThrottled = _.throttle(fireProgress, 50, { trailing: false });
@RobertoSchneiders
RobertoSchneiders / deploy_with_ebcli3_on_circleci.md
Last active Oct 26, 2021
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)
View deploy_with_ebcli3_on_circleci.md

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:

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