frontend localnodes
bind *:80
reqadd X-Forwarded-Proto:\ http
# Add CORS headers when Origin header is present
capture request header origin len 128
http-response add-header Access-Control-Allow-Origin %[capture.req.hdr(0)] if { capture.req.hdr(0) -m found }
rspadd Access-Control-Allow-Methods:\ GET,\ HEAD,\ OPTIONS,\ POST,\ PUT if { capture.req.hdr(0) -m found }
rspadd Access-Control-Allow-Credentials:\ true if { capture.req.hdr(0) -m found }
| #!/bin/bash | |
| # This script is based on https://unix.stackexchange.com/revisions/480191/9 . | |
| # The following changes proved to be necessary to make it work on CentOS 7: | |
| # * removed disk info (model, size) - not very useful, might not work in many cases. | |
| # * using "bw" instead of "bw_bytes" to support fio version 3.1 (those availible through yum @base) | |
| # * escaping exclamation mark in sed command | |
| # * the ".fiomark.txt" is not auto-removed | |
| LOOPS=5 #How many times to run each test |
| import random | |
| import asyncio | |
| class PDCACycle: | |
| def __init__(self): | |
| self.bad_mood = 0 | |
| self.interval = 1 | |
| async def plan(self, name): |
| { | |
| "ignition": { "version": "2.0.0" }, | |
| "systemd": { | |
| "units": [ | |
| { | |
| "name": "auto-update-kmods.service", | |
| "enable": true, | |
| "contents": "[Unit]\nDescription=Install custom kernel modules\nAfter=lib-modules.mount network-online.target\nRequires=lib-modules.mount network-online.target\nConditionPathExists=!/opt/modules/%v\nConditionPathExistsGlob=/lib/modules/auto-update-kmods.d/*.sh\n\n[Service]\nType=oneshot\nExecStart=/bin/bash -ex /lib/modules/auto-update-kmods.sh\n\n[Install]\nWantedBy=multi-user.target\n" | |
| }, | |
| { |
This is a writeup about how to install Ubuntu 16.04.1 Xenial Xerus for the 32-bit hard-float ARMv7 (armhf) architecture on a Qemu VM via Ubuntu netboot.
The setup will create a Ubuntu VM with LPAE extensions (generic-lpae) enabled. However, this writeup should also work for non-LPAE (generic) kernels.
The performance of the resulting VM is quite good, and it allows VMs with >1G ram (compared to 256M on versatilepb and 1G on versatile-a9/versatile-a15). It also supports virtio disks whereas versatile-a9/versatile-a15 only support SD cards via the -sd argument.
| conf = { | |
| "sqs-access-key": "", | |
| "sqs-secret-key": "", | |
| "sqs-queue-src": "", | |
| "sqs-queue-dest": "", | |
| "sqs-region": "ap-southeast-1", | |
| } | |
| import boto.sqs | |
| conn = boto.sqs.connect_to_region( |
Hopefully this will answer "How do I setup or start a Django project?" I was trying to set up my own website, and there was a lot to read, learn and digest! Therefore, I put this together which is a collection of all the guides/blog posts/articles that I found the most useful. At the end of this, you will have your barebones Django app configured and ready to start building :)
NOTE: This guide was built using Django 1.9.5, NodeJS 4+ with NPM 3+
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
| <source> | |
| type tail | |
| path /var/log/haproxy.log | |
| pos_file /var/log/td-agent/haproxy.log.pos | |
| tag haproxy.http | |
| format /^(?<syslog_time>.+) (?<source_ip>.+) (?<ps>\w+)\[(?<pid>\d+)\]: (?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<time>.+)\] (?<f_end>[\w\.-]+) (?<b_end>[\w\.-]+)\/(?<b_server>[^ ]+) (?<tq>[-]?\d+)\/(?<tw>[-]?\d+)\/(?<tc>[-]?\d+)\/(?<tr>[-]?\d+)\/(?<tt>\d+) (?<status_code>\d+) (?<bytes_read>\d+) (?<captured_request_cookie>.+) (?<captured_response_cookie>.+) (?<termination_state>.+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?<srv_queue>\d+)\/(?<backend_queue>\d+) \"(?<http_request>.+)\"$/ | |
| time_format %d/%b/%Y:%H:%M:%S.%L | |
| </source> | |
| <match *.**> |
This is an unofficial manual for the couchdb Python module I wish I had had.
pip install couchdb