Skip to content

Instantly share code, notes, and snippets.

@d3vAdv3ntur3s
d3vAdv3ntur3s / recording.md
Created May 11, 2022 10:54
github readme recording

Install

  • asciinema: brew install asciinema
  • svg-term-cli: npm install -g svg-term-cli

Run

asciinema rec

When done type exit and save locally ctrl+d

@d3vAdv3ntur3s
d3vAdv3ntur3s / ssl-config-generation-localhost.md
Created March 14, 2021 15:43
SSL TLS certificate generation instructions using mkcert for Java / Spring Boot apps

SSL Certificate Generation

Keystore & mkcert

  • PKCS12 is the industry standard, however, java has a proprietary format specific for Java called JKS, we will stick with PKC12 for our keystore.
  • Managing the generation of certs and trust store system wide, mkcert is an incredibly useful tool

Install mkcert

brew install mkcert
@d3vAdv3ntur3s
d3vAdv3ntur3s / delete_branches.sh
Created January 13, 2022 12:19
Delete local & remote git branches after x months old
#!/bin/sh
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$\|develop$'); do
if ! ( [[ -f "$branch" ]] || [[ -d "$branch" ]] ) && [[ "$(git log $branch --since "6 month ago" | wc -l)" -eq 0 ]]; then
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
git branch -d "${local_branch_name}"
echo "${local_branch_name}"
git push origin --delete "${local_branch_name}"
fi
done
@d3vAdv3ntur3s
d3vAdv3ntur3s / git_early_eof_error.md
Created October 28, 2021 13:11
Git early EOF (Error decoding the received TLS packet, index-pack failed) Issue

Git early EOF (Error decoding the received TLS packet, index-pack failed) Issue

git clone https://github.com/d3vadv3ntur3s/some-cool-repo.git
Cloning into 'some-cool-repo'...

remote: Enumerating objects: 145563, done.
@d3vAdv3ntur3s
d3vAdv3ntur3s / config.yml
Created July 31, 2021 15:15
CircleCI Mono Repo Setup
version: 2.1
# Use CircleCI's dynamic configuration feature
setup: true
# Orbs are built in helpers made by CircleCI & the community
orbs:
# Path iltering is the magic behind checking for file changes and leverages continuation orb to proceed with workflows
path-filtering: circleci/path-filtering@0.0.2
@d3vAdv3ntur3s
d3vAdv3ntur3s / README.md
Last active August 4, 2021 16:31
Node Docker Best Practices and mounting secret

Docker Build command

id - this has to match the id from the mount secret command src - path to file locally docker build --no-cache . -t test-backend --secret id=npmrc,src=backend/.npmrc --file backend/dockerfile

## Mount secrets commannd Part of the docker build kit, enabled by default A way of securely mounting secrets The secret will not be in the final image, one to use for example performing the command npm ci.

@d3vAdv3ntur3s
d3vAdv3ntur3s / Dockerfile
Created July 31, 2021 13:20
Dockerise React with NGNIX
# Stage 1 - Install dependencies & build react assets
FROM node:14-alpine@sha256:0c80f9449d2690eef49aad35eeb42ed9f9bbe2742cd4e9766a7be3a1aae2a310 AS build
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY package*.json /usr/src/app/
RUN npm i -g npm@7.20.0
# mount a secret i.e. a custom nprc for private repos to be used for the npm clean install command only
@d3vAdv3ntur3s
d3vAdv3ntur3s / Makefile
Created July 31, 2021 12:41
Example Makefile
SHELL:=/usr/bin/env bash #default shell used
MAKEFLAGS += --silent --jobs 10 #don't echo commands and parallelise
# Default task executed when running with make command only no args
default: help
#src: https://victoria.dev/blog/how-to-create-a-self-documenting-makefile/
help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

Keybase proof

I hereby claim:

  • I am d3vadv3ntur3s on github.
  • I am devadventures (https://keybase.io/devadventures) on keybase.
  • I have a public key ASC0KBgXCd4-4OT3HZe2t7DP6JnhoDoMolrx9Mx-K2TOZQo To claim this, I am signing this object:
{
  "body": {
    "key": {
@d3vAdv3ntur3s
d3vAdv3ntur3s / 1password.sh
Created June 25, 2021 13:05
1password setup + retrieval
# install for mac via brew
$ brew install --cask 1password-cli
# sign in via cmd line
# You will need your secret key generated see 1password website: https://support.1password.com/secret-key/
# followed by password
$ op signin subdomain.1password.com user@domain.com
# alias into bash_profile for ease sake
$ alias 1pws='eval $(op signin subdomain)'