Skip to content

Instantly share code, notes, and snippets.

View khanhkhuu's full-sized avatar

Khanh Khuu khanhkhuu

View GitHub Profile
/****** Object: UserDefinedFunction [dbo].[GetDocument] Script Date: 6/7/2022 2:52:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[GetDocument](@documentId VARCHAR(36), @revision INT = NULL)
RETURNS @table TABLE(
Id VARCHAR(36),
@khanhkhuu
khanhkhuu / Google.vb
Last active August 11, 2022 06:20
Connect Google from WinForm
Imports System.IO
Imports System.Threading
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Services
Imports Google.Apis.Sheets.v4
Imports Google.Apis.Sheets.v4.Data
Imports Google.Apis.Util.Store
Public Class Google
Private Scopes As String() = {SheetsService.Scope.Spreadsheets}
<body style="background-color: #f7f5fa;margin: 0 !important;padding: 0 !important;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;height: 100% !important;width: 100% !important;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;border-collapse: collapse !important;">
<tr>
<td bgcolor="teal" align="center" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;">
<table border="0" cellpadding="0" cellspacing="0" width="610" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;border-collapse: collapse !important;">
<tr>
<td align="center" valign="top" style="padding: 20px 10px 20px 10px;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;">
<div style="display: block; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0">EHS PORTAL</div>
@khanhkhuu
khanhkhuu / vite.config.ts
Created November 30, 2022 02:28
Vite config
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { quasar, transformAssetUrls } from "@quasar/vite-plugin";
import path from "path";
import { name } from './package.json';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const ENV = loadEnv(mode, process.cwd());
@khanhkhuu
khanhkhuu / domo.py
Last active December 8, 2022 04:24
Domo Connector for Python
from http.client import HTTPSConnection
from base64 import b64encode
import json
import pandas
class DomoConnector:
def __init__(self, client_id, client_secret):
self.__client_id = client_id
self.__client_secret = client_secret
@khanhkhuu
khanhkhuu / test-domo-connector.py
Created December 1, 2022 09:49
Test Domo Connector
from domo import DomoConnector
# ClientId và ClientSecret tạo từ đây https://developer.domo.com/new-client
clientId = "xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxx"
clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
domo_client = DomoConnector(clientId, clientSecret)
# ID của Dataset cần update / get data
data_set_id = '8744159e-737f-4cba-8bd4-71f97ae27433'
@khanhkhuu
khanhkhuu / extractDataFromPdf.js
Created December 9, 2022 04:02
Extract Table From PDF
function test() {
const data = extractDataFromPdf('1jVppnsxpiK56RY7vVFMkTa1_GV8SCWxo');
console.log(data);
}
function extractDataFromPdf(pdfId) {
const PDF_LANGUAGE = 'th';
const pdfFile = DriveApp.getFileById(pdfId);
const { id } = Drive.Files.insert(
{
function cayDiemDataCamp() {
const cookie = '<YOUR_COOKIE_HERE>';
for (let i = 0; i < 10000; i++) {
try {
spam(i, cookie);
} catch (err) {}
}
}
# Cài Python 32Bit để chạy được script này
# Link: https://repo.anaconda.com/archive/Anaconda3-2021.05-Windows-x86.exe
import win32com.client
import ctypes
def main():
connectionString = "Asia: (R/3 Test) CAI"
hidden = True
application = win32com.client.Dispatch("Sapgui.ScriptingCtrl.1")
Dim ScriptHost : ScriptHost = Mid(WScript.FullName, InStrRev(WScript.FullName, "\") + 1, Len(WScript.FullName))
Dim oWs : Set oWs = CreateObject("WScript.Shell")
Dim oProcEnv : Set oProcEnv = oWs.Environment("Process")
If InStr(LCase(WScript.FullName), LCase(oProcEnv("windir") & "\System32\")) And oProcEnv("PROCESSOR_ARCHITECTURE") = "AMD64" Then
If Not WScript.Arguments.Count = 0 Then
Dim sArg, Arg
sArg = ""
For Each Arg In Wscript.Arguments
sArg = sArg & " " & """" & Arg & """"