Skip to content

Instantly share code, notes, and snippets.

View yeefun's full-sized avatar
🎯
Focusing

Yeefun Lin yeefun

🎯
Focusing
View GitHub Profile
useEffect(() => {
rendererPort?.addEventListener('message', handleDefaultContextMenu);
function handleDefaultContextMenu(event: MessageEvent) {
const { type, params } = event.data;
if (type === 'contextMenu') {
const {
x,
y,
dictionarySuggestions,
misspelledWord,
@yeefun
yeefun / tcp-client.py
Created May 15, 2021 09:05
Computer Networking: a Top Down Approach, 8th Edition--Socket Programming: Creating Network Applications
from socket import *
serverName = '192.168.43.6'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
sentence = input('Input lowercase sentence: ')
clientSocket.send(sentence.encode())
modifiedSentence = clientSocket.recv(1024)
const fs = require('fs');
const TEST_DIR_PATH = './test/1.0/';
(async function () {
const files = fs.readdirSync(TEST_DIR_PATH);
const items = await Promise.all(
files.map(function (file) {
if (file === 'all.0.aml') {
return 'no file';
const existedScripts = [];
function onDemand(src) {
return function loadScript() {
return new Promise(function (resolve, reject) {
const hasScriptExisted = existedScripts.includes(src);
if (hasScriptExisted) {
return resolve(src);
}