Skip to content

Instantly share code, notes, and snippets.

View YukariChiba's full-sized avatar
🐑
Working

Yukari Chiba YukariChiba

🐑
Working
View GitHub Profile
#!/bin/bash
mkdir -p cache data
function process_file() {
file=cache/$1
dstfile=data/${1%.*}.json
generated=$(date "+%s")
sort $file | grep -v '^$' | uniq | jq -R 'if contains(":") then {prefix:.,asn:"0",maxLength:128} else {prefix:.,asn:"0",maxLength:32} end' | jq -sr "{meta:{generated:$generated},roas:.}" > $dstfile
}
@YukariChiba
YukariChiba / export.sh
Last active October 23, 2025 03:21
netease-cloud-music-gtk export downloaded musics script
#!/bin/bash
function checkcmd() {
cmdpkg=$1
[ -z "$2" ] || cmdpkg="$1 (in $2)"
command -v $1 > /dev/null || { echo "error: $cmdpkg is required"; exit 1; }
}
checkcmd jq
checkcmd file
@YukariChiba
YukariChiba / create-img.sh
Last active September 24, 2025 03:35
Create persistent deepin iso
#!/bin/bash
# for deepin 25.0.1 / deepin 23.1
LANG=C sed -i '0,/console=tty splash/s//persistence splash/' $1
truncate -s +8G $1
fdisk $1 <<<$'n\n\n\n\n\nw'
LIVEDEV=$(sudo losetup -f -P --show $1)
@YukariChiba
YukariChiba / ddns.py
Created April 2, 2025 08:51
ddns server
#!/usr/bin/env python3
import argparse
import datetime
import sys
import time
import threading
import traceback
import socketserver
import struct
#!/bin/bash
IMAGE_SEARCH=$(find ./Downloads/deepin-23-beige-preview-riscv64-*.iso | sort | tail -n1)
IMAGE=${1:-$IMAGE_SEARCH}
VCPU=16
VRAM=16G
if [ ! -f ./test-disk.img ]; then
@YukariChiba
YukariChiba / check.sh
Last active April 27, 2023 18:48
eweOS Update Checker
#!/bin/bash
AUTHOR="eweOS Auto Package Update <[email protected]>"
GH_TOKEN="GITHUB_TOKEN"
PKG_NAME=$1
if [ -z "$PKG_NAME" ]; then
echo "Error: no package name provided."
exit 0
fi
[DEFAULT]
downstream = pacman
[acl]
url = https://download.savannah.gnu.org/releases/acl/
[aria2]
url = https://github.com/aria2/aria2/tags
regex_name = release
@YukariChiba
YukariChiba / adb-disable.sh
Created December 28, 2022 11:12
Script to disable bloat apps in Xperia XZ2C
#!/bin/bash
# docomo apps
adb shell pm list packages | grep docom | cut -f 2 -d ':' | xargs -I @ adb shell pm disable-user --user 0 @
# swiftkey IME
adb shell pm list packages | grep swiftkey | cut -f 2 -d ':' | xargs -I @ adb shell pm disable-user --user 0 @
# docomo contacts app
adb shell pm disable-user --user 0 com.android.contacts
#!/bin/bash
NODES=(
"APR1.HK"
"LON1.UK"
"LAX1.US"
"LAS1.US"
"VUL1.SG"
"NYC1.US"
"TYO1.JP"
"LL1.NL"
@YukariChiba
YukariChiba / login.py
Created September 13, 2022 06:04
UESTC QSH Login Script
#!/usr/bin/python3
import requests
import json
import hmac
import hashlib
import base64
import math
import sys