Skip to content

Instantly share code, notes, and snippets.

@akamhy
akamhy / youtube_playlist_length.sh
Last active September 8, 2024 15:58
Bash Script to get YouTube Playlist Length / Duration right in Your terminal.
#!/bin/bash
# Check if curl is installed
if ! [ -x "$(command -v curl)" ]; then
echo "Error: curl is not installed. Please install curl and try again." >&2
exit 1
fi
# Check if jq is installed
if ! [ -x "$(command -v jq)" ]; then
@chockenberry
chockenberry / ql.sh
Last active March 4, 2024 23:40
QuickLook for macOS shell
#!/bin/sh
# usage:
# ql /tmp/file.jpg
# cat /tmp/file.jpg | ql
# cal -h | ql
if [ -z "$*" ]; then
cat > /tmp/ql.stdin
mime_type=$(file --brief --mime-type /tmp/ql.stdin)
@yermulnik
yermulnik / config.yml
Last active April 14, 2025 02:05
GH CLI multi-account switch
git_protocol: ssh
aliases:
personal: '!cp ~/.config/gh/hosts.yml.personal ~/.config/gh/hosts.yml && gh auth status'
work: '!cp ~/.config/gh/hosts.yml.work ~/.config/gh/hosts.yml && gh auth status'
@TheSherlockHomie
TheSherlockHomie / RenewExpiredGPGkey.md
Created January 3, 2021 16:36
Updating expired GPG keys and backing them up 🔑🔐💻

Updating expired GPG keys and their backup 🔑🔐💻

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object
@LeeDDHH
LeeDDHH / youtube-markdown.md
Created November 29, 2020 04:51
Youtube markdown 埋め込み
@daveydee33
daveydee33 / regex-and-sed-things.md
Last active May 8, 2025 11:47
Extract an HTML tag value using sed with regular expression

Extract the content from inside an HTML tag with sed and a regex

example <title>this is it</title> if we want to extract just this is it.

echo '<title>this is it</title>' | sed -nE 's/<title>(.*)<\/title>/\1/p'

Regex Find and select HTML attributes - such as a "class" name, even if it spans multiple lines.

@yoshimana
yoshimana / BrewBundleの使い方.md
Created October 29, 2019 07:23
Brew Bundleの使い方

Brew Bundle

インストール

$ brew tap Homebrew/bundle
@YuukiToriyama
YuukiToriyama / national_anthem.bash
Last active November 24, 2024 21:26
bashでオルゴール【Sox】
# National Anthem of USSR
# Execute this ShellScript, Soviet Anthem Plays You.
# Before execute this, you have to install Sox(Sound eXchange) by apt-get / brew.
mkdir notes
cat << EOS | grep -v "-" | awk '{if ($1=="z") {print "sox -n -c 2 notes/"NR".wav trim 0.0", $2/4} else {{print "sox -n -c 2 notes/" NR ".wav synth", $2/4, "pluck", $1, "\\"} if ($3!="") {print "pluck", $3, "\\"} if ($5!="") {print "pluck", $5, "\\"} print ";"}}END{print "sox notes/{1.."NR-1"}.wav song_new.wav"}' | bash
E4 4 G4 4 C5 4
-
D4 1 G4 1 D5 1
C4 1 G4 1 C5 1
@laggardkernel
laggardkernel / startup-time-of-zsh.md
Last active June 10, 2025 07:56
Comparison of ZSH frameworks and plugin managers

Comparison of ZSH frameworks and plugin managers

Changelog

  • update 1: add a FAQ section
  • update 2: benchmark chart and feature comparison table
  • update 3:
    • improve the table with missing features for antigen
    • new zplg times result

TLDR

@sho-t
sho-t / zsh_variable.md
Last active February 25, 2025 02:22
Zsh 変数メモ

variable

変数に関するメモ。 💤がついてるのはzsh 固有のもの。

📮 シェル変数と環境変数

  • シェル変数 → 子プロセスに継承されない
  • 環境変数 → 子プロセスに継承される

環境変数登録