Skip to content

Instantly share code, notes, and snippets.

View paulmwatson's full-sized avatar

Paul Watson paulmwatson

View GitHub Profile
const protocol = document.location.protocol
const host = document.location.host
const search = document.location.search
...
const { protocol, host, search } = document.location
import pandas
people = [['Nala', 'Cape Town'], ['Catherine', 'Johannesburg']]
pandas.DataFrame(people)
# => 0 1
# 0 Nala Cape Town
# 1 Catherine Johannesburg
pandas.DataFrame(people, columns = ['Name', 'City'])
body {
--text-color: #111;
--background-color: #fff;
--primary-color: #fc0;
}
body {
color: var(--text-color);
background: var(--background-color);
}
.is-max-width-10em {
max-width: 10em;
}
.is-max-width-20em {
max-width: 20em;
}
.is-max-width-30em {
max-width: 30em;
<blockquote>
<p>
This is the end, beautiful friend<br>
This is the end, my only friend<br>
The end<br>
It hurts to set you free<br>
</p>
<footer>
~
<cite>
from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktParameters
text = 'Sgt. Maj. A. Grinston found approx. 2.2 miles up a creek on Mt. Toohigh.'
PunktSentenceTokenizer().tokenize(text)
#=> ['Sgt.', 'Maj.', 'A. Grinston found approx.', '2.2 miles up a creek on Mt.', 'Toohigh.']
punkt_param = PunktParameters()
punkt_param.abbrev_types = set(['sgt', 'maj', 'mt', 'approx'])
tokenizer = PunktSentenceTokenizer(punkt_param)
import spacy
from spacy.attrs import ORTH, LEMMA
text = 'Sgt. Maj. A. Grinston found approx. 2.2 miles up a creek on Mt. Toohigh.'
nlp = spacy.load('en_core_web_lg')
print([t.text for t in nlp(text).sents])
#=> ['Sgt.', 'Maj.', 'A. Grinston found approx.', '2.2 miles up a creek on Mt. Toohigh.']
# Pipfile (TOML)
[build-system]
requires = ["cython"]
...
[packages]
...
benepar = "==0.1.2"
...
@paulmwatson
paulmwatson / docker_compose_dotenv_environment_variables
Created August 7, 2020 12:38
Pass environment variables from a .env (dotenv) file into your Docker containers using docker-compose and build ARGs.
# .env
ANIMAL=dog
COLOUR=brown
# docker-compose.yml
...
services:
web:
...
build:
@paulmwatson
paulmwatson / kubernetes_aws_eks_ingress.yaml
Last active August 12, 2020 08:53
Securing Kubernetes Ingress on AWS EKS with TLS (SSL, HTTPS)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
...
annotations:
...
alb.ingress.kubernetes.io/certificate-arn: "arn:aws:acm:REGION:ACCOUNT_ID:certificate/CERTIFICATE_ID"
...
spec:
...