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 / nginx-sigterm.Dockerfile
Created Nov 15, 2019
nginx with SIGTERM immediately exits
View nginx-sigterm.Dockerfile
FROM nginx
RUN echo 'server {\n\
listen 80 default_server;\n\
location / {\n\
proxy_pass http://httpbin.org/delay/10;\n\
}\n\
}' > /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"]
@nottrobin
nottrobin / nginx-sigquit.Dockerfile
Created Nov 15, 2019
nginx should use STOPSIGNAL SIGQUIT
View nginx-sigquit.Dockerfile
FROM nginx
RUN echo 'server {\n\
listen 80 default_server;\n\
location / {\n\
proxy_pass http://httpbin.org/delay/10;\n\
}\n\
}' > /etc/nginx/conf.d/default.conf
STOPSIGNAL SIGQUIT
@nottrobin
nottrobin / why-monzo-should-be-open-source.md
Last active Nov 5, 2019
Why Monzo should be open source
View why-monzo-should-be-open-source.md

A reply to the "Is Mondo open source" forum thread from 2016:


I know this was years ago, so I’d love it if, but I’m not hopeful that, Monzo’s attitude to Open Source might have changed.

This was such a painful thread to read. Yes, it’s unthinkable that a regular bank would open-source their code, in the same way that it’s unfortunately unthinkable that they would have reduced transaction time if they hadn’t been forced to, or that they would use standard 2-factor authentication methods. The banking sector have various delusions:

  • firstly their security needs are different from (greater than?) the rest of the tech industry, and so they need different methods
  • secondly that their use cases are legitimately so much more complicated, so they can’t possibly use the same tools and practices as the rest of software
@nottrobin
nottrobin / convert-django-to-jinja2-with-statements.sh
Created Aug 22, 2019
Convert Django templates' `{% include with ... %}` syntax to Jinja2's `{% with ... %}{% include %}{% endwith %}`
View convert-django-to-jinja2-with-statements.sh
find templates -name '*.html' -exec perl -p -i -e "s/ *[{]% +include +\"(.*)[\"'] +with +([^=]+)=[\"']([^\"]*)[\"'] *%[}]/{% with \$2=\"\$3\" %}\n {% include \"\$1\" %}\n{% endwith %}/" {} \;
find templates -name '*.html' -exec perl -p -i -e "s/ *[{]% +include +\"(.*)[\"'] +with +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] *%[}]/{% with \$2=\"\$3\",\n \$4=\"\$5\" %}\n {% include \"\$1\" %}\n{% endwith %}/" {} \;
find templates -name '*.html' -exec perl -p -i -e "s/ *[{]% +include +\"(.*)[\"'] +with +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] *%[}]/{% with \$2=\"\$3\",\n \$4=\"\$5\",\n \$6=\"\$7\" %}\n {% include \"\$1\" %}\n{% endwith %}/" {} \;
find templates -name '*.html' -exec perl -p -i -e "s/ *[{]% +include +\"(.*)[\"'] +with +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] +([^=]+)=[\"']([^\"]*)[\"'] *%[}]/{% with \$2=\"\$3\",\n \$4=\"\$5\",\n \$6=\"\$7\",\n \$8=\"\$9\" %}\n {% include \"\$1\" %}\n{% endwith
@nottrobin
nottrobin / 1-concurrent_requests.py
Last active Aug 12, 2019
Compare time for concurrent requests in aiohttp vs grequests
View 1-concurrent_requests.py
#! /usr/bin/env python3
import asyncio
import grequests
from aiohttp import ClientSession
from timeit import default_timer
# aiohttp concurrent requests code from:
# https://gist.github.com/Den1al/2ede0c38fa4bc486d1791d86bcf9034e
@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
You can’t perform that action at this time.