Skip to content

Instantly share code, notes, and snippets.

@entron
entron / openai4o_first_last_10k_tokens.txt
Created April 11, 2025 18:38
The first and last 10K tokens of OpenAI 4o tokenizer
First 10000 tokens in the tokenizer:
Token ID: 0, Token: !
Token ID: 1, Token: "
Token ID: 2, Token: #
Token ID: 3, Token: $
Token ID: 4, Token: %
Token ID: 5, Token: &
Token ID: 6, Token: '
Token ID: 7, Token: (
Token ID: 8, Token: )
@entron
entron / gemma3_first_last_10k_tokens.txt
Created April 11, 2025 16:28
The first and last 10K tokens of Gemma 3 tokenizer
First 10000 tokens in the tokenizer:
Token: <pad>, ID: 0
Token: <eos>, ID: 1
Token: <bos>, ID: 2
Token: <unk>, ID: 3
Token: <mask>, ID: 4
Token: [multimodal], ID: 5
Token: <unused0>, ID: 6
Token: <unused1>, ID: 7
Token: <unused2>, ID: 8
@entron
entron / set-apt-proxy.md
Created August 23, 2024 01:39 — forked from wonderbeyond/set-apt-proxy.md
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@entron
entron / http-proxy.conf.md
Last active August 22, 2024 13:51 — forked from alphamarket/http-proxy.conf.md
How to make docker pull using a socks5 proxy

Create the config file:

mkdir -p /etc/systemd/system/docker.service.d && \
vi /etc/systemd/system/docker.service.d/http-proxy.conf

Put up the configs:

@entron
entron / cnn_dummy_bench.ipynb
Last active June 13, 2020 16:43
simple gpu benchmark code with pytorch for common CNN netoworks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / cifar10_bench.ipynb
Last active June 13, 2020 16:42
simple gpu benchmark with pytorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / plot_dingxiang_data.ipynb
Last active February 11, 2020 15:08
Plotting data of 2019-nCoV outbreak. Data source: https://github.com/BlankerL/DXY-2019-nCoV-Data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / test_pytorch.py
Created August 14, 2017 18:44
Test pytorch linear algebra speed
import torch
import time
# --- Test 1
N = 10
n = 1000
A = torch.randn(n, n)
B = torch.randn(n, n)
@entron
entron / test_numpy.py
Last active June 7, 2020 10:12
Test numpy installation.
import numpy as np
import numpy.random as npr
import time
# --- Test 1
N = 100
n = 2000
A = npr.randn(n, n)
B = npr.randn(n, n)
@entron
entron / sqlite_online_backup.py
Created August 13, 2016 09:13
Online backup sqlite db with python
# Online backup a sqlite3 DB.
# python3 sqlite_online_backup.py db_to_backup.sqlite backup_db.sqlite
import sqlite3
import sqlitebck
import sys
fname_to_backup = sys.argv[1]
fname_backup = sys.argv[2]