Skip to content

Instantly share code, notes, and snippets.

View FranklinHarry's full-sized avatar

Harry FranklinHarry

  • San Francisco
View GitHub Profile
@FranklinHarry
FranklinHarry / vim-cheatsheet.md
Created May 24, 2021 23:10 — forked from azadkuh/vim-cheatsheet.md
vim / vimdiff cheatsheet - essential commands

Vim cheat sheet

Starting Vim

vim [file1] [file2] ...

@FranklinHarry
FranklinHarry / nginx.conf
Created May 23, 2021 15:43 — forked from philiparthurmoore/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@FranklinHarry
FranklinHarry / aws_postgresql_max_connection.md
Created May 17, 2021 20:58 — forked from guizmaii/aws_postgresql_max_connection.md
AWS PostgreSQL max_connection per instance type

The default formula use by AWS RDS to calculate the max_connections parameter is: LEAST({DBInstanceClassMemory/9531392},5000)

But It's hard to find the exact value of DBInstanceClassMemory.

So, here are the values I got when I ran the SQL commmand: show max_connections; in some RDS instances:

Instance type RAM (GB) max_connections
db.t2.small 2 198
db.t2.medium 4 413
@FranklinHarry
FranklinHarry / BIND for the Small LAN.md
Created May 17, 2021 08:18 — forked from Nilpo/BIND for the Small LAN.md
How to configure BIND 9 to act as a caching nameserver or as the nameserver for a local domain.
kubectl get services # List all services
kubectl get pods # List all pods
kubectl get nodes -w # Watch nodes continuously
kubectl version # Get version information
kubectl cluster-info # Get cluster information
kubectl config view # Get the configuration
kubectl describe node <node> # Output information about a node
kubectl get pods # List the current pods
kubectl describe pod <name> # Describe pod <name>
kubectl get rc # List the replication controllers
@FranklinHarry
FranklinHarry / supervisord-example.conf
Created November 13, 2018 03:20 — forked from didip/supervisord-example.conf
Example for supervisord conf file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@FranklinHarry
FranklinHarry / deployment-tool-ansible-puppet-chef-salt.md
Created June 6, 2018 03:25 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@FranklinHarry
FranklinHarry / post-receive
Created June 5, 2018 10:59 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@FranklinHarry
FranklinHarry / pre-commit
Created June 5, 2018 03:59 — forked from shaneog/pre-commit
Git pre-commit hook to prevent commits to master branch
#!/bin/sh
# Check to see if we are on master branch. Stop accidental commits
if [ $(git symbolic-ref HEAD 2>/dev/null) == "refs/heads/master" ]
then
echo "Cannot commit to master branch"
exit 1
fi
exit 0
@FranklinHarry
FranklinHarry / make-test-repo.sh
Created June 5, 2018 03:36 — forked from tobywf/make-test-repo.sh
A script to generate a test repo with two feature branches for the git merge vs git rebase tutorial
#!/bin/bash
set -eux
create_commit() {
git checkout "$1"
echo "$2" > src.txt
git commit -am "$2"
git log --graph --pretty=format:'%s %C(yellow)%d%Creset'
sleep 2 # make the commits distinctive in time