Falcon 3.0 Roadmap
This file contains hidden or 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
| # https://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib | |
| def _get_primary_ip(): | |
| sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| try: | |
| # doesn't even have to be reachable | |
| sk.connect(('10.255.255.255', 1)) | |
| primary_ip = sk.getsockname()[0] | |
| except Exception: | |
| primary_ip = '127.0.0.1' | |
| finally: |
This file contains hidden or 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
| # Credit: https://www.kik.com/blog/using-lua-to-extend-nginx-configuration/ | |
| worker_processes auto; # process per cpu | |
| worker_rlimit_nofile 8192; | |
| events { | |
| worker_connections 65536; | |
| } | |
| http { | |
| # https://t37.net/nginx-optimization-understanding-sendfile-tcp_nodelay-and-tcp_nopush.html |
This file contains hidden or 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
| # See also: | |
| # | |
| # * https://asgi.readthedocs.io/en/latest/specs/www.html#websocket | |
| # * https://developer.mozilla.org/en-US/docs/Web/API/Websockets_API | |
| # | |
| import falcon.asgi | |
| import falcon.media | |
This file contains hidden or 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 get_unused_port(): | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| sock.bind(('localhost', 0)) | |
| _, port = sock.getsockname() | |
| sock.close() | |
| return port |
This file contains hidden or 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 datetime | |
| from enum import Enum | |
| import socket | |
| import ssl | |
| import certifi | |
| class CertificateStatus(Enum): | |
| UNKNOWN = -1 |
This file contains hidden or 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
| const scrollingElement = document.scrollingElement | |
| const viewport_height = scrollingElement.clientHeight | |
| for (let pos = 0; pos < scrollingElement.scrollHeight; pos += viewport_height) { | |
| scrollBy(0, viewport_height) | |
| } |
This file contains hidden or 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 bash | |
| # This script lists all ip ranges currently used by | |
| # the google cloud platform, according to ns-lookup / dig | |
| # TXT _cloud-netblocks.googleusercontent.com | |
| # | |
| # https://cloud.google.com/compute/docs/faq#find_ip_range | |
| errcho() { | |
| >&2 echo "$@" |
This file contains hidden or 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 cgi | |
| # NOTE: This does not handle file uploads | |
| def parse_form(req): | |
| # NOTE: See also the docs for cgi.FieldStorage | |
| form = cgi.FieldStorage(fp=req.stream, environ=req.env, | |
| keep_blank_values=1) | |
| if not form.list: | |
| return {} |
This file contains hidden or 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
| - name: Add ELRepo | |
| yum: | |
| name: https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm | |
| state: latest | |
| - name: Install latest mainline kernel | |
| yum: | |
| name: kernel-ml | |
| state: latest | |
| enablerepo: elrepo-kernel | |
| - name: Remake grub config to pick up new kernel |