Skip to content

Instantly share code, notes, and snippets.

@Galaxy83
Galaxy83 / Dockerfile
Last active February 28, 2023 10:57
AWS Lambda Layer Python 3.9 via Docker
# As of this writing, Lambda can support Python 3.9, but amazonlinux comes with Python 3.7.
# This makes it difficult to create a Layer using amazonlinux image.
# This Dockerfile will install Python 3.9 and automatically prepare the Layer file.
# Important note: The key is to build the Layer file with the right file STRUCTURE !!!
# How to use:
# 1. Make sure the latest Docker is installed.
# 2. mkdir layer
# 3. cd layer
@Galaxy83
Galaxy83 / s3unzip.js
Last active February 16, 2023 18:29
node.js zlib decompress uncompress unzip s3 file getObject buffer
const unzipFromS3 = (key, bucket) => {
return new Promise(async (resolve, reject) => {
let options = {
'Bucket': bucket,
'Key': key,
};
s3.getObject(options, function(err, res) {
if(err) return reject(err);
@Galaxy83
Galaxy83 / each_in_thread.rb
Last active January 26, 2023 11:40
Ruby Each in Thread implementation - each_in_thread - Good for concurrent API calls.
# frozen_string_literal: true
require 'thread/pool'
# Install Gem 'thread' or add it to your Gemfile.
#
# Example:
#
# ids = [1,2,3,4,5,6,7,8,9,10]
# ids.each_in_thread(concurrency: 20) do |id|
@Galaxy83
Galaxy83 / .pgpass
Created April 13, 2021 08:18
zsh / bash script copy production Postgres database to local and disk OR copy only specific table like oauth OR reset local from last pull
replace_with_remote_url:replace_with_remote_port:replace_with_remote_tablename:replace_with_remote_username:replace_with_remote_password