Skip to content

Instantly share code, notes, and snippets.

View Keith-Hon's full-sized avatar
👋
Hello!

Keith Hon Keith-Hon

👋
Hello!
View GitHub Profile
## Imports
from typing import Tuple
import torch
from torch import Module, Tensor
from transformers.models.roberta.modeling_roberta import RobertaPreTrainedModel, RobertaConfig, RobertaModel, RobertaEncoder
from torch.nn import CrossEntropyLoss, CosineEmbeddingLoss
## Function
@Keith-Hon
Keith-Hon / preprocessed_brands.json
Created September 21, 2022 14:48
preprocessed brands
[
"at t",
"molecole",
"enquiret",
"fairphone",
"ラスタバナナ",
"dcenta",
"caoy",
"sonim",
"jensa",
@Keith-Hon
Keith-Hon / gist:49594ef8a26379fcc46cf5c11c7cf3f2
Created June 27, 2024 05:28
Realtime WebSocket Audio Streamin
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Realtime WebSocket Audio Streaming</title>
<style>
body {
background-color: black;
color: green;
}
1
00:00:01,231 --> 00:00:02,072
係喇咁,好咁
2
00:00:02,072 --> 00:00:03,613
咁或者我簡單
3
00:00:03,613 --> 00:00:04,735
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Office Layout</title>
<style>
.room {
width: 250px;
height: 350px;
@Keith-Hon
Keith-Hon / retention.ts
Last active August 27, 2024 06:25
retention
import { NextApiRequest, NextApiResponse } from "next";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const periods = [1, 7, 14, 30];
const output = {};
for (let j = 0; j < periods.length; j++) {
const period = periods[j];