Skip to content

Instantly share code, notes, and snippets.

View devodla's full-sized avatar
💭
I may be slow to respond.

Reynaldo devodla

💭
I may be slow to respond.
View GitHub Profile
@devodla
devodla / cognito-idtoken-cli.sh
Created May 26, 2022 22:21 — forked from Can-Sahin/cognito-idtoken-cli.sh
Simple shell script to obtain a IdToken from Cognito User Pool. Just like logging in.
#!/bin/bash
username="COGNITO_USER_NAME"
password="PASSWORD"
clientid="APP_CLIENT_ID"
region="eu-west-1"
aws_profile="AWS_CLI_PROFILE"
response_json=""
json_field='IdToken'
@devodla
devodla / lambda-proxy-integration.yml
Created December 6, 2021 14:54 — forked from balintsera/lambda-proxy-integration.yml
Lambda Proxy Integration with Cloudformation tamplate
apiGateway:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "example-api-gw"
Description: "Example API"
ProxyResource:
Type: "AWS::ApiGateway::Resource"
Properties:
ParentId: !GetAtt apiGateway.RootResourceId

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@devodla
devodla / mongodb-s3-backup.sh
Created September 30, 2020 00:39 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@devodla
devodla / mongodb-ssl.sh
Last active September 7, 2020 01:35 — forked from kevinadi/mongodb-ssl.sh
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=BR/ST=SP/L=Sao Paulo/O=Layme Inc/OU=root/CN=`hostname -f`/emailAddress=layme.reynaldo@icloud.com"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=BR/ST=SP/L=Sao Paulo/O=Layme Inc/OU=server/CN=`hostname -f`/emailAddress=layme.reynaldo@icloud.com"
# Sign the server cert