Skip to content

Instantly share code, notes, and snippets.

View YieldRay's full-sized avatar

YieldRay YieldRay

View GitHub Profile
const deasync = require("deasync");
module.exports = function importSync(moduleName, options) {
let ok;
let result;
import(moduleName, options)
.then((mod) => {
ok = true;
result = mod;
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import generate from "@babel/generator";
import * as t from "@babel/types";
function isBareSpecifier(specifier: string) {
// check if is relative or absolute path
if (specifier.match(/^\.*\//)) return false;
try {
import { brotliDecompress } from "node:zlib";
import { promisify } from "node:util";
const baseURL = "https://www2.deepl.com";
const brotliDecompressAsync = promisify(brotliDecompress);
class JSONRPCRequest {
public readonly jsonrpc = "2.0" as const;
public readonly method: string;
public readonly params: object;
#!/usr/bin/env bash
# 使用errexit, nounset, pipefail选项,启用nullglob扩展
set -o errexit -o nounset -o pipefail
shopt -s nullglob
# 设置btrfs路径和cgroup
btrfs_path='/var/bocker' && cgroups='cpu,cpuacct,memory'
# 解析命令行参数,将`--key=value`转换为`BOCKER_key=value`,`--key`转换为`BOCKER_key=x`
[[ $# -gt 0 ]] && while [ "${1:0:2}" == '--' ]; do
OPTION=${1:2}
[[ $OPTION =~ = ]] && declare "BOCKER_${OPTION/=*/}=${OPTION/*=/}" || declare "BOCKER_${OPTION}=x"
@YieldRay
YieldRay / index.html
Created June 5, 2024 08:24
ace-example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Simple ACE Example</title>
<style type="text/css" media="screen">
body {
margin: 0;
height: 100vh;
display: grid;
grid-template-rows: auto 1fr;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tesseract</title>
<style>
@import url(https://jsd.cdn.zzko.cn/npm/landsoul);
body {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="preload"
as="style"
href="https://registry.npmmirror.com/github-markdown-css/latest/files"
/>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<h1>Render image as &lt;div&gt;<small>s</small></h1>
<input type="file" accept="image/*" />
<br />