UPDATE:
Here are some useful mixins to help you create & customize your own buttons:
| # optional dependancies: | |
| # termcolor | |
| # log("content", color='red') | |
| import sys | |
| from termcolor import colored | |
| def log(*args, **kargs): | |
| colors = ( | |
| (bool, 'cyan'), |
| Virtualenv allows you to sandbox a python app. It’s easy on ubuntu. | |
| # install virtualenv app | |
| Sudo apt-get install virtualenv | |
| # make a new env to use. ‘env’ is the usual folder name I use. Brian uses somat different (“environ”?) | |
| virtualenv env | |
| # Use the env | |
| source env/bin/activate |
| let _assetLoader; | |
| class Assets { | |
| static loader(){ | |
| if(_assetLoader == undefined) { | |
| _assetLoader = assetLoader(this.document()) | |
| } |
| from django.shortcuts import render | |
| from django.views.decorators.csrf import csrf_exempt | |
| from django.http import HttpResponse | |
| from django.views.generic import TemplateView | |
| import base64 | |
| class ReceiptView(TemplateView): | |
| """""" |
| from Crypto.Cipher import AES | |
| from Crypto.Random import get_random_bytes | |
| def on_str(): | |
| key = get_random_bytes(32) # Use a stored / generated key | |
| data_to_encrypt = 'This is plain text!' # This is your data | |
| print(key) | |
| print(data_to_encrypt) | |
| # === Encrypt === |
| reobj = re.compile(r"\b(((?#protocol)https?|ftp):?//|go/|(?#www)www[.]+)((?#domain)[-A-Z0-9.]+)((?#file)/[-A-Z0-9+&@#/%=~_|!:,.;]*)?((?#parameters)\?[A-Z0-9+&@#/%=~_|!:,.;]*)?", re.IGNORECASE) | |
| for match in reobj.finditer(subject): | |
| # match start: match.start() | |
| # match end (exclusive): match.end() | |
| # matched text: match.group() |
| """Create complex functional or class-based decorators without effort. | |
| + Capture the class of a method: `owner_class` | |
| + Accept arguments at create, decorate or execution | |
| + functional based drop-in replacement for `functools.wraps` | |
| + Alternative work with a class-based setup | |
| + no dependecies | |
| + | |
| A class-based decorator provides methods to override the given function. |
| """A module level getter/setter | |
| >>> import vmod | |
| >>> vmod.Woof | |
| Getting Woof... | |
| <class 'vmod.Woof'> | |
| >>> vmod.Woof | |
| Getting Woof... | |
| <class 'vmod.Woof'> |