Simple and safe random getters to copy-paste
string randomBytes( int $length )
int randomInt ( int $min , int $max )
string randomUuid ( void )| import requests | |
| import json | |
| Req = [ | |
| "KOSPI2:IND", | |
| "NIFTY:IND", | |
| "SX5E:IND", | |
| "UKX:IND", | |
| "NDX:IND" | |
| ] | |
| Data = {} |
| # Sources: | |
| # https://cloudonaut.io/how-to-create-a-customized-cloudwatch-dashboard-with-cloudformation/ | |
| # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html | |
| # https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ECS.html | |
| Resources: | |
| CustomTaskDefinition: | |
| Type: 'Custom::TaskDefinition' | |
| Version: '1.0' | |
| Properties: |
| #!/bin/bash | |
| # | |
| # Example of how to parse short/long options with 'getopt' | |
| # | |
| OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"` | |
| if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi | |
| echo "$OPTS" |
| #!/bin/bash | |
| # | |
| # Example of how to parse short/long options with 'getopt' | |
| # | |
| OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"` | |
| if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi | |
| echo "$OPTS" |
| # Alex Ellis 2018 | |
| # Example from: https://blog.alexellis.io/quick-look-at-google-kaniko/ | |
| # Pre-steps: | |
| # kubectl create secret generic docker-config --from-file $HOME/.docker/config.json | |
| # Other potential optimizations (suggested by @errordeveloper) | |
| # - Store "templates" in a permanent volume | |
| # - Download source via "tar" instead of git clone |
| (function() { | |
| var CSSCriticalPath = function(w, d, opts) { | |
| var opt = opts || {}; | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
| var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
| for(var i = 0; i < styles.length; i++) { | |
| if(!!styles[i] === false) continue; | |
| var pair = styles[i].split(": "); |
| cd /tmp | |
| curl -O http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | |
| tar zxvf ioncube_loaders_lin_x86-64.tar.gz | |
| PHP_CONFD=$(php-config --configure-options|sed 's/.*\with-config-file-scan-dir\=\(\S*\).*/\1/g') | |
| PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") | |
| PHP_EXT_DIR=$(php-config --extension-dir) | |
| cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR | |
| echo "zend_extension = ${PHP_EXT_DIR}/ioncube_loader_lin_${PHP_VERSION}.so" > "${PHP_CONFD}/00-ioncube.ini" | |
| rm -rf ./ioncube | |
| rm ioncube_loaders_lin_x86-64.tar.gz |
| <?php | |
| /** | |
| * Enable sql profiling for each page. | |
| * | |
| * Put code to index file in two parts | |
| */ | |
| // place it BEFORE application run | |
| $profiler = \Magento\Framework\App\ObjectManager::getInstance() | |
| ->get('Magento\Framework\App\ResourceConnection') |
| composer config repositories.alger/phpworld-talk2 vcs git@github.com:davidalger/phpworld-talk2.git | |
| composer require alger/module-skeleton:dev-master | |
| bin/magento setup:upgrade -q && bin/magento cache:flush -q | |
| # OR | |
| git clone git@github.com:davidalger/phpworld-talk2.git app/code/Alger/Skeleton | |
| bin/magento module:enable Alger_Skeleton | |
| bin/magento setup:upgrade -q && bin/magento cache:flush -q |