Skip to content

Instantly share code, notes, and snippets.

View JLChnToZ's full-sized avatar

Jeremy Lam aka. Vistanz JLChnToZ

View GitHub Profile
@JLChnToZ
JLChnToZ / global.d.ts
Last active June 6, 2018 11:57
Demo for workaround on writing tsx file without React but with Hyperscript.
declare module '__globals' {
type DomElement = Element;
type DeepPartial<T> = {
[K in keyof T]?: T[K] | DeepPartial<T[K]>;
};
type FreePartialProperties<T> = {
[K in keyof T]: DeepPartial<T[K]> & {
[key: string]: any;
};
};
@JLChnToZ
JLChnToZ / _readme.md
Last active January 5, 2026 02:03
Simple bookmarklet that captures any webpage and save as png image using HTML5 technologies

Webpage Snapshot Bookmarklet

This is a simple bookmarklet that captures any webpage and save as png image using HTML5 technologies. Under the hood it uses HTML2Canvas to capture the webpage to canvas, then we convert the content inside this canvas element to image file.

You may copy the text below and save as bookmark. `javascript:!function()%7Bfunction%20e()%7Bthis&&this.parentNode&&this.parentNode.removeChild(this),html2canvas(document.body).then(function(e)%7Breturn%20new%20Promise(function(t)%7Be.toBlob(t)%7D)%7D).then(function(e)%7Bvar%20t=document.createElement(%22a%22);return%20t.href=URL.createObjectURL(e),t.download=document.title.replace(/%5B/%5C%7C%5C%5C%60~!@#%5C$%25%5C%5E&%5C*%5C+%5C-='%22%5C,%5C.:;%5D+/g,%22%22)+%22_%22+(new%20Date).getTime()+%22.png%22,t.click(),new%20Promise(function(e)%7BsetTimeout(10,e,t)%7D)%7D).then(function(e)%7B0===e.href.indexOf(%22blob:%22)&&(URL.revokeObjectURL(e.href),e.href=%22###%22)%7D).catch(function(e)%7Bconsole.error(e)

@JLChnToZ
JLChnToZ / SelectionHistory.cs
Last active August 27, 2018 16:19
Selection History for Unity Editor
using UnityEditor;
using System.Collections.Generic;
public static class SelectionHistory {
private const string PREV_SELECTED_MENU = "Edit/Previous Selection %&LEFT";
private const string NEXT_SELECTED_MENU = "Edit/Next Selection %&RIGHT";
private const int SELECTION_HISTORY_MENU_PRIORITY = 200;
private const int MAX_HISTORY_COUNT = 10;
private static readonly LinkedList<int[]> prevSelected = new LinkedList<int[]>();
import { createSocket, Socket } from 'dgram';
import { isIP } from 'net';
import { createServer } from 'http';
import { URL } from 'url';
import { lookup as dnsLookup } from 'dns';
import { unescape as unescapeQuery } from 'querystring';
import { promisify } from 'util';
const macAddressFormat = /[^0-9A-F]/g;
@JLChnToZ
JLChnToZ / PersistentCallFinder.cs
Last active November 8, 2018 12:23
A simple editor tool that writes all persistent calls into a stub file
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using UnityObject = UnityEngine.Object;
if(!window.dndtabs)
(function(containerQuery, childrenQuery) {
let dragging;
const container = document.querySelector(containerQuery);
container.addEventListener('dragstart', e => {
if(!e.target.matches(childrenQuery)) return;
const { dataTransfer, target } = e;
dataTransfer.clearData();
dataTransfer.setData('application/x-tab-data', target.outerHTML);
@JLChnToZ
JLChnToZ / _mishiro-version-code.txt
Last active December 26, 2018 17:15
If 346 characters are used as development code names of some software, this might be the best ordering
v1.0 ANZU (双葉杏)
v2.0 CATHY (キャシー・グラハム)
v3.0 DOMYOJI (道明寺歌鈴)
v4.0 ETOU (衛藤美紗希)
v5.0 FUMIKA (鷺沢文香)
v6.0 HAJIME (藤原肇)
v7.0 IBUKI (小松伊吹)
v8.0 JOUMU (美城常務)
v9.0 KAEDE (高垣楓)
v10.0 LAYLA (ライラ)
var c=String.fromCharCode,s='var c=String.fromCharCode,s=#%#;console.log(s.replace(new RegExp(c(35),c(103)),c(39)).replace(c(37),s))';console.log(s.replace(new RegExp(c(35),c(103)),c(39)).replace(c(37),s))
@JLChnToZ
JLChnToZ / bsod.ps1
Last active December 7, 2019 09:47
Simple PowerShell script that gives you BSOD
$winId = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$winPrincipal = New-Object System.Security.Principal.WindowsPrincipal($winId)
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
If (-Not $winPrincipal.IsInRole($adminRole)) {
$cmdArgs = '-File', $MyInvocation.MyCommand.Path, '-ExecutionPolicy', 'Bypass'
Start-Process 'PowerShell' $cmdArgs -Verb RunAs
Exit
}
$memberDef = @'
[DllImport("ntdll.dll", SetLastError = true)]

How to play ASCII-Art Star Wars offline

Following will teach you how to play the "easter-egg" (which actually isn't, but many people describe this as an easter egg) of ASCII-Art Star Wars (or Star Wars in terminal/telnet, whatever), the one you normally starts like this:

$ telnet towel.blinkenlights.nl
  1. Before you start, ensure Node.js is installed.
  2. Navigate to www.asciimation.co.nz, the original home of that ASCII-Art Star Wars.
  3. Press F12 to open developer tools.