Skip to content

Instantly share code, notes, and snippets.

View katagaki's full-sized avatar
🤹
多忙

Justin katagaki

🤹
多忙
  • Tokyo, Japan
  • 18:40 (UTC +09:00)
View GitHub Profile
@katagaki
katagaki / docker-rm-all.sh
Created October 28, 2025 07:41
Delete all Docker images
docker rmi --force $(docker images --all --quiet)
@katagaki
katagaki / colima.yaml
Last active October 28, 2025 03:16
Colima template for macOS.
cpu: 8
disk: 200
memory: 8
arch: aarch64
runtime: docker
hostname: ""
kubernetes:
enabled: false
version: v1.34.1+k3s1
@katagaki
katagaki / XcodeDark.runestonetheme
Created September 15, 2025 14:04
Xcode dark theme for Runestone (WIP)
{
"editor": {
"caret": "#3A87FE",
"background": "#1F1F24",
"pageGuide": {
"background": "#1F1F24",
"hairline": "#FFFFFF4D"
},
"highlightedTextBackground": "#FFFF005A",
"invisibleCharacters": "#424D5B",
@katagaki
katagaki / LiquidGlass.sh
Created September 3, 2025 01:21
Force Liquid Glass on/off for all apps on macOS 26+
echo Output defaults domains
defaults domains > domains.txt
echo Replace \', \' with new lines
sed -i "" 's/, /\n/g' domains.txt
echo Reset Liquid Glass defaults for apps
while read d; do
defaults delete "$d" com.apple.SwiftUI.IgnoreSolariumLinkedOnCheck
done <domains.txt
@katagaki
katagaki / AppDelegate.swift
Created August 24, 2025 04:34
An empty AppKit app without using Storyboards
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
styleMask: [.titled, .closable],
@katagaki
katagaki / pykx_threaded.py
Created July 31, 2025 04:17
Execute Q queries using PyKx from a threaded application such as Flask or FastAPI
import os
from concurrent.futures import ProcessPoolExecutor, Future
from io import BytesIO
from pandas import DataFrame, read_parquet
# Requires installation of pyarrow as well
def run_query_in_process(query: str) -> bytes:
@katagaki
katagaki / RemoveDSStore.sh
Created July 23, 2025 22:25
Remove .DS_Store from a new Git repository.
# From https://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
touch .gitignore
echo .DS_Store >> .gitignore
git add .gitignore
git commit --amend
git push -u origin main
@katagaki
katagaki / GitPullAll.sh
Last active July 27, 2025 12:40
Run git pull on all subdirectories
for dir in */; do cd "$dir" && git fetch && git pull && cd ..; done
@katagaki
katagaki / CreateUserWithSSHKey.sh
Created April 22, 2025 09:08
Issue SSH key for a new user
# This script should be run with sudo
useradd --disabled-password --create-home $1
passwd -dl $1
usermod -g sshers $1 # Use your own group if you have one, if not remove this line
mkdir -p /home/$1
chown -R $1:$1 /home/$1
sudo -u $1 ssh-keygen -f /home/$1/.ssh/rd_rsa -q -N "" # Specify a passphrase if you need one
mv /home/$1/.ssh/id_rsa.pub /home/$1/.ssh/authorized_keys
@katagaki
katagaki / browser_context.py
Last active August 30, 2025 13:26
Create a not so suspicious looking browser context using Playwright on Python
async def create_browser_context(p: Playwright) -> BrowserContext:
browser_context: BrowserContext = await p.chromium.launch_persistent_context(
user_data_dir=f"./browser_profiles/{str(uuid4())}",
args=[
"--password-store=basic",
"--disable-features=site-per-process",
"--disable-blink-features=AutomationControlled",
"--disable-web-security",
"--disable-audio-output",
"--disable-gpu",