View update_topics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from github import Github | |
token = "REPLACE_ME" | |
g = Github(token) | |
org = g.get_organization("canonical") | |
teams = org.get_teams() |
View find-changed-files.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
commit_id=$(git log --format="%H" -n 1) | |
articles=( $(git diff --name-only HEAD HEAD^ | egrep '^_articles') ) | |
for article in "${articles[@]}" | |
do | |
article_added_in=$(git log --pretty=format:"%H" --diff-filter=A -- $article) |
View curl-ubuntu-boston.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -I --resolve 91.189.91.44:443:ubuntu.com https://ubuntu.com | |
HTTP/2 200 | |
server: nginx/1.14.0 (Ubuntu) | |
date: Mon, 24 Aug 2020 22:21:24 GMT | |
content-type: text/html; charset=utf-8 | |
content-length: 68552 | |
vary: Accept-Encoding | |
strict-transport-security: max-age=15724800 | |
cache-control: max-age=61, stale-while-revalidate=90 | |
x-view-name: canonicalwebteam.templatefinder.templatefinder.template_finder |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- | |
# Features: | |
- Keep CSS inline: It will be small enough not to add much weight to the page, which means it's better to avoid the extra HTTP call to request CSS | |
- Use system fonts: But it's hard to find a nice system font for both Linux, Windows and MacOS | |
--> | |
<html> |
View set-up-dotrun-macos.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multipass launch --name dotrun | |
DOTRUN_IP=$(multipass list | grep dotrun | egrep -o '\d+[.]\d+[.]\d+[.]\d+') | |
multipass exec dotrun -- mkdir shared | |
multipass exec dotrun -- chmod 777 shared | |
multipass exec dotrun -- sudo apt update | |
multipass exec dotrun -- sudo apt install --yes nfs-kernel-server | |
multipass exec dotrun -- bash -c 'echo "$HOME/shared 192.168.64.0/24(rw,fsid=0,insecure,no_subtree_check,all_squash,async,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports' | |
multipass exec dotrun -- sudo exportfs -a | |
multipass exec dotrun -- sudo service nfs-kernel-server restart | |
mkdir $HOME/shared |
View get-discourse-topic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import json | |
import os | |
import sys | |
import time | |
import urllib.request | |
topic_id = sys.argv[1] |
View post-cve.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# Standard library | |
import os | |
from http.cookiejar import MozillaCookieJar | |
# Packages | |
from macaroonbakery import httpbakery | |
View settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"python.linting.pylintEnabled": false, | |
"python.linting.flake8Enabled": true, | |
"python.linting.enabled": true, | |
"python.formatting.provider": "black", | |
"python.formatting.blackArgs": [ | |
"--line-length", | |
"79" | |
], | |
"editor.formatOnSave": true, |
View sorting_and_search_algorithms.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quick_sort(items): | |
""" | |
https://en.wikipedia.org/wiki/Quicksort | |
Worst-case complexity: O(n^2) | |
Best-case complexity: O(n log n) | |
Auxilliary space complexity: O(n), can be O(log n) if you're clever | |
""" | |
pivot_item = items[-1] |
View create-pdf.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# === | |
# This will pull down the server documentation from https://discourse.ubuntu.com/c/server/guide | |
# === | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
# Empty the documents directory, so we get fresh documents |
NewerOlder