Skip to content

Instantly share code, notes, and snippets.

View jq-cheetsheet.md

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

View how-to-setup-lambda-to-talk-to-internet-and-vpc.md

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.
@jpillora
jpillora / smtp-gmail-send.go
Last active Sep 30, 2022
Send email using Go (Golang) via GMail with net/smtp
View smtp-gmail-send.go
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@andrewmilson
andrewmilson / file-upload-multipart.go
Last active Sep 29, 2022
Golang multipart/form-data File Upload
View file-upload-multipart.go
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@Saissaken
Saissaken / Update git fork with tags.sh
Last active Sep 29, 2022
Update git fork with tags
View Update git fork with tags.sh
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@whereisaaron
whereisaaron / pfx-to-crt-and-key.sh
Last active Sep 27, 2022
Extract a crt file (PEM), key file, and chain bundle from a PFX file, prompts for password or use PFXPASSWORD environment variable
View pfx-to-crt-and-key.sh
#!/bin/bash
#------------------
# Extract the key, certficiate, and chain in PEM format from a PFX format file
#
# Must supply the input pfx file
PFX_PATH="$1"
if [ "${PFX_PATH}" == "" ]; then
echo "Must supply pfx file path"
exit 1
@j33ty
j33ty / print-memory.go
Created May 22, 2019
Go print current memory
View print-memory.go
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@mattetti
mattetti / multipart_upload.go
Last active Sep 23, 2022
Example of doing a multipart upload in Go (golang)
View multipart_upload.go
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@ebraminio
ebraminio / upload.go
Last active Sep 22, 2022
golang upload client and server
View upload.go
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
@m-radzikowski
m-radzikowski / script-template.sh
Last active Sep 21, 2022
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]