Skip to content

Instantly share code, notes, and snippets.

View xpepper's full-sized avatar
💭
😏

Pietro Di Bello xpepper

💭
😏
View GitHub Profile
@xpepper
xpepper / universal-switcher.md
Created November 24, 2023 07:56 — forked from jthodge/universal-switcher
Show macOS app switcher across all monitors
defaults write com.apple.dock appswitcher-all-displays -bool true && killall Dock
@xpepper
xpepper / ktor.kt
Created November 2, 2023 15:41
Testing Ktor response validation
import com.casavo.gluglu.core.infrastructure.http.installLoggingConfiguration
import com.casavo.gluglu.core.infrastructure.http.installUserAgentConfiguration
import io.ktor.client.HttpClient
import io.ktor.client.request.get
import io.ktor.client.request.url
import io.ktor.http.isSuccess
import kotlinx.coroutines.runBlocking
val client = HttpClient {
expectSuccess = true
@xpepper
xpepper / map.md
Created October 10, 2023 10:30
The Ultimate Guide to Developer Counter-Productivity
@xpepper
xpepper / aws_db_connections.sh
Last active November 15, 2022 21:21
Print the db connection count for an AWS RDS db
#!/usr/bin/env bash
export AWS_PAGER=""
db_connections () {
echo "## ${1}:"
aws cloudwatch get-metric-statistics \
--namespace AWS/RDS \
--dimensions Name=DBInstanceIdentifier,Value=$1 \
--metric-name DatabaseConnections \
@xpepper
xpepper / mega_uploader.sh
Last active October 29, 2022 17:24
Mega Uploader Script
#!/bin/bash
mega_user="<MEGA ACCOUNT EMAIL>"
mega_pass="<MEGA ACCOUNT PWD>"
mega_path="<MEGA REMOTE TARGET FOLDER>"
folder="${mega_path}/$(date +'%Y-%m-%d')"
megamkdir -u ${mega_user} -p ${mega_pass} "${folder}" --reload
megaput -u ${mega_user} -p ${mega_pass} --path "${folder}" *.mp3 --reload
@xpepper
xpepper / semantic-commit-messages.md
Last active March 22, 2022 16:55 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional, and may contain IDs of the task / user story we are changing the code for (e.g. SELL-123)

Example

@xpepper
xpepper / asvagrant.sh
Created December 30, 2021 21:55
A shell script to execute a command on a vagrant machine (e.g. ./asvagrant.sh ls)
(
relativeDir=""
while [[ ! -d ".vagrant" ]]; do
if [[ "$(pwd)" == "/" ]]; then
echo "Not a valid path"
exit
fi
relativeDir="${PWD##*/}/$relativeDir"
cd ..
@xpepper
xpepper / Docker as a dev tool.md
Created December 4, 2021 14:55
Docker as a dev tool

Docker aliases

(full article by Andrew Welch here: https://nystudio107.com/blog/dock-life-using-docker-for-all-the-things)

alias composer='docker run --rm -it -v `pwd`:/app -v ${COMPOSER_HOME:-$HOME/.composer}:/tmp composer '
alias composer1='docker run --rm -it -v `pwd`:/app -v ${COMPOSER_HOME:-$HOME/.composer}:/tmp composer:1 '

alias node='docker run --rm -it -v `pwd`:/app -w /app node:16-alpine '
tags
TDD, testing

Another precious TDD exercise by Kent Beck

Let's say you interested in TDD but you just can't figure out how to write a test before you write the code. Here's a foolproof exercise that let's you experience the TDD workflow in spite of that block: