If you have virtualenv
curl https://gist.github.com/thejsj/f79b18e8a0dedadbee34c7ff72037d73/raw/d5908867a8901c81848b6d86b316bb10d5ff117a/basilica_images-with-virtualenv.bash | bash
If you have Python 2.7 (Most probable)
# Install Basilica | |
install.packages("https://storage.googleapis.com/basilica-r-client/basilica_0.0.2.tar.gz", repos=NULL) | |
library(basilica) | |
# Create a connection | |
conn = connect(auth_key="SLOW_DEMO_KEY") | |
# Change the working directory | |
# Besure to download the demo file first | |
# wget https://storage.googleapis.com/basilica-public/cats_dogs_demo.tgz |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | |
apt-get update | |
apt-get install postgresql-client -y |
# For Gcloud | |
kubectl create clusterrolebinding cluster-admin-binding \ | |
--clusterrole cluster-admin \ | |
--user $(gcloud config get-value account) | |
kubectl create namespace ingress-nginx | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/cloud-generic.yaml | |
kubectl edit cm -n ingress-nginx nginx-configuration |
def all_perms(elements): | |
if len(elements) <=1: | |
yield elements | |
else: | |
for perm in all_perms(elements[1:]): | |
for i in range(len(elements)): | |
#nb elements[0:1] works in both string and list contexts | |
yield perm[:i] + elements[0:1] + perm[i:] |
virtualenv -p python3 venv # Delete Later with `rm -rf venv` | |
source venv/bin/activate | |
pip install Pillow | |
python -c "from PIL import Image; import urllib.request; urllib.request.urlretrieve('https://images.unsplash.com/photo-1518791841217-8f162f1e1131', '/tmp/cat.jpg'); im = Image.open('/tmp/cat.jpg'); im.thumbnail((256, 256)); im.save('/tmp/cat-resize.jpg', 'JPEG'); im = Image.open('/tmp/cat-resize.jpg'); print(im.format, im.size, im.mode)" |
#!/bin/bash | |
params=" -uroot -p" | |
echo ' - - - - - - - ' | |
echo 'DB Name : '$1 | |
echo 'Password: '$2 | |
# Create Database | |
echo ' - - - - - - - ' | |
echo 'CREATE DATABASE IF NOT EXISTS $1;' | |
# Grant Options (Creates User Automatically) | |
echo ' - - - - - - - ' |
console.log('Start') // Will execute first | |
setTimeout(1000, function thisWillHappenLater () { | |
console.log('After Timeout') // Will execute third (after 1 second) | |
}) | |
console.log('Keep going') // Will execute second |
const parseJSON = function (json) { | |
// Higher-order function to be used for detecting type | |
const firstAndLastChars = function (first, last) { | |
return (str) => str[0] === first && str[str.length - 1] === last | |
} | |
const isArray = firstAndLastChars('[', ']') | |
const isObj = firstAndLastChars('{', '}') | |
const hasDoubleQuotes = firstAndLastChars('"', '"') | |
const hasSingleQuotes = firstAndLastChars("'", "'") | |
const isNumber = (str) => (+(str)) + '' === str |
function pull_image () { | |
echo $1 | |
devdocker_image="devdocker.mulesoft.com:18078/mulesoft/$1" | |
apiserver_image="apiserver:5000/mulesoft/$1" | |
docker pull $devdocker_image | |
docker tag $devdocker_image $apiserver_image | |
docker push $apiserver_image | |
} |