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
@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 / 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
@jperl
jperl / mnist_estimator.py
Created January 6, 2018 16:19 — forked from peterroelants/mnist_estimator.py
Example using TensorFlow Estimator, Experiment & Dataset on MNIST data.
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
from tensorflow.contrib.learn import learn_runner
# Show debugging output
@jperl
jperl / import-rds-certs.sh
Created December 28, 2017 03:09 — forked from shareefhiasat/import-rds-certs.sh
import RDS certificates to java keystore on alpine / osx
#!/usr/bin/env sh
#i tried it and working like charm just have to note make the file .sh chmod +x and you may need sudo to run with permission but be carefull with sudo
#be sure the $JAVA_HOME is configure correctly or make it static as commentedline 7 below
OLDDIR="$PWD"
if [ -z "$CACERTS_FILE" ]; then
# you should have java home configure to point for example /usr/lib/jvm/default-java/jre/lib/security/cacerts
CACERTS_FILE=$JAVA_HOME/jre/lib/security/cacerts
fi
@jperl
jperl / import-rds-certs.sh
Created December 28, 2017 03:09 — forked from shareefhiasat/import-rds-certs.sh
import RDS certificates to java keystore on alpine / osx
#!/usr/bin/env sh
#i tried it and working like charm just have to note make the file .sh chmod +x and you may need sudo to run with permission but be carefull with sudo
#be sure the $JAVA_HOME is configure correctly or make it static as commentedline 7 below
OLDDIR="$PWD"
if [ -z "$CACERTS_FILE" ]; then
# you should have java home configure to point for example /usr/lib/jvm/default-java/jre/lib/security/cacerts
CACERTS_FILE=$JAVA_HOME/jre/lib/security/cacerts
fi