Skip to content

Instantly share code, notes, and snippets.

View dbarjs's full-sized avatar
🏡
Working from home

Eduardo Barros dbarjs

🏡
Working from home
View GitHub Profile
@dbarjs
dbarjs / DIRECTORY_LISTING_WITH_SIZES.md
Last active May 18, 2023 16:38
SH - Directory Listing with Sizes

Save the script to a file, such as directory_list_sizes.sh, and make it executable:

chmod +x directory_list_sizes.sh

To use the script, provide the target directory as an argument when running it:

./directory_list_sizes.sh /path/to/directory

🚀 A blazingly fast shell one-liner 🚀

This shell script displays all blob objects in the repository, sorted from smallest to largest.

For my sample repo, it ran about 100 times faster than the other ones found here. On my trusty Athlon II X4 system, it handles the Linux Kernel repository with its 5.6 million objects in just over a minute.

The Base Script

git rev-list --objects --all |
@dbarjs
dbarjs / nuxt.config.ts
Last active July 6, 2023 03:53
Fix for absolute paths on builded tsconfig.json on Nuxt 3.6.0.
import { relative, resolve } from 'node:path';
export default defineNuxtConfig({
hooks: {
'prepare:types': ({ tsConfig }) => {
if (!tsConfig?.compilerOptions?.paths) {
return;
}
const rootDir = process.cwd();
@dbarjs
dbarjs / framerize.js
Last active September 9, 2023 16:34
Framerize.js
(function () {
'use strict';
/**
* @typedef {'warn' | 'info' | 'log' | 'error'} LoggerType
*/
/**
* @typedef {Object} UseSoundAlertOptions
* @property {number} timeBetweenPlays
@dbarjs
dbarjs / usePersistentQueries.ts
Last active October 1, 2023 20:15
usePersistentQuery - a @vueuse composable proposal
import type { TupleToUnion } from 'type-fest';
import type { UsePersistentQueryOptions } from './usePersistentQuery';
import { usePersistentQuery } from './usePersistentQuery';
import { useRoute } from '#vue-router';
export function usePersistentQueries<
TKeys extends readonly string[],
TReturn = Record<TupleToUnion<TKeys>, Ref<string>>,