Skip to content

Instantly share code, notes, and snippets.


Wang Weihua aztack

View GitHub Profile
aztack /
Created April 14, 2023 01:48 — forked from jschoormans/
generate 3D panorama views with stable diffusion
# %%
import replicate
model = replicate.models.get("prompthero/openjourney")
version = model.versions.get("9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb")
PROMPT = "mdjrny-v4 style 360 degree equirectangular panorama photograph, Alps, giant mountains, meadows, rivers, rolling hills, trending on artstation, cinematic composition, beautiful lighting, hyper detailed, 8 k, photo, photography"
output = version.predict(prompt=PROMPT, width=1024, height=512)
# %%
# download the iamge from the url at output[0]
import requests
View gist:c447a0236ed00c68a70257f06971b6b5
import { useRef, useState } from "react";
export interface InputMethodProps {
value: string;
onChange(value: string): void;
* This hook handles composition events to prevent onChange
* from being called while the user is typing Chinese pinyin.
* And it will call onChange when the user finishes typing pinyin.
View gist:056c76f4c960476cfd4feba194048928
import https from 'https';
function fetch(hostname: string, search: string) {
const options = {
port: 443,
path: search,
method: 'GET',
aztack / captureSequences.ts
Created November 29, 2022 00:57
View captureSequences.ts
import JSZip from "jszip"; //
export function captureSequences(canvas: HTMLCanvasElement, filename: string, onCapture: (frame: number) => string) {
let frame = 0;
var zip = new JSZip();
const capture = () => {
const uri = canvas.toDataURL('png', 1);
var idx = uri.indexOf('base64,') + 'base64,'.length;
var content = uri.substring(idx);
const frameName = onCapture(frame++);
aztack / recordCanvasStream.ts
Created November 18, 2022 06:38
View recordCanvasStream.ts
* Record canvas stream into a webm file
* @param canvas HTMLCanvasElement
* @param options {duration: number, fps: number}
* @returns Promise<Blob> | ((discard:boolean) => Promise<Blob|null>)
* @example
* // Stop after 5 seconds
* const blob = await recordCanvasStream(canvas, { duration: 5, fps: 30 });
* downloadBlob(blob, 'recording.webm');
aztack /
Created October 12, 2022 14:37 — forked from tuansoibk/
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising


It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

aztack /
Created August 30, 2022 02:28 — forked from Victrid/
Find which commit your no-git friend is working on and generate patches for attaching their works onto git tree.
hash git 2>/dev/null || { echo >&2 "Required command 'git' is not installed. ( hmm... why are you using this? ) Aborting."; exit 1; }
hash realpath 2>/dev/null || { echo >&2 "Required command 'realpath' is not installed. Aborting."; exit 1; }
hash pwd 2>/dev/null || { echo >&2 "Required command 'pwd' is not installed. Aborting."; exit 1; }
hash cd 2>/dev/null || { echo >&2 "Required command 'cd' is not installed. Aborting."; exit 1; }
hash echo 2>/dev/null || { echo >&2 "Required command 'echo' is not installed. Aborting."; exit 1; }
hash mv 2>/dev/null || { echo >&2 "Required command 'mv' is not installed. Aborting."; exit 1; }
hash diff 2>/dev/null || { echo >&2 "Required command 'diff' is not installed. Aborting."; exit 1; }
hash diffstat 2>/dev/null || { echo >&2 "Required command 'diffstat' is not installed. Aborting."; exit 1; }
aztack / export-comp-from-after-effect.jsx
Last active August 4, 2022 13:49
View export-comp-from-after-effect.jsx
Copyright (c) 2020 adroitwhiz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
aztack / index.ts
Last active August 1, 2022 02:05
Express.js Download Streamed Zip
View index.ts
import express from 'express';
import archiver from 'archiver';
express().use('/download-assets', async (req, res) => {
res.set('Content-Type', 'application/octet-stream');
res.set('Transfer-Encoding', 'chunked');
console.log(`Archiving project assets...`);
const zipfile = archiver('zip');
aztack / index.ts
Created July 16, 2022 11:55 — forked from Bnaya/index.ts
Typescript Types indirect re-export with isolatedModules: true
View index.ts
// Cannot re-export a type when the '--isolatedModules' flag is provided.ts(1205)
export { IMyInterface } from "./types"
// this works!
import { IMyInterface as IMyInterfaceForExport } from "./types"
export type IMyInterface = IMyInterfaceForExport;
// And Also:
export type IMyInterface2 = import("./types").IMyInterface;