Skip to content

Instantly share code, notes, and snippets.

View benigumocom's full-sized avatar
🏠
🙆

chanzmao benigumocom

🏠
🙆
View GitHub Profile
val listener = object : EventSourceListener() {
override fun onEvent(
eventSource: EventSource,
id: String?,
type: String?,
data: String
) {
if (data != "[DONE]") {
val d = Json.decodeFromString<Data>(data)
val c = d.choices[0].delta.content
@benigumocom
benigumocom / clipboard-text-dump.py
Last active May 30, 2023 13:13
クリップボードにコピーしているテキストのコードポイントや Unicode/UTF-16 エスケープシーケンスを確認するスクリプト 👉 https://android.benigumo.com/20230530/dump-text/
#!/usr/bin/env python
import pyperclip
from regex import regex
def graphemes(text):
return regex.findall(r'\X', text)
@benigumocom
benigumocom / dump.py
Last active May 29, 2023 12:37
【Python】絵文字を含む Unicode 文字列の文字数をカウントする方法と文字ごとの構成要素 👉 https://android.benigumo.com/20230529/python-unicode-emoji/
def dump(data):
print(data)
# https://libraries.io/pypi/regex
ss = regex.findall(r'\X', data)
print(ss)
print(len(ss))
print()
@benigumocom
benigumocom / data.py
Last active May 29, 2023 12:37
【Python】絵文字を含む Unicode 文字列の文字数をカウントする方法と文字ごとの構成要素 👉 https://android.benigumo.com/20230529/python-unicode-emoji/
data = ('aAあ'
# Emoji 1.0 😀😍 - Grinning Face | Smiling Face with Heart-Eyes
# https://emojipedia.org/emoji-1.0/
'\U0001F600'
'\U0001F60D'
# 13.0 🥸🐻‍❄️ - Disguised Face | Polar Bear
# https://emojipedia.org/emoji-13.0/
'\U0001F978'
fun dump(data: String) {
println(data)
val ss = Regex("\\X").findAll(data)
.map { match -> match.value }
.toList()
println(ss)
println(ss.size)
println()
val data = "aAあ" +
// Emoji 1.0 😀😍 - Grinning Face | Smiling Face with Heart-Eyes
// https://emojipedia.org/emoji-1.0/
"\uD83D\uDE00" + "\uD83D\uDE0D" +
// 13.0 🥸🐻‍❄️ - Disguised Face | Polar Bear
// https://emojipedia.org/emoji-13.0/
"\uD83E\uDD78" + "\uD83D\uDC3B\u200D\u2744\uFE0F" +
0x200D
emoji 👩‍👧‍👦
:family_woman_girl_boy:
code point 0x1F469
@benigumocom
benigumocom / github-emoji.md
Last active May 25, 2023 04:19
Updated: 2023-05-25 13:19:04, X-GitHub-Api-Version : 2022-11-28
emoji shortcode codepoint
👍 :+1:
:thumbsup:
1f44d
\U0001f44d
`\u
@benigumocom
benigumocom / progress.sh
Last active May 18, 2023 01:19
Text Animation using Braille pattern dots
#!/usr/local/bin/bash
chars="⣷ ⣯ ⣟ ⡿ ⢿ ⣻ ⣽ ⣾"
while true
do
for c in $chars
do
sleep 0.2
echo -en "\r[$c] loading "
fun String.printUnicodeEscapeSequences() {
println(this)
println(
this
.chars()
.joinToString("") { "\\u${it.toString(16).uppercase()}" }
)
println()
}