Skip to content

Instantly share code, notes, and snippets.

View brunojppb's full-sized avatar
🌱
code gardening...

Bruno Paulino brunojppb

🌱
code gardening...
View GitHub Profile
@brunojppb
brunojppb / icon_padding.sh
Created February 13, 2024 10:57
Add padding to your MacBook navbar icons
defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6
@brunojppb
brunojppb / git_e_rails.md
Last active January 25, 2024 00:15
configurando o git e o Rails no ubuntu

Instalar o git:

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

Instalar o rbenv:

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
@brunojppb
brunojppb / tf-format.sh
Created December 22, 2023 10:45
Format Terraform files on a pre-coomit hook
#!/bin/sh
# Apply Terraform formatting to any .tf files modified during
# git changes that are staged.
# Make sure that you have terraform <YOUR_TERRAFORM_VERSION> installed.
# You can use TFSwitch to manage different versions of Terraform at once
# See: https://tfswitch.warrensbox.com/Install/
REQUIRED_TF_VERSION="Terraform v0.12.31"
# Halt the script if any pipe operations fail
@brunojppb
brunojppb / speed_up_ffmpeg.md
Created December 18, 2023 22:40
Speed up Video with ffmpeg

To speed up a video using FFMPEG via the cli:

ffmpeg -i my_video.mp4 -vf "setpts=(PTS-STARTPTS)/3" -crf 18 new_video.mp4

Where 3 is the 3x speed.

@brunojppb
brunojppb / routeMatcher.ts
Last active December 5, 2023 13:39
How to match Remix routes with route patterns so we can track using tracing libraries like Datadog
import { matchPath } from '@remix-run/react'
import fs from 'node:fs'
import * as path from 'node:path'
/**
* Given a request path, tries to find a Remix route path pattern
* that matches with an existing route in your Remix app.
*
* Make sure to generate the Remix routes file during your build with:
*
@brunojppb
brunojppb / setup_redmine_4_ubuntu.md
Last active November 29, 2022 03:19
How to setup Redmine 4 on Ubuntu 18.04

How to setup Redmine 4 on Ubuntu 18.04

Prerequisites:

Full SSH root access or a user with sudo privileges.

Step 1: Connect to your Server

To connect to your server via SSH as the root user, use the following command:

@brunojppb
brunojppb / docker_sbt_scala.md
Last active November 10, 2022 12:31
Docker image with Java 8 and SBT 1.3.5

Docker image with Scala and SBT

This image is based on on alpine linux with Java 8 and includes SBT 1.3.5. You can optionally install Scala and make it available directly.

This is image is available here: brunojppb/scala-sbt:1.3.5

The Dockerfile.yml:

FROM openjdk:8-alpine
LABEL maintainer="contact@bpaulino.com"

Debugging NodeJS projects via VS Code

create a launch config under .vscode with the following:

// .vscode/launch.json
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
@brunojppb
brunojppb / direct_deps_count.js
Last active August 23, 2022 10:49
Count how many direct dependencies a monorepo has.
const { readdir } = require('fs/promises');
const { join } = require('path');
const fs = require('fs');
const { set } = require('date-fns');
const readdirRecursive = async dir => {
const files = await readdir(dir, { withFileTypes: true });
const paths = files.map(async file => {
const path = join(dir, file.name);
@brunojppb
brunojppb / docker-redis-run.md
Last active August 4, 2022 11:24
Run redis with Docker one-liner

Run redis with Docker in a one-liner

Bind the default Redis port (6379) to the host port (6379). Now you can access Redis from your host machine via localhost:6379.

docker run --name my-redis -p 6379:6379 --rm redis