Skip to content

Instantly share code, notes, and snippets.

View jperl's full-sized avatar

Jon Perl jperl

View GitHub Profile
@jdmichaud
jdmichaud / Compressed UDP feed
Last active July 28, 2022 16:47
Create a virtual monitor and stream it
# Transmit a x264 compressed low latency feed using udp
server: gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! rtph264pay ! udpsink host=%d port=9002
client: gst-launch-1.0 udpsrc port=9002 caps='application/x-rtp' ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false async=false
@notakaos
notakaos / create_function_plv8_cuid.sql
Last active March 13, 2024 02:07
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
@Dref360
Dref360 / coordconv2d.py
Last active February 11, 2020 14:40
Un-scaled version of CoordConv2D
import keras.backend as K
import tensorflow as tf
from tensorflow.keras.layers import Layer
"""Not tested, I'll play around with GANs soon with it."""
from tensorflow.keras.layers import Conv2D
import numpy as np
class CoordConv2D(Layer):
@sseveran
sseveran / ray_tune_reporter_hook.py
Created June 15, 2018 15:42
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
@hlzz
hlzz / gist:ba6da6e692beceb4da8b4d5387a8eacc
Created February 28, 2018 09:03
Generate sprite images for tensorboard
#!/usr/bin/python
from PIL import Image
import math
test_image_list = '/home/tianwei/Data/sfm_data/test_image_list' # path to the image list
with open(test_image_list, 'r') as f:
test_images = f.readlines()
test_images = map(str.strip, test_images)
@datlife
datlife / mnist_tfdata.py
Last active May 24, 2023 02:03
Training Keras model with tf.data
"""An example of how to use tf.Dataset in Keras Model"""
import tensorflow as tf # only work from tensorflow==1.9.0-rc1 and after
_EPOCHS = 5
_NUM_CLASSES = 10
_BATCH_SIZE = 128
def training_pipeline():
# #############
# Load Dataset
@peterroelants
peterroelants / mnist_estimator.py
Last active February 14, 2024 11:26
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
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active April 24, 2024 19:11
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@mjdietzx
mjdietzx / residual_network.py
Last active March 26, 2024 06:33
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
@shareefhiasat
shareefhiasat / import-rds-certs.sh
Last active March 6, 2023 19:21 — forked from steini/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