Skip to content

Instantly share code, notes, and snippets.

def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
"""Connects a URL rule. Works exactly like the :meth:`route`
decorator. If a view_func is provided it will be registered with the
endpoint.
Basically this example::
@app.route('/')
def index():
pass
@saurabh-hirani
saurabh-hirani / iptables-all-accept
Created October 16, 2013 05:37
iptables accept policies
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
@saurabh-hirani
saurabh-hirani / merge_ds.py
Last active January 27, 2016 20:29
Merge data structures in python
import json
import itertools
from mergedict import ConfigDict
# minor changes to original code at http://stackoverflow.com/questions/19378143/python-merging-two-arbitrary-data-structures
def merge(a, b):
if isinstance(a, dict) and isinstance(b, dict):
d = dict(a)
d.update({k: merge(a.get(k, None), b[k]) for k in b})
return d
Title
Speaker name
speaker.email@id.com
* First slide
- first point
- second point
- third point
\documentclass[9pt]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{colortbl}
\usepackage[english]{babel}
\newcommand{\myblue} [1] {{\color{blue}#1}}
\newcommand{\newauthor}[4]{
\parbox{0.26\textwidth}{
\documentclass[9pt]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{colortbl}
\usepackage[english]{babel}
\newcommand{\myblue} [1] {{\color{blue}#1}}
\newcommand{\newauthor}[4]{
\parbox{0.26\textwidth}{
#compdef set-aws-profile
_set-aws-profile() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->csi'
case $state in
csi)
aws-profiles() {
cat ~/.aws/credentials | grep '\[' | grep -v '#' | tr -d '[' | tr -d ']'
}
set-aws-profile() {
local aws_profile=$1
set -x
export AWS_PROFILE=${aws_profile}
set +x
}
@saurabh-hirani
saurabh-hirani / _set-aws-profile.sh
Created May 18, 2018 08:07
File path: ~/.oh-my-zsh/completions/_set-aws-profile
#compdef set-aws-profile
_set-aws-profile() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->csi'
case $state in
csi)
@saurabh-hirani
saurabh-hirani / _set-aws-keys.sh
Created May 18, 2018 08:08
File path: ~/.oh-my-zsh/completions/_set-aws-keys
#compdef set-aws-keys
_set-aws-keys() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->csi'
case $state in
csi)