Skip to content

Instantly share code, notes, and snippets.

View seia-soto's full-sized avatar
💭
Often in flight

HoJeong Go seia-soto

💭
Often in flight
View GitHub Profile
@seia-soto
seia-soto / scrap.js
Last active May 20, 2022 12:16
Adcrap content scrapper for lay users. (20220520-1)
(() => {
try {
const el = document.querySelector('p[id][style="display: none;"]')
const inline = (' ' + el.innerHTML).slice(1)
const content = decodeURIComponent(escape((window.atob(inline))))
console.log(content)
navigator.clipboard.writeText(content)
} catch (error) {
console.error(error)
@seia-soto
seia-soto / arm64e-linux.sh
Created July 5, 2020 11:21
Installs sbinger's arm64e toolchain to allow arm64e compilation on Linux
curl -LO https://github.com/sbingner/llvm-project/releases/download/v10.0.0-1/linux-ios-arm64e-clang-toolchain.tar.lzma
TMP=$(mktemp -d)
tar --lzma -xvf linux-ios-arm64e-clang-toolchain.tar.lzma -C $TMP
pushd $TMP/ios-arm64e-clang-toolchain/bin
find * ! -name clang-10 -and ! -name ldid -and ! -name ld64 -exec mv {} arm64-apple-darwin14-{} \;
find * -xtype l -exec sh -c "readlink {} | xargs -I{LINK} ln -f -s arm64-apple-darwin14-{LINK} {}" \;
popd
mkdir -p $THEOS/toolchain/linux/iphone
mv $TMP/ios-arm64e-clang-toolchain/* $THEOS/toolchain/linux/iphone/
rm -rf $TMP linux-ios-arm64e-clang-toolchain.tar.lzma
@seia-soto
seia-soto / openssl.sh
Last active October 16, 2022 13:55
Install openssl from source instead of brew due to lack of ed25519
# https://www.openssl.org/source/
perl ./Configure --prefix=/usr/local --openssldir=/usr/local/openssl no-ssl3 no-ssl3-method no-zlib no-comp
make
make test
# https://serverfault.com/questions/391834/where-are-os-x-man-pages-stored
sudo make install MANDIR=/usr/local/share/man MANSUFFIX=ssl
make clean
@seia-soto
seia-soto / inspect.js
Last active December 4, 2022 05:15
Inspector
// ==UserScript==
// @name New script
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant unsafeWindow
// @version 1.0
// @author -
// @description 12/2/2022, 12:42:04 PM
// ==/UserScript==
@seia-soto
seia-soto / hook.sh
Last active February 15, 2023 16:20
dehydrated hook to integrate with nginx via http-01
#!/usr/bin/env bash
reload_nginx() {
echo "reload nginx"
service nginx reload
}
create_autoconfig() {
local DOMAIN="${1}"
neovim libssl-dev build-essential cmake clang git curl wget unzip tar triehash
@seia-soto
seia-soto / fastify.d.ts
Last active April 26, 2023 07:37
Fastify WebSocket (with Early-termination of WebSocket before upgrade in process of request handler)
// (typeRoot) types/fastify.d.ts
/* eslint-disable @typescript-eslint/consistent-type-definitions */
import 'fastify';
import {type WebSocketServer} from 'ws';
import {type WebSocketWithConnection} from '../src/modules/ws.js';
declare module 'fastify' {
interface FastifyInstance {
wss: WebSocketServer;
}
import {type Static, type TSchema} from '@sinclair/typebox';
import {TypeCompiler} from '@sinclair/typebox/compiler';
import {rename, writeFile} from 'fs/promises';
import path from 'path';
import {isFile, readFileSafe} from '../fs/safe.js';
import {debounce} from '../utils/debounce.js';
export class ConfigProvider<T extends TSchema> {
absFilename: string;
local: Static<T>;
@seia-soto
seia-soto / async-defer-module.ko.md
Last active May 23, 2023 13:55 — forked from jakub-g/async-defer-module.md
[번역] 비동기 스크립트, 지연 스크립트, 그리고 모듈 스크립트: 설명과 비교 그리고 결론

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

ES modules의 추가와 함께 이제 JS 코드를 로드하기 위한 24가지 이상의 방법이 생겼습니다: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- 그리고 이들은 미묘하게 다릅니다.

이 문서에서는 속성 값들에 따라 HTML의 <script> 태그가 처리되는 여러가지 방법을 비교했습니다.

만약 <script async type="module"> 혹은 <script nomodule defer src="...">을 언제 써야 할지 궁금해하셨다면 잘 오셨습니다!

Note 이 문서는 <script> 태그들이 HTML에 추가되었을 때를 다룹니다; 런타임에 추가되는 <script> 태그들의 동작은 사뭇 다르니 Jake Archibald (2013)님의 Deep dive into the murky waters of script loading를 참고해주세요.

@seia-soto
seia-soto / lxd.d.ts
Created May 31, 2023 23:20
TypeScript definition set for LXD API (Server and Instance)
export type LxdInstanceArchitectureType = 'x86_64' | 'arm64';
export type LxdInstanceType = 'container' | 'virtual-machine';
export type LxdInstanceEntity = {
id: string;
project: string;
};
export type LxdInstanceCpuUsage = {