Skip to content

Instantly share code, notes, and snippets.

View FirefoxMetzger's full-sized avatar

Sebastian Wallkötter FirefoxMetzger

View GitHub Profile
@FirefoxMetzger
FirefoxMetzger / setup.sh
Created November 1, 2017 08:22
Setup of files to be exported to the server for post: https://wordpress.com/post/sebastianwallkoetter.wordpress.com/36
#!/bin/bash
mkdir -p ~/my_docker_registry_deploy_folder/certs
cd ~/my_docker_registry_deploy_folder/
docker pull registry:2
docker save -o registry.tar registry:2
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
x509_extensions = v3_ca # The extentions to add to the self signed cert
string_mask = utf8only
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = AU
countryName_min = 2
#!/bin/bash
openssl genrsa > certs/private.key
openssl req -new -x509 -config openssl.cnf -key certs/private.key -days 10000 > certs/certificate.crt
openssl x509 -in certs/certificate.crt -text -noout
version: '3'
services:
registry:
image: registry:2
ports:
- "443:5000"
volumes:
- "/var/lib/boot2docker/certs:/certs"
- "registry_data:/data"
#!/bin/bash
docker-machine scp -r . myRegistry:~
docker-machine ssh myRegistry docker load -i registry.tar
docker-machine ssh myRegistry sudo cp -r certs /var/lib/boot2docker
docker-machine ssh myRegistry docker stack deploy --compose-file=docker-compose.yml registry
@FirefoxMetzger
FirefoxMetzger / fully_connected_reader.py
Created November 21, 2017 11:45
fully_connected_reader.py using Dataset instead of Queues to feed into Tensorflow
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@FirefoxMetzger
FirefoxMetzger / upload_data.py
Created January 17, 2018 08:17
How to insert scores to scoreboard
import requests
# to be filled in by you
token = "" # if you have signed up at https://scoreboard-190810.appspot.com
# you can find it on the top left corner of the page
environment = "Test-v0" # name of the environment the agent is for
data = {
"name": "My Agent Name", # you wrote it, you get to name it =)
"score": "1337", # replace with actual score
@FirefoxMetzger
FirefoxMetzger / faster_fully_connected_reader.py
Created February 16, 2018 06:54
A modification to the tensorflow how_to fully_connected_reader.py that significantly improves performance
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@FirefoxMetzger
FirefoxMetzger / Residual_Layer.py
Created March 31, 2018 15:50
Create a residual layer in Keras to be used with Sequential() models
from keras.engine.topology import Layer
from keras.layers importActivation, Conv2D, Add
class Residual(Layer):
def __init__(self, channels_in,kernel,**kwargs):
super(Residual, self).__init__(**kwargs)
self.channels_in = channels_in
self.kernel = kernel
def call(self, x):
@FirefoxMetzger
FirefoxMetzger / cifar10_res.py
Last active August 4, 2021 19:49
a residual network using Keras' Sequential() API training on CIFAR10
'''Train a simple residual network on the CIFAR10 small images dataset.
It gets to 75% validation accuracy in 25 epochs, and 79% after 50 epochs.
(it's still underfitting at that point, though).
'''
from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator