Skip to content

Instantly share code, notes, and snippets.

View cardoni's full-sized avatar
:bowtie:

Greg Cardoni cardoni

:bowtie:
View GitHub Profile
@pirate
pirate / ssl.sh
Last active May 20, 2021 00:21
SSL certificate generation script supporting openssl, mkcert, and letsencrypt with manual/standalone/webroot/cloudflare-dns/digitalocean-dns.
#!/usr/bin/env bash
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
SCRIPTNAME="$0"
HELP_TEXT="
@pirate
pirate / alfred-clipboard.sh
Last active August 28, 2024 01:17
Script to manage searching, backing up, and collecting infinite clipboard history from the Alfred Clipboard History on macOS.
#!/usr/bin/env bash
# This is a script that provides infinite history to get around Alfred's 3-month limit.
# It works by regularly backing up and appending the items in the alfred db to a
# sqlite database in the user's home folder. It also provides search functionality.
# https://www.alfredforum.com/topic/10969-keep-clipboard-history-forever/?tab=comments#comment-68859
# https://www.reddit.com/r/Alfred/comments/cde29x/script_to_manage_searching_backing_up_and/
# Example Usage:
# alfred-clipboard.sh backup
@Lwdthe1
Lwdthe1 / usaCities.json
Last active April 24, 2025 04:51
JSON of 5797+ USA Cities and Their States - Presented by https://www.ManyStories.com
[
{ "city": "Abbeville", "state": "Louisiana" },
{ "city": "Aberdeen", "state": "Maryland" },
{ "city": "Aberdeen", "state": "Mississippi" },
{ "city": "Aberdeen", "state": "South Dakota" },
{ "city": "Aberdeen", "state": "Washington" },
{ "city": "Abilene", "state": "Texas" },
{ "city": "Abilene", "state": "Kansas" },
{ "city": "Abingdon", "state": "Virginia" },
{ "city": "Abington", "state": "Massachusetts" },
@takumiirie
takumiirie / spreadsheet_conditional-formatting1.txt
Created January 26, 2018 08:53
Google Spreadsheet - Regex with Conditional Formatting
# set "Apply to range" to whereever you want to apply setting.
# set "Format cells if..." to "Custom formula is" and paste following code
# Following Forumula will detect if it's match with regex or not.
=REGEXMATCH(INDIRECT("R[0]C[0]", false),"<PUT YOUR REGEX HERE>") = true
# set your "formatting style"
That's it!
@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active March 14, 2025 05:30
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@Pwntus
Pwntus / serverless.yml
Created May 18, 2017 19:45
SLS Cognito
resources:
Resources:
# User Pool
MyUserPool:
Type: AWS::Cognito::UserPool
Properties:
AdminCreateUserConfig:
AllowAdminCreateUserOnly: False
InviteMessageTemplate:
@samthor
samthor / safari-nomodule.js
Last active April 26, 2025 20:41
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@singledigit
singledigit / cognito.yaml
Last active December 11, 2024 10:03
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@SteveHoggNZ
SteveHoggNZ / aws-cli-jq.sh
Last active June 24, 2020 21:44
Examples of AWS CLI using JQ
# jq reference: https://stedolan.github.io/jq/manual
# Get a list of each Lambda function that starts with ^test and output that as an array
# i.e. take the contents of the .Functions[] list, select the ones that have a .FunctionName property that
# starts with test, and record the .FunctionName value
aws lambda list-functions | jq '[ .Functions[] | select(.FunctionName | test("^test")) | .FunctionName ]'
# Create an array of new maps for Lambda functions
aws lambda list-functions | jq '[ .Functions[] | select(.FunctionName | test("^test")) | {name: .FunctionName, memory: .MemorySize} ]'

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.