Skip to content

Instantly share code, notes, and snippets.

View pangyuteng's full-sized avatar

pangyuteng

View GitHub Profile
@pangyuteng
pangyuteng / .gitignore
Last active April 5, 2023 16:57 — forked from davidlares/Dockerfile
Scaling Nginx servers via Docker' (a Flask app)
**/__pycache__/*
@pangyuteng
pangyuteng / Dockerfile
Last active January 28, 2021 14:24 — forked from yochze/Dockerfile
Dockerfile to build Tensorflow 1.15.0 using nvidia-docker
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# install python 3.7 and pip
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
software-properties-common \
pkg-config \
rsync \
@pangyuteng
pangyuteng / keras_spatial_bias.py
Last active November 13, 2019 19:09 — forked from N-McA/keras_spatial_bias.py
Concatenates the (x, y) coordinate normalised to 0-1 to each spatial location in the image. Allows a network to learn spatial bias. Has been explored in at least one paper, "An Intriguing Failing of Convolutional Neural Networks and the CoordConv Solution" https://arxiv.org/abs/1807.03247
class ConcatSpatialCoordinate(Layer):
def __init__(self, **kwargs):
"""Concatenates the (x, y) coordinate normalised to 0-1 to each spatial location in the image.
Allows a network to learn spatial bias. Has been explored in at least one paper,
"An Intriguing Failing of Convolutional Neural Networks and the CoordConv Solution"
https://arxiv.org/abs/1807.03247
Improves performance where spatial bias is appropriate.
Works with dynamic shapes.
@pangyuteng
pangyuteng / ssh-airplane-wifi.md
Last active October 20, 2019 18:12 — forked from guillochon/ssh-airplane-wifi.md
Instructions on how to SSH on airplane WiFi that blocks port 22

Using SSH through airplane WiFi that blocks port 22 (via GCP and Ubuntu)

SUMMARY

Open WIFI often allow only traffic via http and https ports. This gist contains steps to allow you to ssh to a machine by first creating a VM, switching the ssh port to listen to port 80. So now, you can ssh (port 80) into the VM, in order to ssh (port 22) into your desired machine.

original gist by guillochon, this Fork contains reformatted steps, and I switched OS from CentOs to Ubuntu... just as an exercise to get famaliarized with GCP.

https://gist.github.com/guillochon/eeaa54b328952d260472c14c559f698a

Estimated time to complete the below steps is 5 to 10 minutes (assuming the internet connection is good, and GCP is operating smoothly).
@pangyuteng
pangyuteng / CMakeLists.txt
Last active July 12, 2019 21:30 — forked from ndevenish/CMakeLists.txt
Very simple "Getting started" boost-python CMakeLists.txt - added Dockerfile
cmake_minimum_required(VERSION 3.5)
# Find python and Boost - both are required dependencies
find_package(PythonLibs 2.7 REQUIRED)
find_package(Boost COMPONENTS python REQUIRED)
# Without this, any build libraries automatically have names "lib{x}.so"
set(CMAKE_SHARED_MODULE_PREFIX "")
# Add a shared module - modules are intended to be imported at runtime.
@pangyuteng
pangyuteng / jinja2_file_less.py
Created June 25, 2019 16:26 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@pangyuteng
pangyuteng / compile_run.sh
Created February 18, 2018 02:44 — forked from certik/compile_run.sh
Test offscreen rendering with VTK 6
#! /bin/bash
set -e
g++ -o test_offscreen.o -c test_offscreen.cpp -I$PYTHONHPC/include/vtk-6.0
g++ -o test_offscreen test_offscreen.o $PYTHONHPC/lib/libvtk*.so
LD_LIBRARY_PATH=$PYTHONHPC/lib/ ./test_offscreen
@pangyuteng
pangyuteng / AsyncNotify.py
Created May 11, 2017 15:39 — forked from pfote/AsyncNotify.py
postgres LISTEN/NOTIFY psycopg2/twisted
import psycopg2
import psycopg2.extensions
from select import select
from twisted.internet import threads
class AsyncNotify():
"""
based on http://divillo.com/, adapted to newer psycopg version
Class to trigger a function via PostgreSQL NOTIFY messages.