Skip to content

Instantly share code, notes, and snippets.

View rizplate's full-sized avatar

Whats in the name rizplate

View GitHub Profile
@rizplate
rizplate / receive_curl_upload_file.py
Created May 18, 2018 23:52 — forked from LotusChing/receive_curl_upload_file.py
receive curl upload file to flask
# coding:utf-8
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/upload', methods=['PUT'])
def upload():
kubectl get services # List all services
kubectl get pods # List all pods
kubectl get nodes -w # Watch nodes continuously
kubectl version # Get version information
kubectl cluster-info # Get cluster information
kubectl config view # Get the configuration
kubectl describe node <node> # Output information about a node
kubectl get pods # List the current pods
kubectl describe pod <name> # Describe pod <name>
kubectl get rc # List the replication controllers
@rizplate
rizplate / ec2.py
Created May 30, 2018 21:59 — forked from iMilnb/ec2.py
AWS EC2 simple manipulation script using python and boto3
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# frankfurt:
# - subnet-azb:
# - type: t2.micro
# image: image-tagname
@rizplate
rizplate / vpc_vpn_ec2.py
Created May 30, 2018 22:36 — forked from iMilnb/vpc_vpn_ec2.py
Dynamic Troposphere + boto3 template that creates a complete and functional VPC through AWS CloudFormation
#!/usr/bin/env python
from troposphere import Join, Output
from troposphere import Parameter, Ref, Tags, Template
from troposphere.ec2 import PortRange
from troposphere.ec2 import NetworkAcl
from troposphere.ec2 import Route
from troposphere.ec2 import VPCGatewayAttachment
from troposphere.ec2 import SubnetRouteTableAssociation
from troposphere.ec2 import Subnet
@rizplate
rizplate / foo.log
Created June 4, 2018 23:38 — forked from ibeex/foo.log
Flask logging example
A warning occurred (42 apples)
An error occurred
@rizplate
rizplate / app.py
Created June 4, 2018 23:49 — forked from jakubczaplicki/app.py
Flask Logging Logger Configuration
import sys
import logging
import logging.config
from flask import Flask
class LoggerConfig:
dictConfig = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rizplate
rizplate / System Design.md
Created July 5, 2018 15:17 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@rizplate
rizplate / Django + Ajax dynamic forms .py
Created July 14, 2018 22:53 — forked from goldhand/Django + Ajax dynamic forms .py
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title
@rizplate
rizplate / curl_post_json.md
Created July 21, 2018 01:03 — forked from ungoldman/curl_post_json.md
post a file JSON file with curl

How do POST file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example: