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
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
@yume-chan
yume-chan / emoji.js
Last active December 23, 2015 23:39
゚ω゚ノ= /‘m´)ノ ~┻━┻ //*´∇‘*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^