Skip to content

Instantly share code, notes, and snippets.

View hyrious's full-sized avatar
💤
lazy

hyrious hyrious

💤
lazy
View GitHub Profile
@hyrious
hyrious / goto-npm-browser.user.js
Created August 10, 2023 09:30
Replace npm code tab with NPM Browser
// ==UserScript==
// @name Read the code in NPM Browser
// @namespace goto-npm-browser.hyrious.me
// @match https://www.npmjs.com/package/*
// @grant none
// @version 1.0
// @author hyrious
// @description Change the Code tab to goto https://hyrious.me/npm-browser
// ==/UserScript==
void function() {
@hyrious
hyrious / gh-pr-cm.sh
Last active August 8, 2023 05:20
Get current commit's PR url (to that commit)
echo "$(gh pr view --json url -q .url)/commits/$(git rev-parse --short HEAD)"
@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);