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
@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]")]
# 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
# 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
# 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
@damienpontifex
damienpontifex / test.csv
Created July 9, 2018 05:40
Titanic dataset
PassengerId Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
892 3 Kelly, Mr. James male 34.5 0 0 330911 7.8292 Q
893 3 Wilkes, Mrs. James (Ellen Needs) female 47 1 0 363272 7 S
894 2 Myles, Mr. Thomas Francis male 62 0 0 240276 9.6875 Q
895 3 Wirz, Mr. Albert male 27 0 0 315154 8.6625 S
896 3 Hirvonen, Mrs. Alexander (Helga E Lindqvist) female 22 1 1 3101298 12.2875 S
897 3 Svensson, Mr. Johan Cervin male 14 0 0 7538 9.225 S
898 3 Connolly, Miss. Kate female 30 0 0 330972 7.6292 Q
899 2 Caldwell, Mr. Albert Francis male 26 1 1 248738 29 S
900 3 Abrahim, Mrs. Joseph (Sophie Halaut Easu) female 18 0 0 2657 7.2292 C
Function Get-RandomPassword
{
Param(
[Int]
$PasswordLength = 32
)
$allChars = [char[]](33..126)
$password = (Get-Random -InputObject $allChars -Count $PasswordLength) -join ''
return $password
}
# 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 \
#!/bin/bash
# Map variables retrieved from Key Vault to environment variables such as:
# env:
# CERT_DATA: $(certData)
# CERT_PASSWORD: $(certPassword)
# Read in the PFX data and save as pfx file
echo "${CERT_DATA}" | base64 --decode > cert.pfx