Skip to content

Instantly share code, notes, and snippets.

@7shi
7shi / test.py
Created February 29, 2024 03:03
[py] Gemma test
# https://huggingface.co/google/gemma-2b
# https://note.com/ngc_shj/n/n81cde9550b37
from datetime import datetime
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "google/gemma-2b"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True
@7shi
7shi / memrise.md
Last active September 10, 2025 07:56
Classic Memrise Official Courses

(deleted)

@7shi
7shi / survey.md
Last active November 28, 2023 08:37
[Claude] 🔍Language Survey
@7shi
7shi / README.md
Last active December 15, 2024 17:48
[py] XML Parser
@7shi
7shi / baidu.txt
Created August 7, 2023 15:31
Baidu translation examples
アラビア語 في منتصف الطريق من خلال حياتنا ، أجد نفسي في غابة مظلمة ، لأن الطريق الصحيح قد فقدت . Midway through our lives, I found myself in a dark forest because the right path had already been lost.
アゼルバイジャン語 Bizim həyatımızın yolunun ortasında, mən özümü qaranlıq ormanda gördüm, çünki doğru yol kayboldu. In the middle of our life, I saw myself in the dark forest, because the right path was gone.
アルバニア語 Në mes të rrugës së jetës sonë, gjeta veten në një pyll të errët, sepse rruga e duhur ishte humbur. In the middle of our lives, I found myself in a dark forest, because the right path was lost.
アルメニア語 Մեր կյանքի ճանապարհի կենտրոնում ես գտնվեցի մութ անտառում, որովհետև ճիշտ ճանապարհը կորցվել էր: In the middle of our lives, I was in the dark woods because the right way was lost.
アムハラ語 በሕይወታችን መንገድ መካከል በጨለማ ዱር ውስጥ አገኘሁ፥ የቀናውም መንገድ ጠፍቶአልና። For I have found the way of our life in the forest of darkness, and the way of uprightness perisheth.
アッサム語 আমাৰ জীৱনৰ মধ্যবৰ্তী পথ, আমি এটা ডাঠ অঞ্চলত পোৱা গল, কাৰণ সঠিক পথ হেৰাই
@7shi
7shi / capture.fsx
Last active February 12, 2023 12:31
[F#] Screen Capture
#if NETF
#r "System"
#r "System.Drawing"
#r "System.Windows.Forms"
#else
//#r "nuget: System.Drawing.Common, 5.0.2"
#r @"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.4\System.Drawing.Common.dll"
#r @"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.4\System.Windows.Forms.dll"
#r @"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.4\System.Windows.Forms.Primitives.dll"
#r @"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.4\Microsoft.Win32.SystemEvents.dll"
@7shi
7shi / imq.js
Last active December 4, 2022 05:43
[JS] Calculating imaginary and quaternionic numbers
function imul(x, y) {
return [x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]];
}
function cross(x, y) {
return [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[1] * y[2] - x[2] * y[1]];
}
function vdot(x, y) {
return x.reduce((acc, xi, i) => acc + xi * y[i], 0);
@7shi
7shi / ssml_ido.py
Last active October 18, 2022 04:10
[py] SSML converter for Ido
# CC0 http://creativecommons.org/publicdomain/zero/1.0/
phonemes = {}
phonemes2 = {}
def setphonemes(phs):
for ph in phs.split():
p1, p2 = ph.split(",")
phonemes[p1] = p2
if len(p1) > 1: phonemes2[p1[0]] = 1;
@7shi
7shi / common.ts
Created October 16, 2022 15:05
[Deno] DeepL JSON Converter
export function* splitLines(text: string) {
let line = "", prev = "";
for (const ch of text) {
if (ch == '\r') {
yield line;
line = "";
} else if (ch == '\n') {
if (prev != '\r') yield line;
line = "";
} else {
@7shi
7shi / split-pdf.html
Created August 24, 2022 17:18
[HTML]Splitter & PDF
<!DOCTYPE html>
<html lang="ja" style="height:100%">
<head>
<meta charset="utf-8">
<style>
.gutter {
background-color: #eee;
}