Skip to content

Instantly share code, notes, and snippets.

@JaHIY
JaHIY / main.groovy
Created April 9, 2024 06:56
bilibili-emote-downloader
import groovy.json.JsonSlurper
def download(URL from, File to) {
if (to.exists()) {
println "Skip `${to.canonicalPath}`";
} else {
to.createParentDirectories();
println "Download `${to.canonicalPath}` from `${from.toString()}`";
to << from.openStream();
}
@JaHIY
JaHIY / PKGBUILD
Last active February 17, 2024 08:03
AUR PKGBUILD for Floorp
# Maintainer: NSK-1010 <kotone[dot]olin1010[at]gmail[dot]com>
# Contributor: Kars Wang <jaklsy[at]gmail[dot]com>
## useful links
# http://floorp.app/
# https://github.com/Floorp-Projects/Floorp
## basic info
pkgname=floorp
pkgver=11.9.0
@JaHIY
JaHIY / PKGBUILD
Last active October 20, 2023 08:18
AUR PKGBUILD for CP2K 2023.2
# Maintainer: Viktor Drobot (aka dviktor) <linux776 [at] gmail [dot] com>
# Maintainer: Anton Kudelin <kudelin [at] protonmail [dot] com>
# Contributor: Kars Wang <jaklsy [at] gmail [dot] com>
pkgname=cp2k
pkgver=2023.2
_dbcsrver=2.6.0
pkgrel=1
# NVIDIA GPU Generation: Kepler, Pascal, or Volta;
# please specify one closest to yours or leave unchanged
@JaHIY
JaHIY / case_data_index.py
Last active July 6, 2022 07:47
format quote in case_data_index.json
import json
import re
from functools import reduce
PATTERNS = [
'^(.*"BRIEF_CASE":")(.*)(","CASE_TYPE":.*)$',
'^(.*"CASE_ADDRESS":")(.*)("},"ADDR_TYPE":.*)$',
'^(.*"case_?[Aa]ddress":")(.*)(","table_?[Ss]ource":.*)$',
'^(.*"caseAddress":")(.*)(","locationJson":.*)$',
'^(.*"CASE_NAME":")(.*)(","CASE_NUMBER":.*)$',
@JaHIY
JaHIY / bilibili_emoji_downloader.rb
Last active May 30, 2022 16:30
bilibili emoji downloader
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'net/http'
$download_dir = 'bilibili_emojis'
$cookie = 'SESSDATA=PUT_YOUR_SESSDATA_HERE'
def download(url, filename)
@JaHIY
JaHIY / scape_goat_tree.cpp
Created May 7, 2022 10:04
Yet another C++ implementation of ScapeGoat Tree
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <utility>
using std::make_pair;
using std::pair;
#include <functional>
@JaHIY
JaHIY / decode_m_notation.cpp
Created April 22, 2022 05:27
decode M notation from cat -v
#include <iostream>
using std::cin;
using std::cout;
using std::getline;
using std::endl;
#include <string>
using std::string;
#include <string_view>
@JaHIY
JaHIY / rime2fcitx.awk
Last active April 7, 2022 06:11
convert rime dict format to fcitx dict format
#!/usr/bin/awk -f
# Requirement:
# - pypinyin
# - sed
# How to use
# $ ./rime2fcitx.awk '/usr/share/rime-data/opencc/emoji_category.txt' > emoji_category_fcitx.txt
BEGIN {
@JaHIY
JaHIY / emoji_category_fcitx.txt
Created April 4, 2022 13:45
emoji dict files for fcitx pinyin ( from https://github.com/rime/rime-emoji )
👳🏽 a'la'bo'ren 0.9
🧔🏽 a'la'bo'ren'nan 0.9
👳🏽‍♂️ a'la'bo'ren'nan 0.9
🧕🏽 a'la'bo'ren'nv 0.9
👳🏽‍♀️ a'la'bo'ren'nv 0.9
🧓🏼 bai'ren 0.9
🧑🏼 bai'ren 0.9
🧒🏼 bai'ren 0.9
👱🏼 bai'ren 0.9
👶🏼 bai'ren 0.9