Skip to content

Instantly share code, notes, and snippets.

Robin Winslow nottrobin

Block or report user

Report or block nottrobin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nottrobin
nottrobin / test-devun.sh
Last active Jun 14, 2019
Test out the devrun snap with ubuntu.com
View test-devun.sh
snap install --devmode --beta dotrun
git clone -b dotrun git@github.com:nottrobin/ubuntu.com ubuntu-dotrun
cd ubuntu-dotrun
dotrun serve --watch
View developer-redirects.conf
Redirect permanent /static/resources/ubuntu-core-16-security-whitepaper.pdf https://www.ubuntu.com/internet-of-things/core
Redirect permanent /core/get-started/raspberry-pi-2-3 https://www.ubuntu.com/download/iot/raspberry-pi-2-3
Redirect permanent /core/get-started/installation-medias https://www.ubuntu.com/download/iot/installation-media
Redirect permanent /core/get-started https://www.ubuntu.com/download/iot
Redirect permanent / https://www.ubuntu.com/desktop/developers
Redirect permanent /core https://www.ubuntu.com/download/iot
Redirect permanent /core/get-started/intel-nuc https://www.ubuntu.com/download/iot/intel-nuc
Redirect permanent /core/get-started/developer-setup https://forum.snapcraft.io
Redirect permanent /core/get-started/kvm https://www.ubuntu.com/download/iot/kvm
Redirect permanent /core/examples/snaps-on-mir https://tutorials.ubuntu.com/tutorial/secure-ubuntu-kiosk
@nottrobin
nottrobin / target-urls.py
Created May 15, 2019
Get target URLs from a redirect mapping
View target-urls.py
#! /usr/bin/env python3
import requests
from urllib.parse import urlparse
import yaml
for path, location in yaml.load(open("redirect-source.yaml")).items():
response = requests.get(f"http://docs.snapcraft.io{location}")
if response.ok:
@nottrobin
nottrobin / renovate.json
Created May 9, 2019
Webteam default renovate config
View renovate.json
{
"extends": [
"config:base",
"schedule:monthly",
"group:all"
],
"packageRules": [
{
"depTypeList": ["devDependencies"],
"extends": [":automergeMinor"]
View karls-branch.diff
diff --git a/docs/.env b/docs/.env
index b24647eb..9f09d4cb 100644
--- a/docs/.env
+++ b/docs/.env
@@ -1 +1,2 @@
-PORT=8104
\ No newline at end of file
+PORT=8104
+FLASK_DEBUG=true
\ No newline at end of file
@nottrobin
nottrobin / yarn-npm-speed-test.md
Last active Apr 17, 2019
Benchmark tests for Yarn vs NPM speed
View yarn-npm-speed-test.md

Yarn vs NPM speed test

Work in progress

I recently made a claim on Twitter that yarn is still significantly faster than npm for installing NodeJS dependencies.

My belief here was based on some light research I did near the end of 2017, not too long after NPM 5 was released claiming huge speed improvements. I found a blog post at the time claiming Yarn was still faster, and then did some light testing which confirmed this for me, by a large margin.

However, my assertion was challenged:

View blog-prometheus-metrics
# HELP wsgi_latency Multiprocess metric
# TYPE wsgi_latency histogram
wsgi_latency_sum{method="GET",status="200",view="flask.helpers.static"} 23.605999999999998
wsgi_latency_sum{method="GET",status="200",view="app.homepage"} 8083.161
wsgi_latency_sum{method="GET",status="304",view="flask.helpers.static"} 5.361
wsgi_latency_sum{method="GET",status="200",view="app.cloud_and_server"} 2901.036
wsgi_latency_bucket{le="4.0",method="GET",status="200",view="flask.helpers.static"} 4.0
wsgi_latency_bucket{le="8.0",method="GET",status="200",view="flask.helpers.static"} 7.0
wsgi_latency_bucket{le="16.0",method="GET",status="200",view="flask.helpers.static"} 7.0
wsgi_latency_bucket{le="32.0",method="GET",status="200",view="flask.helpers.static"} 7.0
@nottrobin
nottrobin / first-non-ready-pod.sh
Last active Mar 14, 2019
Get first non-ready kubernetes pod
View first-non-ready-pod.sh
app=maas.io
deployment_failed_reason=$(kubectl get deployment --namespace staging --selector app=${app} -o=jsonpath='{.items[0].status.conditions[1].reason}')
if [ "${deployment_failed_reason}" == "ProgressDeadlineExceeded" ]; then
non_ready_pod=$(kubectl get pod --namespace staging --selector app=${app} --output json | jq -r '(.items | map(select(.status.containerStatuses[0].ready==false)))[0].metadata.name')
kubectl logs ${non_ready_pod} --namespace staging
fi
View replace-images.py
#! /usr/bin/env python3
# Standard library
import re
from io import BytesIO
from glob import glob
from PIL import Image
from urllib.parse import urlparse, parse_qs
from urllib.request import urlopen
from xml.etree import ElementTree
@nottrobin
nottrobin / converting-juju-docs.sh
Last active Feb 15, 2019
Converting juju docs
View converting-juju-docs.sh
# Get juju-docs and discoursifier
git clone -b devel https://github.com/juju/docs ~/git/juju-docs
git clone https://github.com/canonical-webteam/discoursifier ~/git/discoursifier
# Setup python venv for discoursifier
python3 -m venv ~/git/discoursifier/env3
source ~/git/discoursifier/env3/bin/activate
pip install -r ~/git/discoursifier/requirements.txt
# Enter the documentation directory
You can’t perform that action at this time.