This helps to git your local git clean by deleting all branches, but develop
, main
and master
:
git branch -l | egrep -v "(^\*|master|main|develop)" | xargs git branch -D
defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6 | |
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6 |
#!/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 |
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.
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: | |
* |
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
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); |
The package linked to from here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.#!/usr/bin/env bash | |
# This bash script makes use of the Slack API to upload files. | |
# I found this useful due to the fact that the attachement option | |
# available in incoming webhooks seems to have an upper limit of | |
# content size, which is way too small. | |
# | |
# See also: https://api.slack.com/methods/files.upload | |
# safety first |