Skip to content

Instantly share code, notes, and snippets.

View gongfan99's full-sized avatar

Sam Gong gongfan99

  • Kitchener, Ontario
View GitHub Profile
@gongfan99
gongfan99 / tailwind.config.mjs
Created July 28, 2024 00:38
add utopia and primary/secondary color to tailwind.config.mjs
/** @type {import('tailwindcss').Config} */
/*********************************************************
* You need to first install "npm i utopia-core"
* Then you will be able to use the following:
* font-size: e.g. text-u-6, text-u-0, text-u--2
* spacing: e.g. w-u-3xl, w-u-m, w-u-3xs, w-u-s-l, w-u-500-600
* color: e.g. bg-pri-100, bg-pri-500 (bg-pri), bg-pri-900
* bg-sec-100, bg-sec-500 (bg-sec), bg-sec-900
********************************************************/
@gongfan99
gongfan99 / find-hotels-within-500-meters.js
Created May 27, 2023 16:47
Find all hotels within 500 meters from my location with Node.js
import { createPool } from 'mysql2/promise'
import 'dotenv/config'
const pool = createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
waitForConnections: true,
connectionLimit: 5,
@gongfan99
gongfan99 / save-embeddings-as-BLOB-in-MySQL.py
Created May 27, 2023 03:53
save embeddings as BLOB in MySQL with Python
import numpy as np
import mysql.connector
cnx = mysql.connector.connect(
host="HOST",
port=3306,
user="USERNAME",
password="PASSWORD",
database="DATABASE NAME",
pool_name="mypool",
@gongfan99
gongfan99 / save-embeddings-as-BLOB-in-MySQL.js
Last active September 17, 2023 04:49
save embeddings as BLOB in MySQL with Node.js
import { createPool } from 'mysql2/promise'
import 'dotenv/config'
const pool = createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
waitForConnections: true,
connectionLimit: 5,