Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { | |
| font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
| margin: auto; | |
| position: relative; | |
| width: 960px; | |
| } |
| #!flask/bin/python | |
| from flask import Flask, jsonify, abort, request, make_response, url_for | |
| from flask_httpauth import HTTPBasicAuth | |
| app = Flask(__name__, static_url_path = "") | |
| auth = HTTPBasicAuth() | |
| @auth.get_password | |
| def get_password(username): | |
| if username == 'miguel': |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| ''' | |
| Bluetooth/Pyjnius example | |
| ========================= | |
| This was used to send some bytes to an arduino via bluetooth. | |
| The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't | |
| tested without BLUETOOTH_ADMIN, maybe it works.) | |
| Connect your device to your phone, via the bluetooth menu. After the | |
| pairing is done, you'll be able to use it in the app. |
| from reportlab.pdfgen import canvas | |
| from reportlab.lib.pagesizes import A4 | |
| from reportlab.lib.units import mm | |
| #I"ll be generating code39 barcodes, others are available | |
| from reportlab.graphics.barcode import code39 | |
| # generate a canvas (A4 in this case, size doesn"t really matter) | |
| c=canvas.Canvas("barcode_example.pdf",pagesize=A4) | |
| # create a barcode object | |
| # (is not displayed yet) |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode. | |
| Usage: | |
| File Encryption: | |
| aescrypt.py [-f] infile [outfile] |
| *.pyc |
model_name = 'Invoice'
app_name = 'invoice'
from django.apps import apps
Invoice = apps.get_model(app_label=app_name, model_name=model_name)
i = Invoice.objects.filter(id=1234).first()
| with open( filePath ) as infile: | |
| """ | |
| # read first line and remember it | |
| first_line = infile.readline() | |
| # or only skip first line | |
| next( infile ) | |
| """ | |
| for line in infile: | |
| print line |
| #!/usr/bin/env python3 | |
| """ | |
| Class for scalable client which runs workers in threads | |
| """ | |
| # | |
| import random | |
| import threading | |
| import time | |
| # | |
| # |