Skip to content

Instantly share code, notes, and snippets.

View yume-chan's full-sized avatar
⌨️
Generating bugs...

Simon Chan yume-chan

⌨️
Generating bugs...
View GitHub Profile
@yume-chan
yume-chan / Cargo.toml
Last active October 17, 2024 18:29
Rust code to add shortcut with App User Model ID
[target.'cfg(target_os = "windows")'.dependencies.windows]
version = "0.58"
features = [
"Foundation",
"Media",
"Win32_Foundation",
"Win32_Storage_EnhancedStorage",
"Win32_System_LibraryLoader",
"Win32_System_Com",
"Win32_System_Com_StructuredStorage",
import { ReadableStream, WritableStream } from 'stream/web';
async function measure(name, func) {
for (let i = 0; i < 5; i++) {
const start = Date.now();
await func();
console.log(`${name}: ${Date.now() - start}ms`);
}
}
<canvas id="canvas"></canvas>
<script>
(async () => {
const response = await fetch('./0000.bmp');
const arraybuffer = await response.arrayBuffer();
const dataview = new DataView(arraybuffer);
const offset = dataview.getUint32(10, true);
const width = dataview.getUint32(18, true);
let height = dataview.getInt32(22, true);
@yume-chan
yume-chan / client.js
Last active February 4, 2024 05:48
reverse tunnel
const net = require("net");
const http = require("http");
const https = require("https");
const http2 = require("http2");
const req = https.request({
method: "CONNECT",
host: "server",
port: 443,
path: "magic.string"
#include <functional>
#include <iostream>
template <class F>
struct wrapper {
wrapper(F&& f)
: f(std::forward<F>(f)) { }
std::decay_t<F> f;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
Promise.delay = function (time) {
return new Promise(function (resolve) {
public class NlsEncoding : Encoding
{
public struct Range
{
public readonly byte Start;
public readonly byte End;
public Range(byte start, byte end)
{
Start = start;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.Text;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Collections.Generic;
using Windows.Foundation;
using Windows.Graphics.Display;
// ==UserScript==
// @id downloadEnhancer
// @name Download Dialog Enhancer
// @version 1.6.8
// @namespace simon
// @author Simon Chan
// @description Add copying link, saving as, encoding conversion and renaming functions to download dialog.
// @include chrome://browser/content/browser.xul
// @include chrome://mozapps/content/downloads/unknownContentType.xul
// @run-at document-end
// ==UserScript==
// @id tiebaRecentImages
// @name Tieba Recent Images
// @version 1.0
// @namespace simon
// @author Simon Chan
// @description Show recent used images when hover on Emoji button.
// @include http://tieba.baidu.com/*
// @run-at document-end
// @grant GM_getValue