Skip to content

Instantly share code, notes, and snippets.

View hyrious's full-sized avatar
💤
lazy

hyrious hyrious

💤
lazy
View GitHub Profile
@hyrious
hyrious / changelog.mjs
Created July 22, 2023 01:44
Get changelog of an NPM package.
// Get changelog of a package on GitHub.
import cp from "child_process";
var name = process.argv[2];
// https://github.com/dword-design/package-name-regex
var re = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
if (!(typeof name == "string" && re.test(name))) {
console.log("usage: node changelog.mjs <package name>");
process.exit(1);
}
@hyrious
hyrious / age.user.css
Created July 21, 2023 01:45
age styles
/* ==UserStyle==
@name AGE.TV 微调
@namespace tune.age.tv
@version 1.0.0
@description 我不喜欢,改回去
@author EE
==/UserStyle== */
@-moz-document domain("www.agemys.org") {
header.sticky-top {
position: static;
@hyrious
hyrious / redirect-slack.user.js
Created July 17, 2023 10:03
Slack Auto Redirect
// ==UserScript==
// @name Slack Auto Redirect
// @namespace redirect.slack.com
// @match https://*.slack.com/*
// @grant none
// @version 1.0
// @author hyrious
// @description Fuck.
// ==/UserScript==
(function() {
@hyrious
hyrious / case-police.user.js
Last active June 26, 2023 05:47
Automatically correct cases in input and textarea on any site
// ==UserScript==
// @name CasePolice
// @namespace case-police.hyrious.me
// @include *
// @grant GM_xmlhttpRequest
// @version 1.0
// @author hyrious
// @description Automatically correct your cases in <input> and <textarea>
// ==/UserScript==
void async function() {
@hyrious
hyrious / dark-github-blog.user.js
Created June 22, 2023 09:01
github.blog dark mode
// ==UserScript==
// @name github.blog dark mode
// @namespace github.blog/dark
// @match https://github.blog/*
// @grant none
// @version 1.0
// @author hyrious
// @description _(:3」∠)_
// ==/UserScript==
void function() {
@hyrious
hyrious / bilibili-windowed.user.js
Last active June 22, 2023 00:24
bilibili windowed player
// ==UserScript==
// @name 视频独立窗口(含弹幕)
// @namespace bili-video-window-hyrious.me
// @match https://www.bilibili.com/video/*
// @grant none
// @version 1.1
// @author hyrious
// @description 通过快捷键打开一个小窗口,可以独立显示视频
// ==/UserScript==
;(() => {
@hyrious
hyrious / config.nu
Last active June 30, 2023 05:08
nushell git aliases i often use
# https://github.com/ohmyzsh/ohmyzsh/blob/-/plugins/git/git.plugin.zsh
def git_current_branch [] {
git symbolic-ref --quiet HEAD | str replace 'refs/heads/' '' | str trim
}
alias gl = git pull
alias gfa = git fetch --all --prune
alias gsw = git switch
alias gswc = git switch --create
@hyrious
hyrious / manga.mjs
Last active June 11, 2023 05:32
poor man's manga reader
import fs_ from "fs";
import http from "http";
const fs = fs_.promises;
let manga = [];
function handler(req, res) {
const url = new URL(req.url, "http://" + req.headers.host);
@hyrious
hyrious / when_did_i_star.rb
Last active June 10, 2023 20:15
When did I star that repo?
# "when did i star {REPO}?"
# 1. Make sure you have installed `gh` and have `gh auth login`, so that I don't ask you for the token
# 2. Fetch https://docs.github.com/en/rest/activity/starring for all starred history
# 3. Run 2 until we found the repo
unless repo = ARGV[0]
puts "usage: ruby #$0 <repo>"
exit 0
end
import { build } from "esbuild";
import { readFileSync } from "fs";
build({
entryPoints: ["main.js"],
bundle: true,
platform: "node",
format: "esm",
outfile: "bundle.js",
plugins: [