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
$ 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:
@minhphong306
minhphong306 / python_insstall_err
Created October 12, 2022 17:40
python_insstall_err
Installing dependencies from Pipfile.lock (69d58d)...
An error occurred while installing apscheduler==3.9.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4' --hash=sha256:ddc25a0ddd899de44d7f451f4375fb971887e65af51e41e5dcf681f59b8b2c9a --hash=sha256:65e6574b6395498d371d045f2a8a7e4f7d50c6ad21ef7313d15b1c7cf20df1e3! Will try again.
An error occurred while installing asgiref==3.5.0 ; python_version >= '3.7' --hash=sha256:2f8abc20f7248433085eda803936d98992f1343ddb022065779f37c5da0181d0 --hash=sha256:88d59c13d634dcffe0510be048210188edd79aeccb6a6c9028cdad6f31d730a9! Will try again.
An error occurred while installing beautifulsoup4==4.11.1 ; python_version >= '3.6' --hash=sha256:ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693 --hash=sha256:58d5c3d29f5a36ffeb94f02f0d786cd53014cf9b3b3951d42e0080d8a9498d30! Will try again.
An error occurred while installing certifi==2021.10.8 --hash=sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea5
@minhphong306
minhphong306 / vercel.json
Created July 1, 2022 19:47
Config vercel nestjs app enable CORS
{
"version": 2,
"env": {
"DAICAPHONG": "test01"
},
"builds": [
{
"src": "src/main.ts",
"use": "@vercel/node"
}
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
logger: ['error', 'warn', 'log', 'debug'],
});
app.useGlobalPipes(new ValidationPipe());
app.use(cookieParser());
app.enableCors({
origin: true,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
credentials: true,
@minhphong306
minhphong306 / Solana-cli.txt
Created July 1, 2022 10:22
Solana cli tool note
- Create new wallet:
solana-keygen new -o /home/phong/.config/solana/wallet_gear.json
@minhphong306
minhphong306 / cognitoVerify.ts
Last active June 30, 2022 03:48
Cognito mark email verified
export const markEmailVerified = async (client: CognitoIdentityServiceProvider,
poolId: string,
email) => {
return new Promise<CognitoIdentityServiceProvider.Types.AdminUpdateUserAttributesResponse>((resolve, reject) => {
const params: AdminUpdateUserAttributesRequest = {
Username: email,
UserPoolId: poolId,
UserAttributes: [
{
Name: 'email_verified',
@minhphong306
minhphong306 / csvToJson.ts
Created June 14, 2022 03:46
Convert csv to json
export const convertCsvToJson = (csvContent: string): CsvToJsonResult => {
let flag = false;
// Main Data
const objarray: Array<any> = [];
//Properties
const prop: Array<any> = [];
//Total Length
let size: any = 0;
for (const line of csvContent.split(/[\r\n]+/)) {
@minhphong306
minhphong306 / jira-report.js
Created June 3, 2022 04:38
Jira report tool, auto copy to clipboard in format: [Task Code](link): Task description
javascript: !function () {
var tagId = 'starbots-report';
var elem = document.querySelector('[data-test-id="issue.views.issue-base.foundation.breadcrumbs.breadcrumb-current-issue-container"]').getElementsByTagName('li')[0].getElementsByTagName('a')[0];
var link = elem.href;
var code = elem.textContent;
var title = document.querySelector('[data-test-id="issue.views.issue-base.foundation.summary.heading"]').textContent;
@minhphong306
minhphong306 / collation_result.sql
Created April 10, 2022 09:01
collation_result.sql
ALTER DATABASE `YOUR_DATABASE_NAME` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE `YOUR_DATABASE_NAME`.`expend` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `YOUR_DATABASE_NAME`.`post` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `YOUR_DATABASE_NAME`.`staff` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `YOUR_DATABASE_NAME`.`user` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `YOUR_DATABASE_NAME`.`user` CHANGE `email` `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE `YOUR_DATABASE_NAME`.`user` CHANGE `name` `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE `YOUR_DATABASE_NAME`.`user` CHANGE `password` `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE `YOUR_DATABASE_NAME`.`post` CHANGE `title` `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unic
@minhphong306
minhphong306 / quick_change_collation.sql
Created April 10, 2022 08:57
quick_change_collation.sql
USE information_schema;
SELECT CONCAT("ALTER DATABASE `",table_schema,"` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;") AS _sql
FROM `TABLES` WHERE table_schema LIKE "YOUR_DATABASE_NAME" AND TABLE_TYPE='BASE TABLE' GROUP BY table_schema UNION
SELECT CONCAT("ALTER TABLE `",table_schema,"`.`",table_name,"` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") AS _sql
FROM `TABLES` WHERE table_schema LIKE "YOUR_DATABASE_NAME" AND TABLE_TYPE='BASE TABLE' GROUP BY table_schema, table_name UNION
SELECT CONCAT("ALTER TABLE `",`COLUMNS`.table_schema,"`.`",`COLUMNS`.table_name, "` CHANGE `",column_name,"` `",column_name,"` ",data_type,"(",character_maximum_length,") CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",IF(is_nullable="YES"," NULL"," NOT NULL"),";") AS _sql
FROM `COLUMNS` INNER JOIN `TABLES` ON `TABLES`.table_name = `COLUMNS`.table_name WHERE `COLUMNS`.table_schema like "YOUR_DATABASE_NAME" and data_type in ('varchar','char') AND TABLE_TYPE='BASE TABLE' UNION
SELECT CONCAT("ALTER TABLE `"