Skip to content

Instantly share code, notes, and snippets.

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
}
#compdef set-aws-profile
_set-aws-profile() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->csi'
case $state in
csi)
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
\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}{
Title
Speaker name
[email protected]
* First slide
- first point
- second point
- third point
.PHONY: all plan apply destroy
all: help
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
@saurabh-hirani
saurabh-hirani / flatten_nested.py
Last active January 16, 2019 09:21
Flatten a nested array
def flatten(arr):
"""
Flatten a nested array
>>> flatten([1, 2, 3])
[1, 2, 3]
>>> flatten([1,2,3,[1,2,3]])
[1, 2, 3, 1, 2, 3]
@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
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{