Skip to content

Instantly share code, notes, and snippets.

View sawaYch's full-sized avatar
🐧
Focusing

Sawa sawaYch

🐧
Focusing
View GitHub Profile
@sawaYch
sawaYch / kubectl-logs
Created August 12, 2025 10:11
kubectl log to my aws k8s cluster (kubectl get pods, logs)
#!/bin/bash
# Script to find and follow logs of pods based on pattern matching
# Usage: ./kubectl-logs <part1> <part2> [part3] ...
# Example: ./kubectl-logs shl staging
# This will find pods matching: sieservice-shl-*-staging-*
NAMESPACE="sieservice"
# Check if at least one argument is provided
@sawaYch
sawaYch / rn-sentry-upload-sorucemap.sh
Created April 25, 2025 00:00
upload react native ios & android source map (Hermes) to sentry.io manually
#!/bin/bash
#
# generate sourcemap
#
# (android)
echo "🚀 Generating sourcemap for android..."
npx react-native bundle \
--dev false \
--minify false \
@sawaYch
sawaYch / dump-secret.sh
Created February 5, 2025 18:49
Shell script for retrieve k8s secret (.json, .pem, .env)
#!/bin/bash
# Exit on any error
set -e
# Check if kubectl is available
if ! command -v kubectl >/dev/null 2>&1; then
echo "Error: kubectl is not installed or not in PATH"
exit 1
fi
@sawaYch
sawaYch / gist:e724f6ea17efa4ac827fda861e2031e8
Created August 20, 2024 18:58
windows unzip simplified chinese .zip file
# Install WSL Ubuntu
# Using unzip tools
unzip -O GB18030 your_archive.zip -d target_dir
@sawaYch
sawaYch / timestamp_marker.js
Last active September 12, 2024 12:52
YouTube timestamp marker (via developer console)
// credit: https://www.reddit.com/r/VirtualYoutubers/comments/ifzqe7/i_made_a_live_timestamp_tool/
(function () {
if (!document.querySelector("#ytls-pane")) {
var pane = document.createElement("div");
var exit = document.createElement("span");
var list = document.createElement("ul");
var nowli = document.createElement("li");
var nowa = document.createElement("a");
var nowid;
var nowtext = document.createElement("input");
@sawaYch
sawaYch / chall.py
Created December 6, 2023 15:12
hkcert23 ctf sign me a flag
import signal
import os
import hmac
import hashlib
import sys
def tle_handler(*args):
print('⏰')
sys.exit(0)
@sawaYch
sawaYch / b141.py
Created December 5, 2023 12:09
B141:【異世界コラボ問題】ガーベラ・コレクション
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
def min_adjacent_swap(arr):
swap_times = 0
n = len(arr) / 2
iter = 0
while iter < len(arr) - 1:
# if current not ideal
if arr[iter] != iter % n:
@sawaYch
sawaYch / convert.js
Last active September 6, 2023 00:37
batch convert webp to webm, maybe useful for converting Whatsapp sticker to Telegram.
/**
require webp & libwebp, see https://developers.google.com/speed/webp/download
run:
cd working_dir # suppose working dir contains all webp that u want to convert
node ./convert.js # wait for it until done
*/
const child = require("child_process");
const fs = require("fs");
const path = require("path");
const util = require("util");
@sawaYch
sawaYch / example.ts
Created June 2, 2023 13:18
override yup date() default typeError validation message
// https://github.com/jquense/yup/issues/394
import i18next from "i18next";
import { setLocale } from "yup";
export const setFormikLocale = (i18n: typeof i18next): void => {
// Config yup validation schema default error message
setLocale({
mixed: {
notType: (_ref) => {
@sawaYch
sawaYch / mp4-to-gif.md
Created March 7, 2023 05:54
MP4 to gif
ffmpeg -i ./input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v pam \
    -f image2pipe - | \
    convert -delay 10 - -loop 0 -layers optimize output.gif