Skip to content

Instantly share code, notes, and snippets.

View hyrious's full-sized avatar
💤
lazy

hyrious hyrious

💤
lazy
View GitHub Profile
@hyrious
hyrious / github-rss.user.js
Last active January 18, 2024 07:17
Turn your github rss into a readable page.
// ==UserScript==
// @name Read on GitHub RSS
// @namespace gh-rss.hyrious.me
// @match https://github.com/*.atom
// @grant none
// @version 1.0
// @author hyrious
// @description Because github new dashboard is terrible.
// ==/UserScript==
(async () => {
@hyrious
hyrious / short-commit.github.user.js
Created January 15, 2024 09:30
Get shorten URL if it has abbrev commit hash
// ==UserScript==
// @name GitHub Shorten Commit URL
// @namespace short-commit.github.com
// @match https://github.com/**/commit/*
// @grant none
// @version 1.0
// @author hyrious
// @description Replace shorter URL if abbrev commit hash exist
// ==/UserScript==
void function() {
@hyrious
hyrious / stroke-test.html
Created January 2, 2024 10:46
hyrious.me/ink
<!DOCTYPE html>
<title>Stroke Test</title>
<style>
* { box-sizing: border-box; }
body { margin: 0; }
.container {
position: absolute;
inset: 50px 100px;
border: 1px solid;
@hyrious
hyrious / SortPackageJson.py
Last active December 14, 2023 04:26
sublime plugin to sort package json on save
import sublime
import sublime_plugin
import json
from collections import OrderedDict
# https://github.com/antfu/eslint-config/blob/main/src/configs/sort.ts
KeyOrder = [
'publisher',
'name',
'displayName',
@hyrious
hyrious / loro-indexeddb.ts
Created November 21, 2023 09:39
persist a loro-crdt doc into indexed db
// This file persists Loro doc to indexeddb
import type { Loro, LoroEvent } from 'loro-crdt'
import { Remitter, ReadonlyRemitter } from 'remitter'
import * as idb from 'lib0/indexeddb'
export interface PersistEventData {
synced: IPersistProvider
}
export interface IPersistProvider {
@hyrious
hyrious / dup.js
Created November 17, 2023 02:02
Find duplicate dependencies in Node.js project
$("dup", async () => {
if (fs.existsSync("pnpm-lock.yaml")) {
const { packages } = yaml.load(fs.readFileSync("pnpm-lock.yaml", "utf8"));
let last = ["", ""];
let seen = new Set();
const log = (s) => seen.has(s) || (seen.add(s), console.log(s));
for (const path in packages) {
const i = path.lastIndexOf("@");
const pkg = path.slice(1, i);
const ver = path.slice(i + 1);
@hyrious
hyrious / github-raw-pdf.user.js
Created November 6, 2023 03:08
Open raw link for PDF files on GitHub.
// ==UserScript==
// @name GitHub PDF Raw Link
// @namespace raw-pdf.github.hyrious.me
// @match https://github.com/*
// @grant none
// @version 1.0
// @author hyrious
// @description Replace PDF file's link with its raw link
// @require https://cdn.jsdelivr.net/npm/selector-set@1.1.5/selector-set.js
// @require https://cdn.jsdelivr.net/npm/selector-observer@2.1.6/dist/index.umd.js
@hyrious
hyrious / mouse-wheel.c
Last active November 2, 2023 09:20
RGSS mouse wheel event through dll
// gcc -shared -Os -s -o a.dll -m32 mouse-wheel.c
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
HHOOK hook;
DWORD delta;
LRESULT CALLBACK LowLevelMouseProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam) {
if (wParam == WM_MOUSEWHEEL) {
MSLLHOOKSTRUCT *mouse = (MSLLHOOKSTRUCT *)lParam;
@hyrious
hyrious / github-rss-star-me.user.js
Last active October 13, 2023 01:41
Who Starred Me - GitHub RSS
// ==UserScript==
// @name Who Starred Me - GitHub RSS
// @namespace star-rss.hyrious.me
// @match https://github.com/*.private.atom
// @grant none
// @version 1.0
// @author hyrious
// @description Because refined github hides them.
// ==/UserScript==
(async () => {
-Wall -Wextra -pedantic -Wimplicit-fallthrough -Wsequence-point -Wswitch-default -Wswitch-unreachable -Wswitch-enum -Wstringop-truncation -Wbool-compare -Wtautological-compare -Wfloat-equal -Wshadow=global -Wpointer-arith -Wpointer-compare -Wcast-align -Wcast-qual -Wconversion -Wwrite-strings -Wdangling-else -Wlogical-op