Skip to content

Instantly share code, notes, and snippets.

@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
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@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
@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]
.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/##//'
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}{
# 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 ->
#compdef set-aws-profile
_set-aws-profile() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->csi'
case $state in
csi)