A Brief Introduction to Multi-Threading in PHP
- Foreword
- Execution
- Sharing
- Synchronization
- Pitfalls
# See also: http://docs.couchdb.org/en/latest/cluster/index.html | |
# Before you can add nodes to form a cluster, you have to have them listen on a public ip address | |
# and set up an admin user (use same admin:password for all nodes). | |
# Do this, once per node: | |
# If you have installed couchdb in /opt (else change the Path) | |
cd /opt/couchdb/etc | |
cp local.ini local.ini.orig | |
cp vm.args vm.args.orig |
#!/usr/bin/env bash | |
# | |
# Get the value of a tag for a running EC2 instance. | |
# | |
# This can be useful within bootstrapping scripts ("user-data"). | |
# | |
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy | |
# JSON for this looks like: | |
# | |
# { |
# List all [sections] of a .INI file | |
sed -n 's/^[ \t]*\[\(.*\)\].*/\1/p' | |
# Read KEY from [SECTION] | |
sed -n '/^[ \t]*\[SECTION\]/,/\[/s/^[ \t]*KEY[ \t]*=[ \t]*//p' | |
# Read all values from SECTION in a clean KEY=VALUE form |
# Create a pod containing the PHP-FPM application (my-php-app) | |
# and nginx, each mounting the `shared-files` volume to their | |
# respective /var/www/html directories. | |
kind: Pod | |
apiVersion: v1 | |
metadata: | |
name: phpfpm-nginx-example | |
spec: | |
volumes: |
cfg.parser () { | |
fixed_file=$(cat $1 | sed 's/ = /=/g') # fix ' = ' to be '=' | |
IFS=$'\n' && ini=( $fixed_file ) # convert to line-array | |
ini=( ${ini[*]//;*/} ) # remove comments | |
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix | |
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1) | |
ini=( ${ini[*]/=/=\( } ) # convert item to array | |
ini=( ${ini[*]/%/ \)} ) # close array parenthesis | |
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2) | |
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis |
import boto3 | |
def get_paginated_results(product, action, key, credentials=None, args=None): | |
args = {} if args is None else args | |
credentials = {} if credentials is None else credentials | |
return [y for sublist in [x[key] for x in boto3.client( | |
product, **credentials).get_paginator(action).paginate(**args)] | |
for y in sublist] |
#!/bin/sh | |
sudo yum -y install autoconf automake gcc gcc-c++ make boost-devel zlib-devel ncurses-devel protobuf-devel openssl-devel | |
cd /usr/local/src | |
sudo wget http://mosh.mit.edu/mosh-1.2.4.tar.gz | |
sudo tar xvf mosh-1.2.4.tar.gz | |
cd mosh-1.2.4 | |
sudo ./autogen.sh | |
sudo ./configure | |
sudo make |
# Let apache know we're behind a SSL reverse proxy | |
SetEnvIf X-Forwarded-Proto "https" HTTPS=on | |
# Redirect to HTTPS | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC] | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IFModule> |