Skip to content

Instantly share code, notes, and snippets.

@thaibinhindex
thaibinhindex / .gitconfig
Created May 20, 2023 15:22 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github
@thaibinhindex
thaibinhindex / Merge two env file
Last active February 9, 2022 04:21 — forked from mattkenefick/README.md
Combine two env/ini files and remove duplicate entries
# Purpose
If you're making a project where you need a base level of configs and various combinations of overrides... this `merge.sh` script will let you combine multiple `.env` or `.ini` files (key/value) and remove duplicates based on the key.
# Usage Example
Create both files in a structure like:
```
specific.env
base.env
#!/bin/bash
_host='{MYSQL ENDPOINT}'
_user='sbtest'
_pass='password'
_port=3306
j=1
while true
do
#!/bin/bash
DOMAIN_INTL="domain.local"
SUFF_PATH=ssl
CA_KEY=${SUFF_PATH}/ca.key
CA_PEM=${SUFF_PATH}/ca.pem
CLIENT_KEY=${SUFF_PATH}/${DOMAIN_INTL}.key
CLIENT_CSR=${SUFF_PATH}/${DOMAIN_INTL}.csr
CLIENT_PEM=${SUFF_PATH}/${DOMAIN_INTL}.pem
@thaibinhindex
thaibinhindex / bootlocal.sh
Created June 18, 2021 02:30
Docker compose for docker toolbox
#!/bin/bash
# File path: /var/lib/boot2docker/bootlocal.sh
if [ ! -f /usr/local/bin/docker-compose ]; then
if [ ! -f /var/lib/boot2docker/docker-compose ]; then
curl -L https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d '"' -f 4)/docker-compose-`uname -s`-`uname -m` > /var/lib/boot2docker/docker-compose
fi
cp /var/lib/boot2docker/docker-compose /usr/local/bin/docker-compose
fi
if [ -f /var/lib/boot2docker/docker_config.json ]; then
@thaibinhindex
thaibinhindex / index.js
Last active June 18, 2021 02:27
RDS log stream to lambda then to Graylog
'use strict';
var http = require('http');
var zlib = require('zlib');
const dgram = require('dgram');
const grayLogConfiguration = {
hostName: process.env.LOG_HOST,
port: process.env.LOG_PORT
};
@thaibinhindex
thaibinhindex / script.sh
Last active June 18, 2021 02:27
OpenSSL Encrypt and Decrypt
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys