Skip to content

Instantly share code, notes, and snippets.

View obarisk's full-sized avatar

鐘翊修 obarisk

View GitHub Profile
@shubhamagarwal92
shubhamagarwal92 / get_bert_embeddings.py
Created July 22, 2019 21:49
Use pytorch-transformers from hugging face to get bert embeddings in pytorch
import torch
import logging
from pytorch_transformers import BertModel, BertTokenizer
from pytorch_transformers import *
from typing import List
CLS_TOKEN = "[CLS]"
SEP_TOKEN = "[SEP]"
logger = logging.getLogger(__name__)
@goll
goll / README.md
Last active April 22, 2025 17:08
Docker nftables configuration for Debian 10
@elico
elico / nftables-lb-wan.sh
Created August 25, 2020 03:07
Dual WAN Flow Base PCC nftables load balancing example script
#!/usr/bin/env bash
DEST_NET="192.168.111.0/24"
NEXT_HOPS="2"
NEXT_HOP_1="192.168.126.202"
NEXT_HOP_2="192.168.126.203"
NEXT_HOP_1_TABLE="202"
@JustinSDK
JustinSDK / Map.go
Created March 24, 2022 03:09
Go 泛型:Map 實現
package main
import "fmt"
func Map[T any](arr []T, fn func(T) T) []T {
newArr := make([]T, len(arr))
for i := 0; i < len(arr); i++ {
newArr[i] = fn(arr[i])
}
return newArr
@JustinSDK
JustinSDK / Map.go
Last active April 22, 2022 07:52
Go 介面:Map 實現
package main
import "fmt"
type Indicable interface {
Len() int
Idx(i int) any
}
type AnySlice []any