Skip to content

Instantly share code, notes, and snippets.

View finesse-fingers's full-sized avatar

Bobby Koteski finesse-fingers

  • McKinsey & Company
  • Melbourne
View GitHub Profile
@finesse-fingers
finesse-fingers / coffee.sh
Last active January 30, 2024 04:18
Make your PC drink coffee
python -m pip install pyautogui --quiet
echo "Making an oat latte with 2 sugars..."
echo "Drinking..."
echo "Press ctrl+c to stop drinking..."
python -c "import pyautogui, time; [(pyautogui.press('shift'), time.sleep(59)) for _ in iter(int, 1)]"
@finesse-fingers
finesse-fingers / .zshrc
Created May 28, 2023 06:29
Ask GPT zsh alias
ask_gpt() {
# print the prompt in blue
echo -e "\e[34mPrompt: \"$1\"\e[0m"
# make a a slient request and store the result
response=$(curl https://api.openai.com/v1/completions \
--silent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {TOKEN}" \
-d '{
"model": "text-davinci-003",
@finesse-fingers
finesse-fingers / .zshrc
Last active February 6, 2024 05:42
Git related zsh aliases
switch_back_to_branch() {
# get the current branch name
current_branch=$(git rev-parse --abbrev-ref HEAD)
# pull target branch
git fetch origin $1:$1
# switch to target branch
git checkout $1
# if -d is passed as second argument, delete the current branch
if [ "$2" = "-d" ]; then
# delete old branch and suppress error if branch is not merged
@finesse-fingers
finesse-fingers / pimp-powershell.md
Last active December 10, 2021 23:43
Pretty themes and history autocompletion for Powershell in Windows Terminal

How to pimp Powershell

Install posh-git, oh-my-posh and CaskaydiaCode Nerd Font

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Visit https://www.nerdfonts.com/ and find CaskaydiaCove Nerd Font. The font contains glyphs/icons required by the themes.

ingress:
enabled: true
className: ""
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
hosts:
- host: kubernetes.docker.internal
paths:
- path: /my-app-path/?(.*)
@finesse-fingers
finesse-fingers / bash-args.sh
Last active August 24, 2021 12:54
How to parse cli args in a bash script
# https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script
# usage: <script> -u <username> -a <age> -f <fullname>
while getopts u:a:f: flag
do
case "${flag}" in
u) username=${OPTARG};;
a) age=${OPTARG};;
f) fullname=${OPTARG};;
esac
done
@finesse-fingers
finesse-fingers / clone-github-org.sh
Created February 3, 2021 02:45
A script to clone all repos in a github organisation
#!/bin/bash
# Substitute variables here
ORG_NAME="<ORG_NAME>"
GITHUB_INSTANCE="<GITHUB_INSTANCE>"
URL="https://${GITHUB_INSTANCE}/api/v3/orgs/${ORG_NAME}/repos"
curl ${URL} | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["clone_url"]} ]}'
docker run -d \
-e POSTGRES_PASSWORD=SuperSecret \
-v ~/postgresql/13/data:/var/lib/postgresql/data \ # windows: -v d:/postgresql/13/data:/var/lib/postgresql/data
-p 5432:5432 \
--name postgres \
postgres:13
docker run -p 5050:80 -d \
-e 'PGADMIN_DEFAULT_EMAIL=admin@domain.com' \
-e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \
@finesse-fingers
finesse-fingers / run-couchdb-docker.sh
Last active April 3, 2021 08:29
Start a CouchDB container with mount
mkdir -p /home/ubuntu/couchdb/data
docker run -d \
--restart unless-stopped \
-v /home/ubuntu/couchdb/data:/opt/couchdb/data \
-e COUCHDB_USER=admin \
-e COUCHDB_PASSWORD=strongPassword \
-p 5984:5984 \
--name couchdb \
couchdb:latest