Skip to content

Instantly share code, notes, and snippets.

View cdimascio's full-sized avatar
👋
🤔👨‍💻🚀

Carmine DiMascio cdimascio

👋
🤔👨‍💻🚀
View GitHub Profile
@cdimascio
cdimascio / Configure awscli
Last active January 20, 2023 04:05
IBM Cloud Object Storage COS with AWS CLI
cat ~/.aws/config
[default]
region = us-standard
output = json
@cdimascio
cdimascio / install s3 creds into elasticsearch
Created November 27, 2019 17:19
Install S3 credentials into Elasticsearch keystore
#!/bin/bash
./bin/elasticsearch-keystore create
echo 'XXX' | ./bin/elasticsearch-keystore add --stdin s3.client.default.access_key
echo 'XXX' | ./bin/elasticsearch-keystore add --stdin s3.client.default.secret_key
# Execute onto container
aws ecs execute-command \
--region us-west-2 \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
--task e575d819e2e04dac99387d22a5219576 \
--command /bin/bash --interactive
# Run task with execute enable
aws ecs run-task \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
@cdimascio
cdimascio / launch.json
Created July 12, 2020 01:30
VSCode Debugging: Mocha with Typescript (launch configuration item)
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
@cdimascio
cdimascio / aws_set_role_mfa.bash
Created May 22, 2020 01:25
AWS CLI set to role with MFA
#!/bin/bash
role_arn="<your_role_arn>"
mfa_arn="<your_mfa_arn>"
session_id=`date +%s000`
# export AWS_DEFAULT_REGION="us-east-2"
echo "MFA:"
read token_code
cmd=$(aws sts assume-role --role-arn "${role_arn}" --role-session-name "${session_id}" --serial-number "${mfa_arn}" --token-code "${token_code}" --query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text)
ip addr
ss -pna | grep LISTEN
@cdimascio
cdimascio / .bash
Created March 6, 2020 14:53
bash_poll_http_200
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' || false
@cdimascio
cdimascio / gist:bded6a90aa61ba3fa8bbd648fc4f3262
Created December 3, 2018 01:57
localhost with https using ngrok
ngrok http -bind-tls=true localhost:3000
@cdimascio
cdimascio / kong
Last active October 11, 2018 16:01
1. Kong default config https://github.com/Kong/kong/blob/master/kong.conf.default
2. Then modify
pg_host = # The PostgreSQL host to connect to.
pg_port = 60335 # The port to connect to.
pg_user = kong # The username to authenticate if required.
pg_password = # The password to authenticate if required.
pg_database = kong # The database name to connect to.
@cdimascio
cdimascio / Node 8 Mocha with Babel VSCode
Last active July 27, 2018 15:19
Connect VSCode debugger to Node.js, Typescript using webpack, mocha, ...
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"protocol": "inspector",
"args": [
"-u",
"tdd",
"--timeout",