Skip to content

Instantly share code, notes, and snippets.

@actionjack
actionjack / a-mongodb-replica-set-docker-compose-readme.md MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume
View a-mongodb-replica-set-docker-compose-readme.md

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

View mongodb-replica.sh
#!/usr/bin/env bash
# MongoDB port
PORT=27017
# Consul key to setup the lock
MONGO_KEY="mongodb/replicaset"
#
# Retrieve MongoDB instance IPs from Consul
#
View #1 Merging Rubygems and Bundler.md

Merging Rubygems and Bundler

1.sh:

#!/bin/sh
set -eux
rm -rf rubygems bundler
git clone https://github.com/rubygems/rubygems
git clone https://github.com/rubygems/bundler
@actionjack
actionjack / github_users_cred.md
Last active Mar 10, 2021
GitHub User's Creed
View github_users_cred.md

GitHub User's Creed

This is my GitHub token. There are many like it, but this one is mine.

My GitHub token is my best friend. It is my life. I must master it as I must master my life.

Without me, my GitHub token is useless. Without my GitHub token, I am useless. I must code my GitHub token true. I must code cleaner than my enemy who is trying to out code me. I must out code him before he out codes me. I will ...

My GitHub token and I know that what counts in war is not the commits we make, the frequency of our rebases, nor the pull requests we make. We know that it is the merges that count. We will merge ...

@actionjack
actionjack / taint_module.sh
Created Nov 18, 2020 — forked from justinclayton/taint_module.sh
Terraform: taint all resources from one module
View taint_module.sh
#!/bin/bash
module=$1
for resource in `terraform show -module-depth=1 | grep module.${module} | tr -d ':' | sed -e 's/module.${module}.//'`; do
terraform taint -module ${module} ${resource}
done
@actionjack
actionjack / get_latest_release.sh
Created Nov 5, 2020 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
View get_latest_release.sh
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@actionjack
actionjack / nginx.conf
Created Sep 14, 2020 — forked from deltheil/nginx.conf
Hide sensitive GET parameters within nginx access logs thanks to the Lua module
View nginx.conf
http {
log_format filt '$remote_addr - $remote_user [$time_local] "$_request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
location /login {
# `set` is provided by the Rewrite module
set $filter "password|secret";
@actionjack
actionjack / ffmpeg-watermark.md
Created May 30, 2020 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video
View ffmpeg-watermark.md

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@actionjack
actionjack / mongodb-ssl.sh
Created Apr 22, 2020 — forked from kevinadi/mongodb-ssl.sh
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
View mongodb-ssl.sh
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Sign the server cert
View add-update-github-access-token-on-mac.md

As outlined here, there are a couple of situations where you need to authenticate with GitHub by using an Acces Token:-

  1. If you have Two-Factor Authentication (2FA) enabled.
  2. You are accessing an organisations protected content using SAML Single-Sign On (SSO).

Create an Access Token

In your GitHub account, go to Settings / Developer settings / Personal access tokens and select Generate New Token. Make a note of the token somewhere safe since this is the only chance you get to see it.

Add the token to your local OSX Key Chain