1: sudo growpart /dev/xvdf 1
For a Linux ext2, ext3, or ext4 file system, use the following command, substituting the device name to extend:
2: sudo resize2fs /dev/xvdf1
full docs.aws
((input - min) * 100) / (max - min)
Good article
Singleton DI Container in JS
var container = {
dependencies: {},
register: function(key, value) {
this.dependencies[key] = value;
},
resolve: function(deps, func, scope) {
scope = scope || {}; scope.container = {};
for (var i = 0; i < deps.length; i++) {
scope.container[deps[i]] = this.get(deps[i]);
}
return function() {
func.apply(scope || {}, Array.prototype.slice.call(arguments, 0));
};
},
get: function(dependency) {
if (this.dependencies[dependency]) {
return this.dependencies[dependency];
}
throw new Error('Unable to find dependency ' + dependency);
}
};
How to use:
container.register('service', function() {
return { name: 'Service' };
});
container.register('router', function() {
return { name: 'Router' };
});
// adding dependencies when registrating dependency
container.register('test', function() {
this.service = container.get('service');
console.log(this.service().name === 'Service');
return 'yo';
});
var start = container.resolve(['service', 'router', 'test'], function(other) {
try {
console.log(this.container.service().name === 'Service');
console.log(this.container.router().name === 'Router');
console.log(this.container.test());
console.log('DONE');
} catch (ex) {
console.log(ex);
}
});
start("Other");
iostat -d <disk_name> | grep <disk_name> | awk '{ print $2; }'
- avarage IOPS
iostat -dx <disk_name> | grep <disk_name> | awk '{ print $4; }'
- Reads/sec
iostat -dx <disk_name> | grep <disk_name> | awk '{ print $5; }'
- Writes/sec
function makeGetRequest($url, $headers) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1, // return the transfer as a string
CURLOPT_FAILONERROR => 0, // response code greater than 400 cause error
CURLOPT_HEADER => 1, // show curl response headers
CURLOPT_HTTPHEADER => $headers,
CURLOPT_URL => $url,
CURLOPT_CONNECTTIMEOUT => 10, // should only spend 10 seconds attempting to connect
CURLOPT_TIMEOUT => 30, // hould only spend a maximum of 30 seconds executing the request
));
$resp = curl_exec($curl);
curl_close($curl);
return $resp;
}
function makePostRequest($url, $headers, $body) {
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_RETURNTRANSFER => 1, // return the transfer as a string
CURLOPT_FAILONERROR => 0, // response code greater than 400 cause error
CURLOPT_HEADER => 1, // show curl response headers.
CURLOPT_HTTPHEADER => $headers,
CURLOPT_URL => $url,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $body,
CURLOPT_CONNECTTIMEOUT => 10, // should only spend 10 seconds attempting to connect
CURLOPT_TIMEOUT => 30, // hould only spend a maximum of 30 seconds executing the request
));
$resp = curl_exec($curl);
curl_close($curl);
return $resp;
}