Skip to content

Instantly share code, notes, and snippets.

View MichaelMarkieta's full-sized avatar

Michael Markieta MichaelMarkieta

  • Starburst
  • Singapore
View GitHub Profile
sudo apt-get update
sudo apt-get install -y python3 python3-pip
pip3 install virtualenv
virtualenv env -p python3
source env/bin/activate
pip3 install locustio
# Build you locustfile.py here
locust --host=http://example.com
@MichaelMarkieta
MichaelMarkieta / tutorial.sh
Last active August 6, 2018 16:37
Multi-cluster Google Kubernetes Engine with Google Cloud Load Balancer (Layer 7) Ingress Load Balancing
# This is a personal exploration of the kubemci zone printer tutorial
# Original tutorial here: https://github.com/GoogleCloudPlatform/k8s-multicluster-ingress/tree/master/examples/zone-printer
# Install kubemci
go get -u github.com/GoogleCloudPlatform/k8s-multicluster-ingress/cmd/kubemci
# Configure environmental variables
PROJECT=my-gcp-project-id
# Clone zone printer base project
@MichaelMarkieta
MichaelMarkieta / predict.py
Created May 23, 2018 15:14
Titanic: Machine Learning from Disaster (74%)
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
train = pd.read_csv("train.csv")
train_x = train.drop(columns=['Name'])
train_x['Embarked'] = train_x['Embarked'].astype('category')
train_x['Cabin'] = train_x['Cabin'].astype('category')
@MichaelMarkieta
MichaelMarkieta / readme.txt
Created April 27, 2018 18:51
Retrieving IP addresses from Google Compute Engine (GCE) Virtual Machine (VM) instances on Google Cloud Platform (GCP)
# Note: requires the Compute Viewer IAM role
## Internal IPs
gcloud --format="value(networkInterfaces[0].networkIP)" compute instances list
## External IPs
gcloud --format="value(networkInterfaces[0].accessConfigs[0].natIP)" compute instances list
## Seperate the IPs with a delimeter on a single line
gcloud --format="value[terminator=' '](networkInterfaces[0].networkIP)" compute instances list
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png
import sys
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
class MyHandler(PatternMatchingEventHandler):
patterns=["myfile.xls"]
def process(self, event):
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>L.mapbox.simplestyle with L.geoJson</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>L.mapbox.simplestyle with L.geoJson</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>L.mapbox.simplestyle with L.geoJson</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>L.mapbox.simplestyle with L.geoJson</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.8/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }