Skip to content

Instantly share code, notes, and snippets.

View scardine's full-sized avatar

Paulo Scardine scardine

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scardine
scardine / Novidades do Python 3.7.ipynb
Created July 14, 2018 15:35
Jupyter Notebook for my talk at JustPython
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scardine
scardine / dynamic_module_attributes.py
Created June 29, 2018 14:29
Exemplo de Atributos Dinâmicos para Módulos no Python 3.7
# lib.py
from warnings import warn
deprecated_names = ["funcao_antiga", ...]
def _funcao_antiga_obsoleta(arg, other):
...
def __getattr__(name):
@scardine
scardine / timeline.tsv
Created May 17, 2018 15:35
Python timeline
Branch Schedule Status First release End-of-life Comment
master PEP 569 features 2019-10-20 2024-10 The master branch is currently the future Python 3.8.
3.7 PEP 537 prerelease 2018-06-15 2023-06 Fixes for features, bugs, and docs in the upcoming 3.7.0 release
3.6 PEP 494 bugfix 2016-12-23 2021-12-23 Most recent binary release: Python 3.6.5
2.7 PEP 373 bugfix 2010-07-03 2020-01-01 The support has been extended to 2020-01-01.Most recent binary release: Python 2.7.15
3.5 PEP 478 security 2015-09-13 2020-09-13 Most recent security release: Python 3.5.5
3.4 PEP 429 security 2014-03-16 2019-03-16 Most recent security release: Python 3.4.8
@scardine
scardine / installs-by-python-version.sh
Last active May 17, 2018 14:26
Statistics about Python versions installs for your pypi module
pypinfo --start-date 2018-04-01 \
--end-date 2018-04-30 \
--percent --pip --markdown \
your_package_name pyversion
@scardine
scardine / letsencrypt.sh
Last active August 10, 2018 13:33
Lets Encrypt Wildcard Certificate with DigitalOcean
$ echo dns_digitalocean_token = 89de1bae81accf27ebd8045136c09a2f > do-api.ini
$ git clone https://github.com/certbot/certbot.git
$ cd certbot
$ ./certbot-auto --os-packages-only
$ ./tools/venv.sh
$ source venv/bin/activate
$ certbot certonly --dns-digitalocean \
--dns-digitalocean-credentials do-api.ini \
--dns-digitalocean-propagation-seconds 60 \
-d '*.mywebsite.com' -d mywebsite.com \
# Google, Google Drive
acl google dstdom_regex -i www\.google\.com$
acl google dstdom_regex -i accounts\.google\.com$
acl google dstdom_regex -i googledrive\.com$
acl google dstdom_regex -i drive\.google\.com$
acl google dstdom_regex -i \.drive\.google\.com$
acl google dstdom_regex -i docs\.google\.com$
acl google dstdom_regex -i \.docs\.google\.com$
acl google dstdom_regex -i \.c\.docs\.google\.com$
acl google dstdom_regex -i sheets\.google\.com$
# whitelist for Microsoft software (Cortana, Office, etc) phoning home...
acl microsoft dstdomain -n .office.com
acl microsoft dstdomain -n vortex.data.microsoft.com
acl microsoft dstdomain -n onecs-live.azureedge.net
acl microsoft dstdomain -n vortex-win.data.microsoft.com
acl microsoft dstdomain -n telecommand.telemetry.microsoft.com
acl microsoft dstdomain -n telecommand.telemetry.microsoft.com.nsatc.net
acl microsoft dstdomain -n oca.telemetry.microsoft.com
acl microsoft dstdomain -n oca.telemetry.microsoft.com.nsatc.net
acl microsoft dstdomain -n sqm.telemetry.microsoft.com
# SPNEGO configuration:
auth_param negotiate program /usr/bin/ntlm_auth --helper-protocol=gss-spnego
auth_param negotiate children 50
auth_param negotiate realm YOURDOMAIN
auth_param negotiate keep_alive on
@scardine
scardine / postmark.py
Created November 9, 2017 10:34
Use Postmark + requests
import os
from base64 import b64encode
import requests
from django.conf import settings
from django.template.loader import render_to_string
import magic
try: