Skip to content

Instantly share code, notes, and snippets.

View damienpontifex's full-sized avatar

Damien Pontifex damienpontifex

View GitHub Profile
pip3 install -U jupyter
# Thememes
# jt -t grade3 -cellw 90% # light theme
# jt -t oceans16 -cellw 90% # dark theme
pip3 install -U jupyterthemes
# Extensions - enable collapsible headings under Nbextensions tab when viewing home of jupyter
pip3 install -U jupyter-contrib-nbextensions
# Run interactive python tensorflow container
docker run --rm -it --name py-tf --entrypoint python tensorflow/tensorflow:1.3.0-py3
# Run jupyter notebook container
docker run --rm -dit -p 8888:8888 -p 6006:6006 -v "${PWD}":/notebooks --name notebook tensorflow/tensorflow:1.3.0-py3
# Run on ubuntu server with GPU and have it run on startup
nvidia-docker run -dit \
-p 8888:8888 -p 6006:6006 \
-v /home/nbs:/notebooks \
# Kudos to http://www.lieben.nu/liebensraum/2017/07/transferring-a-domain-to-azure-dns-and-billing/
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DomainRegistration
$rgName = "NAME OF YOUR RESOURCE GROUP"
$ResourceLocation = "Global"
$ResourceName = "MYDOMAINNAME.NL"
$PropertiesObject = @{
'Consent' = @{
'AgreementKeys' = @("DNPA","DNTA");
'AgreedBy' = '122.13.11.20'; #ip address you're running this script from
@damienpontifex
damienpontifex / FilesController.cs
Last active August 24, 2017 03:25
Drag and drop upload of files to ASP.NET API endpoint. Streams file vs using a FormData instance
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers
{
[Route("api/[controller]")]
@damienpontifex
damienpontifex / tf-experiment-template.py
Last active March 9, 2021 09:43
A template for a custom tensorflow estimator and experiment with python3 typings for desired parameter types
import argparse
import psutil
import tensorflow as tf
from typing import Dict, Any, Callable, Tuple
## Data Input Function
def data_input_fn(data_param,
batch_size:int=None,
shuffle=False) -> Callable[[], Tuple]:
"""Return the input function to get the test data.
@damienpontifex
damienpontifex / mnist-to-tfrecord.py
Created September 18, 2017 03:12
Convert the MNIST dataset to TFRecords
#! /usr/env/bin python3
"""Convert MNIST Dataset to local TFRecords"""
import argparse
import os
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
@damienpontifex
damienpontifex / directories-to-tfrecords.py
Created September 18, 2017 06:20
Convert recursive directories to TFRecords
#! /usr/env/bin python3
import argparse
import os
import sys
import glob
import pickle
import tensorflow as tf
import numpy as np
from PIL import Image
# In local tensorflow repo
# git clone https://github.com/tensorflow/tensorflow.git
# cd tensorflow
TAG=v1.4.0-rc1
git pull
git checkout "$TAG"
./configure # Enter for all defaults
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.2 -k //tensorflow/tools/pip_package:build_pip_package
@damienpontifex
damienpontifex / Understanding TF RNNs.ipynb
Last active May 10, 2020 00:38
Getting my head around TensorFlow RNN inputs, outputs and the appropriate shapes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Run via
# iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/damienpontifex/cecc18d4263ca6912b98a333544a485e/raw/initial-setup.ps1'))
Set-ExecutionPolicy Bypass -Scope Process -Force;
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install googlechrome vscode git powershell-core