Skip to content

Instantly share code, notes, and snippets.

View minhphong306's full-sized avatar
😄
Don't watch the clock. Do what it does! Keep going!

Phong Do minhphong306

😄
Don't watch the clock. Do what it does! Keep going!
View GitHub Profile
@minhphong306
minhphong306 / example.ts
Created August 24, 2023 00:46
example.ts
if (!file_exist)
create_file();
content = read_all_files_content();
return content;
@minhphong306
minhphong306 / always-brackets.ts
Created August 23, 2023 06:18
always-brackets.ts
// Bad
if (condition)
do_something()
// Good
if (condition) {
do_something()
}
@minhphong306
minhphong306 / result.txt
Created August 14, 2023 06:41
result.txt
{"partial": "", "infer_count": 1, "endpoint_type": 0}
{"partial": "", "infer_count": 2, "endpoint_type": 0}
{"partial": "", "infer_count": 3, "endpoint_type": 0}
{"partial": "", "infer_count": 4, "endpoint_type": 0}
{"partial": "", "infer_count": 5, "endpoint_type": 0}
{"partial": "", "infer_count": 6, "endpoint_type": 0}
{"partial": "dạ", "infer_count": 7, "endpoint_type": 0}
{"partial": "dạ", "infer_count": 8, "endpoint_type": 0}
{"partial": "dạ", "infer_count": 9, "endpoint_type": 0}
{"partial": "dạ", "infer_count": 10, "endpoint_type": 0}
@minhphong306
minhphong306 / output.txt
Created August 11, 2023 14:06
output.txt
Connected to wss://vinbase.ai/api/v2/asr_general/stream
Type Ctrl-C to exit
partial:
partial:
partial:
final: {'text': '', 'session_id': '6096af57ca8c79db624113902004876a6cdbfd8d7afd608a4769bbc26bd1f01c', 'chunk_hash': 'cfd94443e3447994da13892f57489a58ccf7c264', 'received_time': 1691762553.773651, 'sent_time': 1691762553.8646586}
Terminating connection
Traceback (most recent call last):
File "/Users/apple/code/startup/himee-new/vinai/main.py", line 27, in _polite_websocket
yield ws
@minhphong306
minhphong306 / demo.py
Created August 11, 2023 14:03
demo.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import aiohttp
import sys
import logging
import json
import time
from contextlib import asynccontextmanager, contextmanager, AsyncExitStack
from typing import AsyncGenerator, Generator
const selectField = {
all: false,
test_file: true,
case_id: false
}
function saveData(selectField) {
// alert(JSON.stringify(selectField))
const data = {
test_file: '',
case_id: ''
@minhphong306
minhphong306 / test.spec.ts
Created June 7, 2023 17:38
Playwright make bot undetectable
const createPage = async (browser: Browser) => {
const page = await browser.newPage({
bypassCSP: true,
});
await page.addInitScript(`
const newProto = navigator.__proto__;
delete newProto.webdriver;
navigator.__proto__ = newProto;
@minhphong306
minhphong306 / crawl_udemy_course_content.js
Created March 3, 2023 06:42
Crawl Udemy course content
/**
How to use this snippet to
*/
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function getElementsByXpath(path) {
@minhphong306
minhphong306 / yarn.lock file
Created February 12, 2023 08:36
yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@7.16.7", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7":
version "7.16.7"
resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz"
integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==
dependencies:
"@babel/highlight" "^7.16.7"
$ yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error H:\code\homework\qe-talent-class\node_modules\deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments: