- Add VPN Configuration
- IPSEC
- Server: your-ip
- Account: shell user
- Password: shell password
- Use certificate: Off
- Group name: Blank
- Secret: your-strong-secret
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
""" | |
Given a credentials file for a Google Service Account, obtain a short-lived | |
access token to access Google APIs. Such an access token can be used, for instance, | |
by a customer to upload external files to a Google Cloud Storage Bucket over HTTP. | |
To install required dependencies on Debian-based systems: | |
apt-get install python3-jwt python3-requests | |
or on other systems: |
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
""" | |
A simple Flask error handler that turns exceptions into problem detail responses. | |
""" | |
from flask import Flask, current_app, jsonify | |
from werkzeug.exceptions import HTTPException, InternalServerError | |
def exception_to_problem_detail(exc: Exception): | |
""" | |
Turn an exception into a problem detail response. |
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 collections.abc | |
import urllib.parse | |
from typing import Dict, List | |
from requests_cache import CachedSession | |
class DictView(collections.abc.Mapping): | |
""" | |
Provides a viw into another dictionary. |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Convert a PEM encoded X509 certificate into a JWK RSA public key. | |
""" | |
import base64 | |
import json | |
from cryptography import x509 | |
from cryptography.hazmat.primitives import serialization |
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
Verifying that +skion is my openname (Bitcoin username). https://onename.io/skion |
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
### Keybase proof | |
I hereby claim: | |
* I am skion on github. | |
* I am skion (https://keybase.io/skion) on keybase. | |
* I have a public key whose fingerprint is 2210 17C1 62D0 1494 7B63 9600 D3D2 1406 5962 D58F | |
To claim this, I am signing this object: |
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 arc(draw, bbox, start, end, fill, width=1, segments=100): | |
""" | |
Hack that looks similar to PIL's draw.arc(), but can specify a line width. | |
""" | |
# radians | |
start *= math.pi / 180 | |
end *= math.pi / 180 | |
# angle step | |
da = (end - start) / segments |