Skip to content

Instantly share code, notes, and snippets.

View sametcn99's full-sized avatar
🎧
Focusing

samet sametcn99

🎧
Focusing
View GitHub Profile
@sametcn99
sametcn99 / reinstall-dependencies.ps1
Created November 4, 2024 13:33
This command sequence cleans all dependencies from the current Node.js project (node_modules and package-lock.json file are deleted), and then reinstalls the dependencies (npm install). This is often done to set up a project from scratch or to update dependencies for running the project in a different environment.
Remove-Item -Recurse -Force node_modules, package-lock.json ; npm install

Annotated Tags

Creating an annotated tag in Git is simple. The easiest way is to specify -a when you run the tag command:

$ git tag -a v1.4 -m "my version 1.4"
$ git tag
v0.1
v1.3
v1.4
@sametcn99
sametcn99 / script.sh
Created November 4, 2024 13:30
update all npm packages
npx npm-check-updates -u && npm i
@sametcn99
sametcn99 / useFetch.tsx
Created November 4, 2024 13:29
react usefetch hook
import { useState, useEffect, useMemo } from 'react'
type FetchOptions = RequestInit
type FetchResult<T> = {
data: T | null
loading: boolean
error: string | null
}
@sametcn99
sametcn99 / tailwind.config.ts
Created November 4, 2024 13:25
tailwind a4 page sizes
import type { Config } from 'tailwindcss'
import typographyPlugin from '@tailwindcss/typography'
const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
using global::GPVBlazor.Services.Interfaces;
namespace GPVBlazor.Services.Configuration
{
public static class ServiceConfiguration
{
public static void Configure(IServiceCollection services)
{
services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
import { Octokit } from 'octokit'
import { input } from '@inquirer/prompts'
import { writeFileSync, mkdirSync } from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
// Prompt for GitHub token with validation
# Prompt the user for the full path of the folder to delete
$folderPath = Read-Host "Enter the full path of the folder you want to delete"
# Check if the entered path is a valid folder
if (Test-Path -Path $folderPath -PathType Container) {
# Ask for confirmation from the user
$confirm = Read-Host "Are you sure you want to delete this folder and all its contents? (Y/N)"
if ($confirm -eq "Y") {
try {
Remove-Item -Path $folderPath -Recurse -Force
@sametcn99
sametcn99 / index.js
Created October 2, 2024 23:34
This script downloads all public gists for a specified GitHub user and saves them to the local filesystem. The gists are organized by username and gist ID.
import { Octokit } from 'octokit'
import { input } from '@inquirer/prompts'
import { writeFileSync, mkdirSync } from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
// Prompt for GitHub token with validation
@sametcn99
sametcn99 / index.js
Created October 2, 2024 23:33
Write lyric metadata to audio files from genius api
import { readdirSync, readFileSync } from "fs";
import { parseBuffer } from "music-metadata";
import { getLyrics } from "genius-lyrics-api";
import ffmetadata from "ffmetadata";
import readline from "readline";
import ora from "ora";
/**
* Retrieves an array of file names representing the FLAC files in the specified directory.
* Only files with the extensions ".flac" or ".mp3" will be included in the result.