Skip to content

Instantly share code, notes, and snippets.

View luoling8192's full-sized avatar
:octocat:
Focusing

RainbowBird luoling8192

:octocat:
Focusing
View GitHub Profile
@luoling8192
luoling8192 / waitForKeyElements.js
Created November 30, 2025 16:23 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@luoling8192
luoling8192 / open-in-sourcegraph.js
Last active November 30, 2025 16:28
Open in SourceGraph
// ==UserScript==
// @name SourceGraph
// @description SourceGraph button injection on Github
// @namespace https://gist.github.com/luoling8192/0312f993ce1f59075841b26f3a07d15b
// @version 0.4
// @author mokeyish, RainbowBird
// @match https://github.com/*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.githubusercontent.com/luoling8192/007ef269a2c4baa4edd47d175ed8295e/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
@luoling8192
luoling8192 / prompt.md
Created August 14, 2025 18:11
Cursor Prompt

Role

You are linus torvalds, the creator of linux kernel. You are a senior software engineer, and you are the best in the world at software engineering.

Principles

  • Before writing the code, ask first, and write after I agree.

  • Step by step thinking, in depth: Always think deeply and step-by-step before responding.

@luoling8192
luoling8192 / reposize.js
Last active August 10, 2025 13:35
GitHub Repo Size Display
// ==UserScript==
// @name GitHub Repo Size Display
// @namespace http://tampermonkey.net/
// @version 0.1
// @license MIT
// @description Display repository size on GitHub repository pages
// @author RainbowBird
// @match https://github.com/*
// @grant GM_xmlhttpRequest
// @connect api.github.com
@luoling8192
luoling8192 / json.spec.ts
Created July 30, 2025 19:00
JSON Parser
import { describe, expect, it } from 'vitest'
function jsonParse(json: string) {
let currentIndex = 0
function token() {
return json[currentIndex]
}
function nextToken() {
@luoling8192
luoling8192 / monad.spec.ts
Created May 8, 2025 10:39
Telegram Search Monad
import { describe, expect, it } from 'vitest'
import { Err, Ok } from './monad'
describe('utils/monad', () => {
it('works in sync', () => {
function testOk() {
return Ok(1)
}
@luoling8192
luoling8192 / task.ts
Created May 8, 2025 10:38
Telegram Search Microtask
import type { TakeoutTaskMetadata } from '../services/takeout'
import { useLogger } from '@tg-search/common'
import defu from 'defu'
type CoreTaskType = 'takeout' | 'getMessage' | 'embed'
interface CoreTasks {
takeout: TakeoutTaskMetadata
getMessage: undefined
#!/bin/bash
account=$1
data=$(curl -s https://api.github.com/users/$account)
id=$(echo $data | jq .id)
name=$(echo $data | jq --raw-output '.name // .login')
printf "Co-authored-by: %s <%d+%[email protected]>\n" "$name" $id $account
@luoling8192
luoling8192 / issue.js
Last active March 16, 2025 12:06
Github Issue Quick Edit
// ==UserScript==
// @name GitHub Issue 快速编辑器
// @namespace https://github.com/
// @version 0.2.2
// @description 通过点击 GitHub Issue 标题栏快速进入编辑模式
// @author RainbowBird
// @match https://github.com/*/*/issues/*
// @match https://github.com/*/*/issues
// @grant none
// @run-at document-end
@luoling8192
luoling8192 / setup.sh
Last active November 26, 2024 11:54
Ubuntu Setup Script
#!/bin/bash
# Define colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Define package groups
MIRROR="https://mirrors.tuna.tsinghua.edu.cn/ubuntu"