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
====================================== | |
Setting up Nginx, uWSGI and Python3 | |
====================================== | |
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
1) Only showed you how to run the server for a single web application. | |
2) Only showed you how to configure the app, not the server it was running on. | |
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
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
# Each distribution default Bash prompts | |
# Gentoo (/etc/bash/bashrc) | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' | |
else | |
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' | |
fi |
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
-- Example table | |
CREATE TABLE ring_buffer (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT); | |
-- Number 10 on where statement defines the ring buffer's size | |
CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer | |
BEGIN | |
DELETE FROM ring_buffer WHERE id%10=NEW.id%10 AND id!=NEW.id; | |
END; |
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
#!/bin/bash | |
IPSET="/usr/sbin/ipset" | |
CURL="/usr/bin/curl" | |
DATE="/bin/date" | |
for VER in 4 6; do | |
URL="https://www.cloudflare.com/ips-v$VER" | |
SET_NAME="CloudFlare.IPv$VER" |
Chinese Brand "ITworks" , Model TW891, distributed in France and Belgium by Darty
- CPU: Intel(R) Atom(TM) CPU Z3735F @ 1.33GHz
- Video: Intel® HD Graphics for Intel Atom® Processor Z3700 Series
- Screen: 1280x800
- WiFi + BT: Realtek RTL8723BS_BT
- Disks: mmcblk1: mmc1:0001 DF4032 29.1 GiB
- RAM: 2GB DDR3 @ 1333 MHz
This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.
Workshop Instructor:
- Lilly Ryan @attacus_au
This workshop is distributed under a CC BY-SA 4.0 license.
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
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
dialog { | |
position: fixed; | |
top: 50%; | |
left: 50%; | |
right: auto; | |
padding: 30px; | |
transform: perspective(500px) translate(-50%, -50%); | |
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF; | |
border: none; | |
border-radius: 3px; |
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
# Proper (fast) Python implementations of Dan Bernstein's DJB2 32-bit hashing function | |
# | |
# DJB2 has terrible avalanching performance, though. | |
# For example, it returns the same hash values for these strings: "xy", "yX", "z7". | |
# I recommend using Murmur3 hash. Or, at least, FNV-1a or SDBM hashes below. | |
import functools | |
djb2 = lambda x: functools.reduce(lambda x,c: 0xFFFFFFFF & (x*33 + c), x, 5381) | |
sdbm = lambda x: functools.reduce(lambda x,c: 0xFFFFFFFF & (x*65599 + c), x, 0) | |
fnv1a_32 = lambda x: functools.reduce(lambda x,c: 0xFFFFFFFF & ((x^c)*0x1000193), x, 0x811c9dc5) |
OlderNewer