Skip to content

Instantly share code, notes, and snippets.

View espozbob's full-sized avatar

bob espozbob

View GitHub Profile
@tomislacker
tomislacker / ec2_kill_with_fire.py
Last active November 14, 2018 06:33
Kill EC2 Instances With Fire
#!/usr/bin/env python
"""
EC2 Instance Killer
Usage:
ec2_kill_with_fire.py [options] <instance_id>...
Options:
-h, --help Show this dialog
-r, --region NAME EC2 region [default: us-east-1]
@amosshapira
amosshapira / redirect-domain-with-s3-and-cloudfront.json
Last active May 13, 2018 06:51
CloudFormation template to redirect "company.co.uk" to "company.com"
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Redirect {www.,}company.co.uk web site to company.com, including SSL",
"Resources": {
"BucketCompanyCoUk": {
"Properties": {
"AccessControl": "PublicRead",
"BucketName": "company.co.uk",
"CorsConfiguration": {
"CorsRules": [
@LeCoupa
LeCoupa / redis_cheatsheet.bash
Last active June 26, 2024 15:54
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@subfuzion
subfuzion / curl.md
Last active July 25, 2024 08:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@atdt
atdt / aho_corasick.py
Last active April 12, 2024 19:29
Aho-Corasick string matching in Python
# Python implementation of Aho-Corasick string matching
#
# Alfred V. Aho and Margaret J. Corasick, "Efficient string matching: an aid to
# bibliographic search", CACM, 18(6):333-340, June 1975.
#
# <http://xlinux.nist.gov/dads//HTML/ahoCorasick.html>
#
# Copyright (C) 2015 Ori Livneh <ori@wikimedia.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
@jeremypruitt
jeremypruitt / sns-publish
Last active August 19, 2022 18:09
AWS Lambda function to publish to SNS topic
console.log('Loading function');
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2';
exports.handler = function(event, context) {
console.log("\n\nLoading handler\n\n");
var sns = new AWS.SNS();
sns.publish({