Skip to content

Instantly share code, notes, and snippets.

View jperl's full-sized avatar

Jon Perl jperl

View GitHub Profile
@jperl
jperl / create_function_plv8_cuid.sql
Created January 22, 2021 01:21 — forked from notakaos/create_function_plv8_cuid.sql
cuid for PostgreSQL with PL/v8
-- original code: https://github.com/ericelliott/cuid
-- Add the "plv8" extension
create extension if not exists "plv8";
-- Add the "pgcrypto" extension
create extension if not exists "pgcrypto";
\dx
-- Connect a database
@jperl
jperl / coordconv2d.py
Created May 14, 2019 21:32 — forked from Dref360/coordconv2d.py
Un-scaled version of CoordConv2D
import keras.backend as K
import tensorflow as tf
from keras.layers import Layer
"""Not tested, I'll play around with GANs soon with it."""
class CoordConv2D(Layer):
def __init__(self, channel, kernel, padding='valid', **kwargs):
self.layer = Conv2D(channel, kernel, padding=padding)
@jperl
jperl / ffmpeg.sh
Created April 27, 2019 13:46 — forked from kfei/ffmpeg.sh
Screen recording using a dockerized ffmpeg
#!/bin/bash
docker run -it --rm --privileged --net host \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $PWD:$HOME/workspace \
-v $HOME/.Xauthority:$HOME/.Xauthority \
-e HOME=$HOME \
-e DISPLAY=$DISPLAY \
--entrypoint /usr/sbin/ffmpeg \
kfei/ffmpeg $*
@jperl
jperl / ffmpeg.sh
Created April 27, 2019 13:46 — forked from kfei/ffmpeg.sh
Screen recording using a dockerized ffmpeg
#!/bin/bash
docker run -it --rm --privileged --net host \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $PWD:$HOME/workspace \
-v $HOME/.Xauthority:$HOME/.Xauthority \
-e HOME=$HOME \
-e DISPLAY=$DISPLAY \
--entrypoint /usr/sbin/ffmpeg \
kfei/ffmpeg $*
@jperl
jperl / dropout_bayesian_approximation_tensorflow.py
Created April 25, 2019 00:52 — forked from VikingPenguinYT/dropout_bayesian_approximation_tensorflow.py
Implementing Dropout as a Bayesian Approximation in TensorFlow
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.contrib.distributions import Bernoulli
class VariationalDense:
"""Variational Dense Layer Class"""
def __init__(self, n_in, n_out, model_prob, model_lam):
self.model_prob = model_prob
FLAGS = flags.FLAGS
if FLAGS.log_dir:
if not os.path.exists(FLAGS.log_dir):
os.makedirs(FLAGS.log_dir)
logging.get_absl_handler().use_absl_log_file()
@jperl
jperl / residual_network.py
Created January 12, 2019 19:31 — forked from mjdietzx/residual_network.py
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@jperl
jperl / bashrc
Last active January 4, 2019 00:27
ubuntu ml environment notes
# cuda
export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# python
alias env='source ./env/bin/activate'
@jperl
jperl / TroubleshootCUDA.md
Last active August 12, 2018 13:17
Troubleshooting Ubuntu 18.04 CUDA Install

"nvidia-smi has failed because it couldn't communicate with the NVIDIA driver"

@jperl
jperl / ray_tune_reporter_hook.py
Created July 7, 2018 13:11 — forked from sseveran/ray_tune_reporter_hook.py
A Tensorflow hook for reporting state to ray-tune
import six
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.training import training_util
from tensorflow.python.training.session_run_hook import SessionRunArgs
class RayTuneReportingHook(tf.train.SessionRunHook):
def __init__(self, params, reporter):
self.reporter = reporter