Skip to content

Instantly share code, notes, and snippets.

View gaurangrshah's full-sized avatar
💭
🚀

gshah2020 gaurangrshah

💭
🚀
View GitHub Profile
@gaurangrshah
gaurangrshah / ratings
Last active July 3, 2022 02:05
mp3tag rating script for tractor ratings "popularimeter"
$repeat($char(9733),$div($sub($regexp(%popularimeter%,'traktor@native-instruments\.de\|(\d{1,3})\|\d+',$1),$mod($regexp(%popularimeter%,'traktor@native-instruments\.de\|(\d{1,3})\|\d+',$1),51)),51))
255 = ★★★★★
204 = ★★★★
153 = ★★★
102 = ★★
51 = ★
@gaurangrshah
gaurangrshah / id3tagOperations.js
Last active July 1, 2022 18:03
Id3 Tag Clean up and OSX Tag from Comments
// yarn add node-id3 osx-tag
const path = require('path');
const fs = require('fs');
const NodeID3 = require('node-id3')
const tag = require('osx-tag');
const urlREGEX = new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?([^ ])+");
const allowedTags = ['3AM', '4AM', '5AM', 'acid', 'afro', 'ah', 'ambient', 'analog', 'bouncy', 'breakdown', 'buildup', 'chillout', 'classic', 'closer', 'closing', 'commercial', 'dark', 'deep', 'dirty', 'dub', 'eastern', 'elemental', 'festival', 'funk', 'grimy', 'grinder', 'hiphouse', 'hiptech', 'house', 'I', 'I-II', 'I-IV', 'I-V', 'II', 'II-III', 'II-IV', 'III', 'III-IV', 'indie', 'IV', 'IV-V', 'jack', 'khole', 'latin', 'lounge', 'massive', 'melodic', 'minimal', 'nobass', 'nudisco', 'nujazz', 'opener', 'opening', 'PODCAST', 'prime', 'proggy', 'soul', 'spoken', 'sundaze', 'sunrise', 'tech', 'trance', 'tribal', 'V', 'vox', 'XXX']
@gaurangrshah
gaurangrshah / jsconfig.json
Created June 6, 2022 00:16
next.js config
{
"compilerOptions": {
"baseUrl": "pages",
"paths": { "@/*": ["../*"] }
}
}
.next
dist
build
public
node_modules/
async function getGist(gistId, filename) {
const url = `https://api.github.com/gists/${gistId}`;
try {
const response = await fetch(url);
const json = await response.json();
return JSON.parse(json.files[filename].content)
} catch (err) {
console.error(err)
}
}
@gaurangrshah
gaurangrshah / fresh-install-2024.md
Last active January 11, 2025 06:23
#freshie - install 2024

Freshie 2024

install homebrew package manager. Allows installing of many every day apps including most developer tools. It provides a legendary cli for managing these packages, and provides one of the best and sometimes only real way to actually uninstall apps from your mac.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
#!/usr/bin/env bash
all_args=("$@")
first_arg=$1
rest_args=("${all_args[@]:2}")
mkdir $1 && cd $1
npm init -y
curl -o ".gitignore" https://gist.githubusercontent.com/gaurangrshah/76cc7b8d4e79642b9f103267ef74a21f/raw
code .
import { redis } from './redis';
const fetch = async (key, fetcher, expires) => {
const existing = await get(key);
// If the key is already in redis, return it
if (existing !== null) return existing;
// Otherwise, set it and return the value
else set(key, fetcher, expires);
};
const crypto = require("crypto");
const secretKey = crypto.randomBytes(8).toString("hex");
console.log(secretKey);
// run in terminal as `node keygen.js`
#!/bin/bash
# This script will download the contents of a GitHub repo
# and place them in a local directory.
#
# Usage:
# download-repo.sh <repo> <output-path> <nested-path>
#
# Example:
# download-repo.sh wattenberger/kumiko ./kumiko-assets public/assets