Skip to content

Instantly share code, notes, and snippets.

View PatWie's full-sized avatar
💭
waiting for the end of the AI hype

Patrick Wieschollek PatWie

💭
waiting for the end of the AI hype
View GitHub Profile
@PatWie
PatWie / ngrok-selfhosting-setup.md
Created June 16, 2017 19:56 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@PatWie
PatWie / letsencrypt_2017.md
Created June 6, 2017 17:48 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@PatWie
PatWie / distributed-tf-example.py
Last active April 27, 2017 15:58
distributed TensorFlow
# -*- coding: utf-8 -*-
# File: base.py
# Author: Patrick Wieschollek <[email protected]>
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
@PatWie
PatWie / update-tensorflow.sh
Last active December 4, 2019 18:24
simple cronjob script to frequently build TensorFlow from source automatically
#!/bin/bash
# Patrick Wieschollek
# =============================================================
# UPDATE SOURCE
# =============================================================
git checkout -- .
git pull origin master
@PatWie
PatWie / benchmark_staging.py
Created February 9, 2017 08:56
compare staging vs FIFO
import tensorflow as tf
from tensorflow.python.ops import data_flow_ops
import time
from contextlib import contextmanager
@contextmanager
def benchmark(name="unnamed context"):
elapsed = time.time()
yield
@PatWie
PatWie / npzmq.py
Created January 17, 2017 22:24 — forked from minrk/npzmq.py
Edited version of example script for farming out image saves via zmq ventilator
import numpy
import zmq
def send_array(socket, A, flags=0, copy=True, track=False):
"""send a numpy array with metadata"""
md = dict(
dtype = str(A.dtype),
shape = A.shape,
)
socket.send_json(md, flags|zmq.SNDMORE)
@PatWie
PatWie / zmqimage.py
Created January 17, 2017 22:22 — forked from jeffbass/zmqimage.py
zmqimage.py -- classes to send, receive and display OpenCV images from a headless computer to a display computer using cv2.imshow()
# zmqimage.py -- classes to send, receive and display cv2 images via zmq
# based on serialization in pyzmq docs and pyzmq/examples/serialization
'''
PURPOSE:
These classes allow a headless (no display) computer running OpenCV code
to display OpenCV images on another computer with a display.
For example, a headless Raspberry Pi with no display can run OpenCV code
and can display OpenCV images on a Mac with a display.
USAGE:
@PatWie
PatWie / tf_serialze.py
Last active March 19, 2017 06:07
create, save, destroy, load
import tensorflow as tf
# save
dummy = tf.Variable(tf.truncated_normal(shape=[10]), name='dummy')
with tf.Session() as sess:
saver = tf.train.Saver()
sess.run(tf.global_variables_initializer())
expected = sess.run(tf.reduce_sum(dummy))
saver.save(sess, 'model')
@PatWie
PatWie / depgen.py
Created September 21, 2016 18:22 — forked from rcludwick/depgen.py
Python ordering a build list by giving a dictionary of dependencies.
'''
These functions take a dictionary of dependencies in the following way:
depdict = { 'a' : [ 'b', 'c', 'd'],
'b' : [ 'c', 'd'],
'e' : [ 'f', 'g']
}
@PatWie
PatWie / scopes.txt
Created September 19, 2016 08:13 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee