Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -C
DOWNLOAD_URL="https://bitwarden.com/download/?app=cli&platform=linux"
INSTALL_DIR="$HOME/.local/bin"
INSTALL_PATH="${INSTALL_DIR}/bw"
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -C
ARCH=$(uname -m)
GITHUB_API_URL="https://api.github.com/repos/fish-shell/fish-shell/releases/latest"
FISH_VERSION=$(curl -sfL $GITHUB_API_URL | jq -r ".tag_name")
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -C
ARCH=$(uname -m)
LOCAL_DIR=/usr/local
DOWNLOAD_URL="https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-${ARCH}.tar.gz"
@holly
holly / tools_install.py
Last active March 1, 2026 16:30
Automatic installation script for ripgrep, bat, fd, glow, duf, eza, shellcheck, lua-language-server (using standard modules only)
#!/usr/bin/env python3
"""
Automatic installation script for ripgrep, bat, fd, glow, duf, eza, shellcheck, lua-language-server (using standard modules only)
Fetches the latest versions from GitHub API, compares with existing versions, and updates them.
Also automatically installs fish shell completion files.
"""
import os
import sys
import json
@holly
holly / mysql_localforward.sh
Created September 27, 2025 10:47
SSH local port forward for MySQL with health-check & auto-reconnect
#!/usr/bin/env bash
# mysql_localforward.sh — SSH local port forward for MySQL with health-check & auto-reconnect
# - カレントの ./.env を読み込み(あれば)
# - さらに -f /path/to/.env で指定した .env を読み込み(上書き)
# - フォワード断検知で自動再接続、排他実行、ローカルバインドがデフォルト
set -Eeuo pipefail
show_help() {
cat <<'EOF'
@holly
holly / wp_autologin.php
Last active March 16, 2025 03:05
wordpress auto login
<?php
define('WP_USE_THEMES', false);
require_once __DIR__ . '/wp-load.php';
$user_id = 1;
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id, true);
wp_redirect(admin_url());
@holly
holly / htaccess
Created March 9, 2025 06:45
wordpress htaccess
<FilesMatch "^(xmlrpc|wp-cron|wp-trackback)\.php$">
Require all denied
</FilesMatch>
# ${image}.jpg.webp, ${image}.png.webというファイルがあればURLは${image}.jpg, ${image}.pngというアクセスでも内部的に.webpファイルをレスポンスとして返す
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@holly
holly / add_samesite_cookie
Last active February 23, 2025 06:01
wordpress snippets
#!/usr/bin/env python
# vim:fileencoding=utf-8
""" [NAME] script or package easy description
[DESCRIPTION] script or package description
"""
import os, sys, io
import json
import boto3
#!/usr/bin/env python
import os
import sys
import urllib
import io
import tarfile
import re
GEOIP_LICENSE_KEY = "your maxmind geoip license key"