Skip to content

Instantly share code, notes, and snippets.

@Thong-Tran
Thong-Tran / parse-i18n.py
Created January 19, 2021 07:09
Parser and generate i18n for typescript
#!/usr/bin/python3
import sys
if sys.version_info < (3, 6):
print("Must be using Python 3.6 or higher")
exit(1)
from typing import List
import os
@Thong-Tran
Thong-Tran / latest-user-property.sql
Created December 29, 2020 08:03
Custom query for firebase event use in google datastudio
SELECT
event_date, event_timestamp, event_name, app_info.id, user_pseudo_id,
max(
if(user_property.key = "user_status", user_property.value.string_value, NULL)
) user_status
FROM
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY user_pseudo_id ORDER BY event_timestamp DESC ) as rn
FROM `project-id.dataset-id.events_*`
@Thong-Tran
Thong-Tran / test.html
Created December 3, 2020 05:02
Html to pdf in front-end
<!DOCTYPE html>
<html>
<head>
<title></title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/kendo.all.min.js"></script>
<!-- Load Pako ZLIB library to enable PDF compression -->
<script src="https://kendo.cdn.telerik.com/2017.3.913/js/pako_deflate.min.js"></script>
@Thong-Tran
Thong-Tran / pyproject.toml
Created November 17, 2020 05:52
High performance Fastapi on Windows
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
python = "^3.7"
fastapi = {extras = ["all"], version = "^0.52.0"}
uvicorn = "^0.11.5"
orjson = "^3.2.2"
@Thong-Tran
Thong-Tran / README.md
Last active May 27, 2022 11:07
Run locust workers

Run locust workers

python .\locust-workers.py -h
usage: locust-workers.py [-h] [-p path] [-s num] [-f LOCUSTFILE]

Run locust workers

optional arguments:
 -h, --help show this help message and exit
@Thong-Tran
Thong-Tran / gsheet-add-data.ts
Created November 10, 2020 05:05
Use Google cloud function for stream data from firebase to gsheet
import * as functions from 'firebase-functions';
import { OAuth2Client } from 'google-auth-library';
import { google, sheets_v4 } from 'googleapis';
import admin from 'firebase-admin';
// Use firebase functions:config:set to configure your watchedpaths object:
// googleapi.client_id = Google API client ID,
// googleapi.client_secret = client secret, and
// googleapi.sheet_id = Google Sheet id (long string in middle of sheet URL)
// watchedpaths.data_path = Firebase path for data to be synced to Google Sheet
@Thong-Tran
Thong-Tran / README.md
Last active May 27, 2022 11:09
Set up ec2 with pm2, nginx

Deploy EC2 windows server core with nginx, nodejs

Note:

  • setup-ec2-windows.ps1 doesn't have SSH's setup script because of some bug. You need to set it up manually after deployment

Deploy stack

  • Create file opts.yml with options:
    • MyIP: ip for access to server
    • KeyName: aws key pair for ec2
@Thong-Tran
Thong-Tran / README.md
Last active May 23, 2023 05:53
Set up auto build and distribute flutter app on Appcenter

Auto deploying flutter app via Appcenter

Configure project

  • Active AndroidX if it isn’t already.
  • Create and checkout to new branch (appcenter currently only listen trigger from commit code on branch)
  • Setup android:
    • Comment those lines in file android/.gitignore

gradle-wrapper.jar

@Thong-Tran
Thong-Tran / README.md
Last active May 27, 2022 11:09
Modify document by vitual printer

Modify document by vitual printer

Modify document when printing in Windows by create virtual printer

@Thong-Tran
Thong-Tran / cloudSettings
Last active July 14, 2020 03:18
vscode setting
{"lastUpload":"2020-07-14T03:18:06.626Z","extensionVersion":"v3.4.3"}