The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
// Add / Update a key-value pair in the URL query parameters | |
function updateUrlParameter(uri, key, value) { | |
// remove the hash part before operating on the uri | |
var i = uri.indexOf('#'); | |
var hash = i === -1 ? '' : uri.substr(i); | |
uri = i === -1 ? uri : uri.substr(0, i); | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { |
function aws_mfa { | |
if [[ -z "$AWS_ACCESS_KEY_ID" ]] ; then | |
echo "Please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY" | |
return 1 | |
fi | |
if [[ -z "$REAL_AWS_ACCESS_KEY_ID" ]] ; then | |
REAL_AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID | |
REAL_AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY | |
fi |
<?php | |
App::uses('DispatcherFilter', 'Routing'); | |
/** | |
* Api Cors Dispatcher | |
*/ | |
class ApiCorsDispatcher extends DispatcherFilter { | |
public $priority = 1; |
We want to track image downloads from client side and in javascript we cannot get the header values:(.
#!/bin/bash | |
CONSUL="localhost:8500" | |
main() { | |
case "$1" in | |
info) | |
curl -s "$CONSUL/v1/kv/$2" | jq -r .[] | |
;; | |
get) |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
<?php | |
use Aws\Common\Aws; | |
use Aws\S3\Exception\S3Exception; | |
// make sure the SDK is installed | |
// I've used Composer to autoload it: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html | |
/* | |
* jQuery File Upload Plugin PHP Class 7.1.0 | |
* https://github.com/blueimp/jQuery-File-Upload |