Skip to content

Instantly share code, notes, and snippets.

saurabh hirani saurabh-hirani

Block or report user

Report or block saurabh-hirani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saurabh-hirani
saurabh-hirani / EC2API-go.diff
Created Oct 1, 2019
diff between older EC2API.go and newer EC2API.go for cloud-nuke
View EC2API-go.diff
$ diff EC2API.go /var/tmp/newer-EC2API.go
388,437d387
< // ApplySecurityGroupsToClientVpnTargetNetwork mocks base method
< func (m *MockEC2API) ApplySecurityGroupsToClientVpnTargetNetwork(arg0 *ec2.ApplySecurityGroupsToClientVpnTargetNetworkInput) (*ec2.ApplySecurityGroupsToClientVpnTargetNetworkOutput, error) {
< m.ctrl.T.Helper()
< ret := m.ctrl.Call(m, "ApplySecurityGroupsToClientVpnTargetNetwork", arg0)
< ret0, _ := ret[0].(*ec2.ApplySecurityGroupsToClientVpnTargetNetworkOutput)
< ret1, _ := ret[1].(error)
View TerraformMakefile
.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/##//'
View test_grequests_output_with_patch.log
# python3 test_grequests.py
2019-04-14 23:31:43,698 START
2019-04-14 23:31:43,724 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,725 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,726 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,727 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,728 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,728 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,729 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:31:43,730 Starting new HTTPS connection (1): localhost:8082
View test_grequests_output_without_patch.log
# python3 test_grequests.py
2019-04-14 23:30:41,697 START
2019-04-14 23:30:41,721 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,722 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,723 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,724 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,725 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,726 Starting new HTTPS connection (1): localhost:8082
2019-04-14 23:30:41,727 Starting new HTTPS connection (1): localhost:8082
View test_grequests.py
#!/usr/bin/env python
from __future__ import print_function
import gevent_openssl
gevent_openssl.monkey_patch()
import grequests
import logging
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
View run_https_server.sh
#!/bin/bash
cn='example.com'
host="0.0.0.0"
port=8082
openssl genrsa -out /tmp/$cn.key 2048
openssl req -new -x509 -sha256 -key /tmp/$cn.key -out /tmp/$cn.crt -days 3650 \
-subj "/CN=$cn\/emailAddress=admin@$cn/C=US/ST=Ohio/L=Columbus/O=Widgets Inc/OU=Some Unit"
docker run --rm -e HTTPS_CERT_FILE='/tmp/example.com.crt' -e HTTPS_KEY_FILE='/tmp/example.com.key' -e PORT=$port -p $port:$port -v /tmp:/tmp mccutchen/go-httpbin:v2.1.1
View test_requests_serial.py
from __future__ import print_function
import requests
url = "https://google.com"
url_count = 10
for i in range(url_count):
print(requests.get(url, params={'page': i}))
View test_grequests.py
from __future__ import print_function
import grequests
url = "https://google.com"
url_count = 10
pending_requests = []
for i in range(url_count):
pending_requests.append(grequests.get(url, params={'page': i}))
View init.coffee
# 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 ->
@saurabh-hirani
saurabh-hirani / flatten_nested.py
Last active Jan 16, 2019
Flatten a nested array
View flatten_nested.py
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]
You can’t perform that action at this time.