Compare commits
12 Commits
a182f694c0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d7543ec8b | |||
| b193946a1a | |||
| 0d64c4dfb3 | |||
| ca469fff65 | |||
| 7b44f211d3 | |||
| 0e3291b086 | |||
| 61d6c9488b | |||
| 72f4a6de80 | |||
| 110166d988 | |||
| b9522bfc89 | |||
| ec9fadb5f9 | |||
| 30a6debb7b |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -10,4 +10,11 @@ input.txt
|
|||||||
greek.csv
|
greek.csv
|
||||||
node_modules
|
node_modules
|
||||||
target
|
target
|
||||||
_build
|
_build/
|
||||||
|
dist/
|
||||||
|
dist-newstyle/
|
||||||
|
*.pdf
|
||||||
|
*.ps
|
||||||
|
*~
|
||||||
|
*.zip
|
||||||
|
.ipynb_checkpoints/
|
||||||
|
|||||||
15
hijri/hijri.go
Normal file
15
hijri/hijri.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package main
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
"github.com/kiaderouiche/go-hijricalendar"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Get a new instance of hijri.Time representing the current time
|
||||||
|
ht := hijri.Now(hijri.UmmAlQura())
|
||||||
|
|
||||||
|
// Get year, month, day
|
||||||
|
fmt.Println(ht.Date())
|
||||||
|
fmt.Println(ht.Year(), ht.Month(), ht.Day())
|
||||||
|
}
|
||||||
8
marcov-chain-monte-carlo/shell.nix
Normal file
8
marcov-chain-monte-carlo/shell.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
(pkgs.ghc.withPackages (hs: [
|
||||||
|
hs.mcmc
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
||||||
48
name-eugenics/name-eugenics.scm
Normal file
48
name-eugenics/name-eugenics.scm
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
(random-seed (time-nanosecond (current-time)))
|
||||||
|
|
||||||
|
(define (sample elements)
|
||||||
|
(let* ((len (length elements))
|
||||||
|
(random-index (random len)))
|
||||||
|
(list-ref elements random-index)))
|
||||||
|
|
||||||
|
(define (flatten lst)
|
||||||
|
(cond
|
||||||
|
((null? lst) '())
|
||||||
|
((list? (car lst)) (append (flatten (car lst)) (flatten (cdr lst))))
|
||||||
|
(else (cons (car lst) (flatten (cdr lst))))))
|
||||||
|
|
||||||
|
(define (symbols-to-string symbol-list)
|
||||||
|
(apply string-append (map symbol->string symbol-list)))
|
||||||
|
|
||||||
|
(define V '(a e i o u))
|
||||||
|
|
||||||
|
(define C '(p t k b d g f s h v z m n r l y w))
|
||||||
|
|
||||||
|
(define syllable-types
|
||||||
|
'((C V)
|
||||||
|
(V)
|
||||||
|
(C V C)
|
||||||
|
(V C)))
|
||||||
|
|
||||||
|
(define (random-syllable)
|
||||||
|
(let* ((syllable-type (sample syllable-types)))
|
||||||
|
(map
|
||||||
|
(lambda (cover-symbol)
|
||||||
|
(sample (case cover-symbol
|
||||||
|
((C) C)
|
||||||
|
((V) V)
|
||||||
|
(else (error #f "Invalid symbol")))))
|
||||||
|
syllable-type)))
|
||||||
|
|
||||||
|
(define (multiple n f)
|
||||||
|
(if (= n 0) '()
|
||||||
|
(cons (f)
|
||||||
|
(multiple (- n 1) f))))
|
||||||
|
|
||||||
|
(let*
|
||||||
|
((max-syllables 5)
|
||||||
|
(syllable-count (+ 1 (random max-syllables)))
|
||||||
|
(syllables (multiple syllable-count random-syllable)))
|
||||||
|
(begin
|
||||||
|
(display (symbols-to-string (flatten syllables)))
|
||||||
|
(newline)))
|
||||||
4
name-eugenics/shell.nix
Normal file
4
name-eugenics/shell.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [ pkgs.chez ];
|
||||||
|
}
|
||||||
23
obsidian-tasks/obsidian-tasks.sh
Executable file
23
obsidian-tasks/obsidian-tasks.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
VAULT=~/cloud/syncthing/obsidian
|
||||||
|
|
||||||
|
rg --no-filename '^\s*- \[ ]' "$VAULT" \
|
||||||
|
| awk '
|
||||||
|
BEGIN {
|
||||||
|
# initialize "last-tag"
|
||||||
|
# initialize tags assoc array
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# find out tag
|
||||||
|
# remove tag from task text
|
||||||
|
# add task text to assoc array
|
||||||
|
# save last-tag
|
||||||
|
}
|
||||||
|
/^\s+/ {
|
||||||
|
# save under last-tag in assoc array if no tag
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
# group by tag
|
||||||
|
}
|
||||||
|
'
|
||||||
18
print-remote/print.sh
Normal file
18
print-remote/print.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
printer=OfficeJet
|
||||||
|
proxy=zaatar
|
||||||
|
|
||||||
|
remote_temporary_directory=$(ssh "$proxy" 'mktemp -d')
|
||||||
|
clean() {
|
||||||
|
ssh "$proxy" "rm -rf $remote_temporary_directory"
|
||||||
|
}
|
||||||
|
trap clean EXIT
|
||||||
|
|
||||||
|
for file in $@; do
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
rsync "$file" "$proxy:$remote_temporary_directory"
|
||||||
|
ssh "$proxy" lpr -P "$printer" "$remote_temporary_directory/$(basename "$file")"
|
||||||
|
else
|
||||||
|
echo Skipping non-file "$file" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ssh "$proxy" lpq -P "$printer"
|
||||||
11
pronouncer/bereshit
Normal file
11
pronouncer/bereshit
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ ב וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֙הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְה֑וֹם וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃ ג וַיֹּ֥אמֶר אֱלֹהִ֖ים יְהִ֣י א֑וֹר וַֽיְהִי־אֽוֹר׃ ד וַיַּ֧רְא אֱלֹהִ֛ים אֶת־הָא֖וֹר כִּי־ט֑וֹב וַיַּבְדֵּ֣ל אֱלֹהִ֔ים בֵּ֥ין הָא֖וֹר וּבֵ֥ין הַחֹֽשֶׁךְ׃ ה וַיִּקְרָ֨א אֱלֹהִ֤ים ׀ לָאוֹר֙ י֔וֹם וְלַחֹ֖שֶׁךְ קָ֣רָא לָ֑יְלָה וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם אֶחָֽד׃
|
||||||
|
|
||||||
|
[לוי]ו וַיֹּ֣אמֶר אֱלֹהִ֔ים יְהִ֥י רָקִ֖יעַ בְּת֣וֹךְ הַמָּ֑יִם וִיהִ֣י מַבְדִּ֔יל בֵּ֥ין מַ֖יִם לָמָֽיִם׃ ז וַיַּ֣עַשׂ אֱלֹהִים֮ אֶת־הָרָקִ֒יעַ֒ וַיַּבְדֵּ֗ל בֵּ֤ין הַמַּ֙יִם֙ אֲשֶׁר֙ מִתַּ֣חַת לָרָקִ֔יעַ וּבֵ֣ין הַמַּ֔יִם אֲשֶׁ֖ר מֵעַ֣ל לָרָקִ֑יעַ וַֽיְהִי־כֵֽן׃ ח וַיִּקְרָ֧א אֱלֹהִ֛ים לָֽרָקִ֖יעַ שָׁמָ֑יִם וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם שֵׁנִֽי׃
|
||||||
|
|
||||||
|
[ישראל]ט וַיֹּ֣אמֶר אֱלֹהִ֗ים יִקָּו֨וּ הַמַּ֜יִם מִתַּ֤חַת הַשָּׁמַ֙יִם֙ אֶל־מָק֣וֹם אֶחָ֔ד וְתֵרָאֶ֖ה הַיַּבָּשָׁ֑ה וַֽיְהִי־כֵֽן׃ י וַיִּקְרָ֨א אֱלֹהִ֤ים ׀ לַיַּבָּשָׁה֙ אֶ֔רֶץ וּלְמִקְוֵ֥ה הַמַּ֖יִם קָרָ֣א יַמִּ֑ים וַיַּ֥רְא אֱלֹהִ֖ים כִּי־טֽוֹב׃ יא וַיֹּ֣אמֶר אֱלֹהִ֗ים תַּֽדְשֵׁ֤א הָאָ֙רֶץ֙ דֶּ֗שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינ֔וֹ אֲשֶׁ֥ר זַרְעוֹ־ב֖וֹ עַל־הָאָ֑רֶץ וַֽיְהִי־כֵֽן׃ יב וַתּוֹצֵ֨א הָאָ֜רֶץ דֶּ֠שֶׁא עֵ֣שֶׂב מַזְרִ֤יעַ זֶ֙רַע֙ לְמִינֵ֔הוּ וְעֵ֧ץ עֹֽשֶׂה־פְּרִ֛י אֲשֶׁ֥ר זַרְעוֹ־ב֖וֹ לְמִינֵ֑הוּ וַיַּ֥רְא אֱלֹהִ֖ים כִּי־טֽוֹב׃ יג וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם שְׁלִישִֽׁי׃
|
||||||
|
|
||||||
|
[ע"כ ישראל]יד וַיֹּ֣אמֶר אֱלֹהִ֗ים יְהִ֤י מְאֹרֹת֙ בִּרְקִ֣יעַ הַשָּׁמַ֔יִם לְהַבְדִּ֕יל בֵּ֥ין הַיּ֖וֹם וּבֵ֣ין הַלָּ֑יְלָה וְהָי֤וּ לְאֹתֹת֙ וּלְמ֣וֹעֲדִ֔ים וּלְיָמִ֖ים וְשָׁנִֽים׃ טו וְהָי֤וּ לִמְאוֹרֹת֙ בִּרְקִ֣יעַ הַשָּׁמַ֔יִם לְהָאִ֖יר עַל־הָאָ֑רֶץ וַֽיְהִי־כֵֽן׃ טז וַיַּ֣עַשׂ אֱלֹהִ֔ים אֶת־שְׁנֵ֥י הַמְּאֹרֹ֖ת הַגְּדֹלִ֑ים אֶת־הַמָּא֤וֹר הַגָּדֹל֙ לְמֶמְשֶׁ֣לֶת הַיּ֔וֹם וְאֶת־הַמָּא֤וֹר הַקָּטֹן֙ לְמֶמְשֶׁ֣לֶת הַלַּ֔יְלָה וְאֵ֖ת הַכּוֹכָבִֽים׃ יז וַיִּתֵּ֥ן אֹתָ֛ם אֱלֹהִ֖ים בִּרְקִ֣יעַ הַשָּׁמָ֑יִם לְהָאִ֖יר עַל־הָאָֽרֶץ׃ יח וְלִמְשֹׁל֙ בַּיּ֣וֹם וּבַלַּ֔יְלָה וּֽלְﬞהַבְדִּ֔יל בֵּ֥ין הָא֖וֹר וּבֵ֣ין הַחֹ֑שֶׁךְ וַיַּ֥רְא אֱלֹהִ֖ים כִּי־טֽוֹב׃ יט וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם רְבִיעִֽי׃
|
||||||
|
|
||||||
|
כ וַיֹּ֣אמֶר אֱלֹהִ֔ים יִשְׁרְצ֣וּ הַמַּ֔יִם שֶׁ֖רֶץ נֶ֣פֶשׁ חַיָּ֑ה וְעוֹף֙ יְעוֹפֵ֣ף עַל־הָאָ֔רֶץ עַל־פְּנֵ֖י רְקִ֥יעַ הַשָּׁמָֽיִם׃ כא וַיִּבְרָ֣א אֱלֹהִ֔ים אֶת־הַתַּנִּינִ֖ם הַגְּדֹלִ֑ים וְאֵ֣ת כׇּל־נֶ֣פֶשׁ הַֽחַיָּ֣ה ׀ הָֽרֹמֶ֡שֶׂת אֲשֶׁר֩ שָׁרְצ֨וּ הַמַּ֜יִם לְמִֽינֵהֶ֗ם וְאֵ֨ת כׇּל־ע֤וֹף כָּנָף֙ לְמִינֵ֔הוּ וַיַּ֥רְא אֱלֹהִ֖ים כִּי־טֽוֹב׃ כב וַיְבָ֧רֶךְ אֹתָ֛ם אֱלֹהִ֖ים לֵאמֹ֑ר פְּר֣וּ וּרְב֗וּ וּמִלְא֤וּ אֶת־הַמַּ֙יִם֙ בַּיַּמִּ֔ים וְהָע֖וֹף יִ֥רֶב בָּאָֽרֶץ׃ כג וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם חֲמִישִֽׁי׃
|
||||||
|
|
||||||
|
כד וַיֹּ֣אמֶר אֱלֹהִ֗ים תּוֹצֵ֨א הָאָ֜רֶץ נֶ֤פֶשׁ חַיָּה֙ לְמִינָ֔הּ בְּהֵמָ֥ה וָרֶ֛מֶשׂ וְחַֽיְתוֹ־אֶ֖רֶץ לְמִינָ֑הּ וַֽיְהִי־כֵֽן׃ כה וַיַּ֣עַשׂ אֱלֹהִים֩ אֶת־חַיַּ֨ת הָאָ֜רֶץ לְמִינָ֗הּ וְאֶת־הַבְּהֵמָה֙ לְמִינָ֔הּ וְאֵ֛ת כׇּל־רֶ֥מֶשׂ הָֽאֲדָמָ֖ה לְמִינֵ֑הוּ וַיַּ֥רְא אֱלֹהִ֖ים כִּי־טֽוֹב׃ כו וַיֹּ֣אמֶר אֱלֹהִ֔ים נַֽעֲשֶׂ֥ה אָדָ֛ם בְּצַלְמֵ֖נוּ כִּדְמוּתֵ֑נוּ וְיִרְדּוּ֩ בִדְגַ֨ת הַיָּ֜ם וּבְע֣וֹף הַשָּׁמַ֗יִם וּבַבְּהֵמָה֙ וּבְכׇל־הָאָ֔רֶץ וּבְכׇל־הָרֶ֖מֶשׂ הָֽרֹמֵ֥שׂ עַל־הָאָֽרֶץ׃ כז וַיִּבְרָ֨א אֱלֹהִ֤ים ׀ אֶת־הָֽאָדָם֙ בְּצַלְמ֔וֹ בְּצֶ֥לֶם אֱלֹהִ֖ים בָּרָ֣א אֹת֑וֹ זָכָ֥ר וּנְקֵבָ֖ה בָּרָ֥א אֹתָֽם׃ כח וַיְבָ֣רֶךְ אֹתָם֮ אֱלֹהִים֒ וַיֹּ֨אמֶר לָהֶ֜ם אֱלֹהִ֗ים פְּר֥וּ וּרְב֛וּ וּמִלְא֥וּ אֶת־הָאָ֖רֶץ וְכִבְשֻׁ֑הָ וּרְד֞וּ בִּדְגַ֤ת הַיָּם֙ וּבְע֣וֹף הַשָּׁמַ֔יִם וּבְכׇל־חַיָּ֖ה הָֽרֹמֶ֥שֶׂת עַל־הָאָֽרֶץ׃ כט וַיֹּ֣אמֶר אֱלֹהִ֗ים הִנֵּה֩ נָתַ֨תִּי לָכֶ֜ם אֶת־כׇּל־עֵ֣שֶׂב ׀ זֹרֵ֣עַ זֶ֗רַע אֲשֶׁר֙ עַל־פְּנֵ֣י כׇל־הָאָ֔רֶץ וְאֶת־כׇּל־הָעֵ֛ץ אֲשֶׁר־בּ֥וֹ פְרִי־עֵ֖ץ זֹרֵ֣עַ זָ֑רַע לָכֶ֥ם יִֽהְיֶ֖ה לְאׇכְלָֽה׃ ל וּֽלְכׇל־חַיַּ֣ת הָ֠אָ֠רֶץ וּלְכׇל־ע֨וֹף הַשָּׁמַ֜יִם וּלְכֹ֣ל ׀ רוֹמֵ֣שׂ עַל־הָאָ֗רֶץ אֲשֶׁר־בּוֹ֙ נֶ֣פֶשׁ חַיָּ֔ה אֶת־כׇּל־יֶ֥רֶק עֵ֖שֶׂב לְאׇכְלָ֑ה וַֽיְהִי־כֵֽן׃ לא וַיַּ֤רְא אֱלֹהִים֙ אֶת־כׇּל־אֲשֶׁ֣ר עָשָׂ֔ה וְהִנֵּה־ט֖וֹב מְאֹ֑ד וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר י֥וֹם הַשִּׁשִּֽׁי׃
|
||||||
8
pronouncer/input
Normal file
8
pronouncer/input
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
בְּרֵאשִׁית בָּרָא אֱלֹהִים אֵת הַשָּׁמַיִם וְאֵת הָאָֽרֶץ׃
|
||||||
|
וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ וְחֹשֶׁךְ עַל־פְּנֵי תְהוֹם וְרוּחַ אֱלֹהִים מְרַחֶפֶת עַל־פְּנֵי הַמָּֽיִם׃
|
||||||
|
וַיֹּאמֶר אֱלֹהִים יְהִי אוֹר וַֽיְהִי־אֽוֹר׃
|
||||||
|
וַיַּרְא אֱלֹהִים אֶת־הָאוֹר כִּי־טוֹב וַיַּבְדֵּל אֱלֹהִים בֵּין הָאוֹר וּבֵין הַחֹֽשֶׁךְ׃
|
||||||
|
וַיִּקְרָא אֱלֹהִים ׀ לָאוֹר יוֹם וְלַחֹשֶׁךְ קָרָא לָיְלָה וַֽיְהִי־עֶרֶב וַֽיְהִי־בֹקֶר יוֹם אֶחָֽד׃ פ
|
||||||
|
וַיֹּאמֶר אֱלֹהִים יְהִי רָקִיעַ בְּתוֹךְ הַמָּיִם וִיהִי מַבְדִּיל בֵּין מַיִם לָמָֽיִם׃
|
||||||
|
וַיַּעַשׂ אֱלֹהִים אֶת־הָרָקִיעַ וַיַּבְדֵּל בֵּין הַמַּיִם אֲשֶׁר מִתַּחַת לָרָקִיעַ וּבֵין הַמַּיִם אֲשֶׁר מֵעַל לָרָקִיעַ וַֽיְהִי־כֵֽן׃
|
||||||
|
וַיִּקְרָא אֱלֹהִים לָֽרָקִיעַ שָׁמָיִם וַֽיְהִי־עֶרֶב וַֽיְהִי־בֹקֶר יוֹם שֵׁנִֽי׃ פ
|
||||||
90
pronouncer/process.sed
Executable file
90
pronouncer/process.sed
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
#!/usr/bin/env -S sed -f
|
||||||
|
|
||||||
|
s/ֽ//g # meteg
|
||||||
|
|
||||||
|
s/\([ְֱִֵֶַָֹֹ]\?\)\(ּ\?\)\([ׁׂ]\?\)/\3\2\1/g
|
||||||
|
|
||||||
|
s/[֛֖֥֑֣֤֧֮֒֗֙֨֠֔֩֡]/'/g
|
||||||
|
|
||||||
|
s/ךְ/ך/g
|
||||||
|
s/שׁ/š/g
|
||||||
|
s/שׂ/ś/g
|
||||||
|
|
||||||
|
s/בּ/b/g
|
||||||
|
s/דּ/d/g
|
||||||
|
s/גּ/g/g
|
||||||
|
s/[פף]ּ/p/g
|
||||||
|
s/תּ/t/g
|
||||||
|
s/[כך]ּ/k/g
|
||||||
|
|
||||||
|
s/ב/β/g
|
||||||
|
s/ד/δ/g
|
||||||
|
s/ג/γ/g
|
||||||
|
s/[פף]/φ/g
|
||||||
|
s/ת/θ/g
|
||||||
|
s/[כך]/χ/g
|
||||||
|
|
||||||
|
|
||||||
|
s/ח/ḥ/g
|
||||||
|
s/[ןנ]/n/g
|
||||||
|
s/ר/r/g
|
||||||
|
s/א/ʾ/g
|
||||||
|
s/[מם]/m/g
|
||||||
|
s/[צץ]/ṣ/g
|
||||||
|
s/ל/l/g
|
||||||
|
s/ז/z/g
|
||||||
|
s/ק/ḳ/g
|
||||||
|
s/ט/ṭ/g
|
||||||
|
s/ה/h/g
|
||||||
|
s/ע/ʿ/g
|
||||||
|
s/וּ/û/g
|
||||||
|
s/ֵי/ê/g
|
||||||
|
s/ִי/î/g
|
||||||
|
s/ְ/ə/g
|
||||||
|
s/ֱ/ĕ/g
|
||||||
|
s/ֶ/e/g
|
||||||
|
s/ֹ/ō/g
|
||||||
|
s/ַ/a/g
|
||||||
|
s/ֲ/ă/g
|
||||||
|
s/ֵ/ē/g
|
||||||
|
s/ִ/i/g
|
||||||
|
s/ֻ/u/g
|
||||||
|
s/ָ/ā/g
|
||||||
|
s/ׇ/o/g
|
||||||
|
s/ו/v/g
|
||||||
|
s/י/y/g
|
||||||
|
s/vō/ô/g
|
||||||
|
s/\(.\)ּ/\1\1/g
|
||||||
|
s/\([ḥʿ]\)a\b/a\1/g # patah furtivum
|
||||||
|
s/\([ai]\)\([rḇḳy]\)ə/\1\2/g
|
||||||
|
s/־/-/g
|
||||||
|
s/׃/./g
|
||||||
|
s/\([aeiuāēōêîû]\)\('\?\)\([ptk]\)\('\?\)\([aeiuāēōêîû]\)/\1\2\3\3\4\5/g # dagesch forte
|
||||||
|
s/\([aeiuoá]\)\(.\)ə/\1\2/g # schwa quiescens
|
||||||
|
s/\bφ\b//g
|
||||||
|
|
||||||
|
|
||||||
|
s/a'/á/g
|
||||||
|
s/ā\(.\?\)'/ā́\1/g
|
||||||
|
s/ē\(.\?\)'/ḗ\1/g
|
||||||
|
s/e\(.\?\)'/é\1/g
|
||||||
|
s/ō\(.\?\)'/ṓ\1/g
|
||||||
|
s/ô\(.\?\)'/ố\1/g
|
||||||
|
s/i\(.\?\)'/i\1/g
|
||||||
|
s/î\(.\?\)'/î́\1/g
|
||||||
|
s/i'y\|î'/î́/g
|
||||||
|
s/iy/î/g
|
||||||
|
s/ḗy/ế/g
|
||||||
|
s/'ô/ố/g
|
||||||
|
s/ō'/ṓ/g
|
||||||
|
s/û'\|'û/û́/g
|
||||||
|
s/i'/í/g
|
||||||
|
|
||||||
|
|
||||||
|
s/φ/p̄/g
|
||||||
|
s/θ/ṯ/g
|
||||||
|
s/χ/ḵ/g
|
||||||
|
s/β/ḇ/g
|
||||||
|
s/δ/ḏ/g
|
||||||
|
s/γ/ḡ/g
|
||||||
|
|
||||||
132
roff/letter.txt
Normal file
132
roff/letter.txt
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[1mTitle of my paper[0m
|
||||||
|
|
||||||
|
|
||||||
|
Jim Hall
|
||||||
|
|
||||||
|
Class
|
||||||
|
|
||||||
|
Instructor
|
||||||
|
|
||||||
|
Date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[1mleft center right[0m
|
||||||
|
|
||||||
|
|
||||||
|
[1m1. Introduction[0m
|
||||||
|
|
||||||
|
|
||||||
|
One cool thing I like about the history of Unix is how
|
||||||
|
|
||||||
|
Unix developed into a document processing system. The short
|
||||||
|
|
||||||
|
history of that is the Unix team wanted to purchase a new
|
||||||
|
|
||||||
|
computer to keep working on Unix. But management said "No."
|
||||||
|
|
||||||
|
|
||||||
|
Around that same time, the Patents team wanted to buy a
|
||||||
|
|
||||||
|
new computer to write patent applications, but the vendor
|
||||||
|
|
||||||
|
hadn't finished the software yet. The Unix team went to
|
||||||
|
|
||||||
|
them and said:
|
||||||
|
|
||||||
|
|
||||||
|
Hey, if you buy us a new computer, we'll update the
|
||||||
|
existing [1mroff [22mtypesetting system so you can write
|
||||||
|
patent applications.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
That's how Unix created the first [1mnroff [22mprogram, [4mnew[0m
|
||||||
|
|
||||||
|
[4mroff[24m. Later, they updated [1mnroff [22mto become [1mtroff[22m, the [4mtype-[0m
|
||||||
|
|
||||||
|
[4msetter[24m [4mroff[24m, and even later [1mditroff[22m, the [4mdevice[24m [4midenependent[0m
|
||||||
|
|
||||||
|
version of [1mtroff[22m.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[1mleft 1[0m
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2
roff/margins.me
Normal file
2
roff/margins.me
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.ll 60
|
||||||
|
.po 10
|
||||||
465
roff/paper-ps
Normal file
465
roff/paper-ps
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
x T ps
|
||||||
|
x res 72000 1 1
|
||||||
|
x init
|
||||||
|
p1
|
||||||
|
V168000
|
||||||
|
H100000
|
||||||
|
DFd
|
||||||
|
x font 38 TB
|
||||||
|
f38
|
||||||
|
s10000
|
||||||
|
h263010
|
||||||
|
md
|
||||||
|
tT
|
||||||
|
H369500
|
||||||
|
title
|
||||||
|
wh2500
|
||||||
|
tof
|
||||||
|
wh2500
|
||||||
|
tmy
|
||||||
|
wh2500
|
||||||
|
tpaper
|
||||||
|
n12000 0
|
||||||
|
x font 5 TR
|
||||||
|
f5
|
||||||
|
V204000
|
||||||
|
H382915
|
||||||
|
tJim
|
||||||
|
wh2500
|
||||||
|
tHall
|
||||||
|
n12000 0
|
||||||
|
V228000
|
||||||
|
H389165
|
||||||
|
tClass
|
||||||
|
n12000 0
|
||||||
|
V252000
|
||||||
|
H380560
|
||||||
|
tInstructor
|
||||||
|
n12000 0
|
||||||
|
V276000
|
||||||
|
H390560
|
||||||
|
tDate
|
||||||
|
n12000 0
|
||||||
|
V792000
|
||||||
|
p1
|
||||||
|
x font 38 TB
|
||||||
|
f38
|
||||||
|
s10000
|
||||||
|
V60000
|
||||||
|
H100000
|
||||||
|
tleft
|
||||||
|
h272795
|
||||||
|
tcenter
|
||||||
|
h265565
|
||||||
|
tright
|
||||||
|
n12000 0
|
||||||
|
V96000
|
||||||
|
H100000
|
||||||
|
t1.
|
||||||
|
wh5000
|
||||||
|
tIntr
|
||||||
|
H129540
|
||||||
|
toduction
|
||||||
|
h5000
|
||||||
|
n12000 0
|
||||||
|
x font 5 TR
|
||||||
|
f5
|
||||||
|
V124200
|
||||||
|
H125000
|
||||||
|
tOne
|
||||||
|
wh2574
|
||||||
|
tcool
|
||||||
|
wh2574
|
||||||
|
tthing
|
||||||
|
wh2573
|
||||||
|
tI
|
||||||
|
wh2573
|
||||||
|
tlik
|
||||||
|
H203524
|
||||||
|
te
|
||||||
|
wh2573
|
||||||
|
tabout
|
||||||
|
wh2573
|
||||||
|
tthe
|
||||||
|
wh2573
|
||||||
|
thistory
|
||||||
|
wh2573
|
||||||
|
tof
|
||||||
|
wh2573
|
||||||
|
tUnix
|
||||||
|
wh2573
|
||||||
|
tis
|
||||||
|
wh2573
|
||||||
|
tho
|
||||||
|
H332945
|
||||||
|
tw
|
||||||
|
wh2573
|
||||||
|
tUnix
|
||||||
|
wh2573
|
||||||
|
tde
|
||||||
|
H374501
|
||||||
|
tv
|
||||||
|
H379351
|
||||||
|
teloped
|
||||||
|
wh2573
|
||||||
|
tinto
|
||||||
|
wh2573
|
||||||
|
ta
|
||||||
|
wh2573
|
||||||
|
tdocument
|
||||||
|
wh2573
|
||||||
|
tprocessing
|
||||||
|
wh2573
|
||||||
|
tsystem.
|
||||||
|
wh5073
|
||||||
|
tThe
|
||||||
|
wh2573
|
||||||
|
tshort
|
||||||
|
wh2573
|
||||||
|
thistory
|
||||||
|
wh2573
|
||||||
|
tof
|
||||||
|
wh2573
|
||||||
|
tthat
|
||||||
|
wh2573
|
||||||
|
tis
|
||||||
|
wh2573
|
||||||
|
tthe
|
||||||
|
wh2573
|
||||||
|
tUnix
|
||||||
|
n12000 0
|
||||||
|
V148200
|
||||||
|
H100000
|
||||||
|
tteam
|
||||||
|
wh2500
|
||||||
|
tw
|
||||||
|
H129060
|
||||||
|
tanted
|
||||||
|
wh2500
|
||||||
|
tto
|
||||||
|
wh2500
|
||||||
|
tpurchase
|
||||||
|
wh2500
|
||||||
|
ta
|
||||||
|
wh2500
|
||||||
|
tne
|
||||||
|
H217670
|
||||||
|
tw
|
||||||
|
wh2500
|
||||||
|
tcomputer
|
||||||
|
wh2500
|
||||||
|
tto
|
||||||
|
wh2500
|
||||||
|
tk
|
||||||
|
H282840
|
||||||
|
teep
|
||||||
|
wh2500
|
||||||
|
tw
|
||||||
|
H306340
|
||||||
|
torking
|
||||||
|
wh2500
|
||||||
|
ton
|
||||||
|
wh2500
|
||||||
|
tUnix.
|
||||||
|
wh5000
|
||||||
|
tBut
|
||||||
|
wh2500
|
||||||
|
tmanagement
|
||||||
|
wh2500
|
||||||
|
tsaid
|
||||||
|
wh2500
|
||||||
|
Clq
|
||||||
|
h4440
|
||||||
|
tNo.
|
||||||
|
H482570
|
||||||
|
Crq
|
||||||
|
h4440
|
||||||
|
n12000 0
|
||||||
|
V176400
|
||||||
|
H125000
|
||||||
|
tAround
|
||||||
|
wh2549
|
||||||
|
tthat
|
||||||
|
wh2549
|
||||||
|
tsame
|
||||||
|
wh2549
|
||||||
|
ttime,
|
||||||
|
wh2549
|
||||||
|
tthe
|
||||||
|
wh2549
|
||||||
|
tP
|
||||||
|
H241755
|
||||||
|
tatents
|
||||||
|
wh2549
|
||||||
|
tteam
|
||||||
|
wh2549
|
||||||
|
tw
|
||||||
|
H296743
|
||||||
|
tanted
|
||||||
|
wh2549
|
||||||
|
tto
|
||||||
|
wh2549
|
||||||
|
tb
|
||||||
|
H336081
|
||||||
|
tuy
|
||||||
|
wh2549
|
||||||
|
ta
|
||||||
|
wh2549
|
||||||
|
tne
|
||||||
|
H364809
|
||||||
|
tw
|
||||||
|
wh2549
|
||||||
|
tcomputer
|
||||||
|
wh2549
|
||||||
|
tto
|
||||||
|
wh2549
|
||||||
|
twrite
|
||||||
|
wh2549
|
||||||
|
tpatent
|
||||||
|
wh2549
|
||||||
|
tapplications,
|
||||||
|
wh2549
|
||||||
|
tb
|
||||||
|
H533493
|
||||||
|
tut
|
||||||
|
wh2549
|
||||||
|
tthe
|
||||||
|
wh2549
|
||||||
|
tv
|
||||||
|
H563441
|
||||||
|
tendor
|
||||||
|
wh2549
|
||||||
|
thadn'
|
||||||
|
H611350
|
||||||
|
tt
|
||||||
|
wh2550
|
||||||
|
Cfi
|
||||||
|
h5560
|
||||||
|
tnished
|
||||||
|
wh2550
|
||||||
|
tthe
|
||||||
|
wh2550
|
||||||
|
tsoftw
|
||||||
|
H687790
|
||||||
|
tare
|
||||||
|
n12000 0
|
||||||
|
V200400
|
||||||
|
H100000
|
||||||
|
tyet.
|
||||||
|
wh5000
|
||||||
|
tThe
|
||||||
|
wh2500
|
||||||
|
tUnix
|
||||||
|
wh2500
|
||||||
|
tteam
|
||||||
|
wh2500
|
||||||
|
twent
|
||||||
|
wh2500
|
||||||
|
tto
|
||||||
|
wh2500
|
||||||
|
tthem
|
||||||
|
wh2500
|
||||||
|
tand
|
||||||
|
wh2500
|
||||||
|
tsaid:
|
||||||
|
n12000 0
|
||||||
|
s9000
|
||||||
|
V227400
|
||||||
|
H120000
|
||||||
|
tHe
|
||||||
|
H130359
|
||||||
|
ty
|
||||||
|
H134274
|
||||||
|
t,
|
||||||
|
wh2250
|
||||||
|
tif
|
||||||
|
wh2250
|
||||||
|
tyou
|
||||||
|
wh2250
|
||||||
|
tb
|
||||||
|
H166593
|
||||||
|
tuy
|
||||||
|
wh2250
|
||||||
|
tus
|
||||||
|
wh2250
|
||||||
|
ta
|
||||||
|
wh2250
|
||||||
|
tne
|
||||||
|
H202611
|
||||||
|
tw
|
||||||
|
wh2250
|
||||||
|
tcomputer
|
||||||
|
H244992
|
||||||
|
t,
|
||||||
|
wh2250
|
||||||
|
twe'
|
||||||
|
H262893
|
||||||
|
tll
|
||||||
|
wh2250
|
||||||
|
tupdate
|
||||||
|
wh2250
|
||||||
|
tthe
|
||||||
|
wh2250
|
||||||
|
te
|
||||||
|
H313500
|
||||||
|
txisting
|
||||||
|
wf38
|
||||||
|
h2250
|
||||||
|
tr
|
||||||
|
H344091
|
||||||
|
toff
|
||||||
|
wf5
|
||||||
|
h2250
|
||||||
|
ttypesetting
|
||||||
|
wh2250
|
||||||
|
tsystem
|
||||||
|
wh2250
|
||||||
|
tso
|
||||||
|
wh2250
|
||||||
|
tyou
|
||||||
|
wh2250
|
||||||
|
tcan
|
||||||
|
wh2250
|
||||||
|
twrite
|
||||||
|
wh2250
|
||||||
|
tpatent
|
||||||
|
wh2250
|
||||||
|
tapplications.
|
||||||
|
n10800 0
|
||||||
|
s10000
|
||||||
|
V259800
|
||||||
|
H125000
|
||||||
|
tThat'
|
||||||
|
H146110
|
||||||
|
ts
|
||||||
|
wh3963
|
||||||
|
tho
|
||||||
|
H163713
|
||||||
|
tw
|
||||||
|
wh3963
|
||||||
|
tUnix
|
||||||
|
wh3963
|
||||||
|
tcreated
|
||||||
|
wh3963
|
||||||
|
tthe
|
||||||
|
wh3963
|
||||||
|
Cfi
|
||||||
|
h5560
|
||||||
|
trst
|
||||||
|
wf38
|
||||||
|
h3963
|
||||||
|
tnr
|
||||||
|
H277218
|
||||||
|
toff
|
||||||
|
wf5
|
||||||
|
h3963
|
||||||
|
tprogram,
|
||||||
|
wx font 40 TI
|
||||||
|
f40
|
||||||
|
h4323
|
||||||
|
tne
|
||||||
|
H342834
|
||||||
|
tw
|
||||||
|
wh3963
|
||||||
|
tr
|
||||||
|
H356907
|
||||||
|
tof
|
||||||
|
H364507
|
||||||
|
tf
|
||||||
|
f5
|
||||||
|
h1960
|
||||||
|
t.
|
||||||
|
wh6463
|
||||||
|
tLater
|
||||||
|
H398910
|
||||||
|
t,
|
||||||
|
wh3963
|
||||||
|
tthe
|
||||||
|
H417443
|
||||||
|
ty
|
||||||
|
wh3963
|
||||||
|
tupdated
|
||||||
|
wf38
|
||||||
|
h3963
|
||||||
|
tnr
|
||||||
|
H471849
|
||||||
|
toff
|
||||||
|
wf5
|
||||||
|
h3963
|
||||||
|
tto
|
||||||
|
wh3963
|
||||||
|
tbecome
|
||||||
|
wf38
|
||||||
|
h3963
|
||||||
|
ttr
|
||||||
|
H541868
|
||||||
|
toff
|
||||||
|
f5
|
||||||
|
t,
|
||||||
|
wh3962
|
||||||
|
tthe
|
||||||
|
wf40
|
||||||
|
h4092
|
||||||
|
ttypesetter
|
||||||
|
wh3962
|
||||||
|
tr
|
||||||
|
H622584
|
||||||
|
tof
|
||||||
|
H630184
|
||||||
|
tf
|
||||||
|
f5
|
||||||
|
h1960
|
||||||
|
t,
|
||||||
|
wh3962
|
||||||
|
tand
|
||||||
|
wh3962
|
||||||
|
te
|
||||||
|
H663978
|
||||||
|
tv
|
||||||
|
H668828
|
||||||
|
ten
|
||||||
|
wh3962
|
||||||
|
tlater
|
||||||
|
n12000 0
|
||||||
|
f38
|
||||||
|
V283800
|
||||||
|
H100000
|
||||||
|
tditr
|
||||||
|
H115930
|
||||||
|
toff
|
||||||
|
f5
|
||||||
|
t,
|
||||||
|
wh2500
|
||||||
|
tthe
|
||||||
|
wf40
|
||||||
|
h2850
|
||||||
|
tde
|
||||||
|
H156950
|
||||||
|
tvice
|
||||||
|
wh2500
|
||||||
|
tidenependent
|
||||||
|
wf5
|
||||||
|
h3180
|
||||||
|
tv
|
||||||
|
H236900
|
||||||
|
tersion
|
||||||
|
wh2500
|
||||||
|
tof
|
||||||
|
wf38
|
||||||
|
h2500
|
||||||
|
ttr
|
||||||
|
H282260
|
||||||
|
toff
|
||||||
|
f5
|
||||||
|
t.
|
||||||
|
n12000 0
|
||||||
|
f38
|
||||||
|
V756000
|
||||||
|
H100000
|
||||||
|
tleft
|
||||||
|
h581120
|
||||||
|
t1
|
||||||
|
n12000 0
|
||||||
|
x trailer
|
||||||
|
V792000
|
||||||
|
x stop
|
||||||
53
roff/paper.me
Normal file
53
roff/paper.me
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
.tp
|
||||||
|
.he 'left'center'right'
|
||||||
|
.fo 'left''%'
|
||||||
|
.sp 6
|
||||||
|
.ce 5
|
||||||
|
.b "Title of my paper"
|
||||||
|
.sp 2
|
||||||
|
Jim Hall
|
||||||
|
.sp
|
||||||
|
Class
|
||||||
|
.sp
|
||||||
|
Instructor
|
||||||
|
.sp
|
||||||
|
Date
|
||||||
|
.bp
|
||||||
|
.\" .ls 2
|
||||||
|
.sh 1 Introduction
|
||||||
|
.lp
|
||||||
|
One cool thing I like about the history of Unix is how
|
||||||
|
Unix developed into a document processing system.
|
||||||
|
The short history of that is the Unix team wanted to
|
||||||
|
purchase a new computer to keep working on Unix.
|
||||||
|
But management said
|
||||||
|
.q No.
|
||||||
|
.pp
|
||||||
|
Around that same time, the Patents team wanted to buy a
|
||||||
|
new computer to write patent applications, but the
|
||||||
|
vendor hadn't finished the software yet.
|
||||||
|
The Unix team went to them and said:
|
||||||
|
.(q
|
||||||
|
Hey, if you buy us a new computer,
|
||||||
|
we'll update the existing
|
||||||
|
.b roff
|
||||||
|
typesetting system so you can write patent applications.
|
||||||
|
.)q
|
||||||
|
.pp
|
||||||
|
That's how Unix created the first
|
||||||
|
.b nroff
|
||||||
|
program,
|
||||||
|
.i "new roff" .
|
||||||
|
Later, they updated
|
||||||
|
.b nroff
|
||||||
|
to become
|
||||||
|
.b troff ,
|
||||||
|
the
|
||||||
|
.i "typesetter roff" ,
|
||||||
|
and even later
|
||||||
|
.b ditroff ,
|
||||||
|
the
|
||||||
|
.i "device idenependent"
|
||||||
|
version of
|
||||||
|
.b troff .
|
||||||
|
.sh 2 Introduction
|
||||||
4
roff/shell.nix
Normal file
4
roff/shell.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [pkgs.groff];
|
||||||
|
}
|
||||||
48
scan2pdf/shell.nix
Normal file
48
scan2pdf/shell.nix
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
let
|
||||||
|
crop_ppm = (pkgs.writers.writePython3Bin "crop_ppm" {libraries = [pkgs.python3Packages.opencv4];} ''
|
||||||
|
import cv2
|
||||||
|
import sys
|
||||||
|
|
||||||
|
for path in sys.argv[1:]:
|
||||||
|
img = cv2.imread(path)[30:-30, 30:]
|
||||||
|
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||||
|
_, thresh = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)
|
||||||
|
contours, hierarchy = cv2.findContours(
|
||||||
|
thresh,
|
||||||
|
cv2.RETR_EXTERNAL,
|
||||||
|
cv2.CHAIN_APPROX_SIMPLE
|
||||||
|
)
|
||||||
|
cnt = max(contours, key=cv2.contourArea)
|
||||||
|
x, y, w, h = cv2.boundingRect(cnt)
|
||||||
|
print(path, x, y, w, h)
|
||||||
|
crop = img[y:y + h, x:x + w]
|
||||||
|
cv2.imwrite(path, crop)
|
||||||
|
'');
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
pkgs.poppler_utils
|
||||||
|
pkgs.mupdf
|
||||||
|
crop_ppm
|
||||||
|
(pkgs.writers.writeDashBin "generate" ''
|
||||||
|
set -x
|
||||||
|
pwd=$(pwd)
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
cd "$tmpdir"
|
||||||
|
[ $# -eq 1 ] || {
|
||||||
|
echo Please provide one PDF file as argument. >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[ -f "$1" ] || {
|
||||||
|
echo "$1" does not exist. >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
basename=$(basename "$1" .pdf)
|
||||||
|
${pkgs.poppler_utils}/bin/pdftoppm "$1" exploded
|
||||||
|
${crop_ppm}/bin/crop_ppm exploded*.ppm
|
||||||
|
${pkgs.imagemagick}/bin/convert exploded*.ppm "$pwd/cropped-$basename.pdf"
|
||||||
|
${pkgs.mupdf}/bin/mutool poster -x 2 "$pwd/cropped-$basename.pdf" "$pwd/split-cropped-$basename.pdf"
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
}
|
||||||
4
statistics.racket/shell.nix
Normal file
4
statistics.racket/shell.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [ pkgs.racket ];
|
||||||
|
}
|
||||||
15
statistics.racket/statistics.rkt
Normal file
15
statistics.racket/statistics.rkt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#lang typed/racket
|
||||||
|
|
||||||
|
(: sum (-> (Listof Number) Number))
|
||||||
|
(define (sum list) (foldr + 0 list))
|
||||||
|
|
||||||
|
(: mean (-> (Listof Number) Number))
|
||||||
|
(define (mean sample)
|
||||||
|
(/ (sum sample) (length sample)))
|
||||||
|
|
||||||
|
(: standard-deviation (-> (Listof Number) Number))
|
||||||
|
(define (standard-deviation sample)
|
||||||
|
(let* ((degrees-of-freedom (- (length sample) 1))
|
||||||
|
(sample-mean (mean sample))
|
||||||
|
(sum-of-squared-errors (sum (map (lambda (xi) (expt (- xi sample-mean) 2)) sample))))
|
||||||
|
(sqrt (/ sum-of-squared-errors degrees-of-freedom))))
|
||||||
51
streaming-link-bot/bot.py
Executable file
51
streaming-link-bot/bot.py
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from telegram import Update, ForceReply
|
||||||
|
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def convert_link(link: str) -> str:
|
||||||
|
if "spotify" in link:
|
||||||
|
to_service = "youtube_music"
|
||||||
|
elif "youtube" in link:
|
||||||
|
to_service = "spotify"
|
||||||
|
link = re.sub(r"//(www\.)?youtube.com", "//music.youtube.com", link)
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid streaming service: " + link)
|
||||||
|
print(f"Trying to convert {link}", file=sys.stderr)
|
||||||
|
r = requests.get(f'https://ytm2spotify.com/convert?url={link}&to_service={to_service}')
|
||||||
|
print(r.text, file=sys.stderr)
|
||||||
|
json = r.json()
|
||||||
|
print(json, file=sys.stderr)
|
||||||
|
return json["results"][0]["url"]
|
||||||
|
|
||||||
|
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
|
user = update.effective_user
|
||||||
|
await update.message.reply_html(
|
||||||
|
rf"Hi {user.mention_html()}! You can send me links to Spotify songs and I'll give you the link on YouTube Music—and vice versa.",
|
||||||
|
reply_markup=ForceReply(selective=True),
|
||||||
|
)
|
||||||
|
|
||||||
|
async def streaming_link(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
|
try:
|
||||||
|
converted = convert_link(update.message.text)
|
||||||
|
await update.message.reply_text(converted)
|
||||||
|
except Exception as e:
|
||||||
|
print(e, file=sys.stderr)
|
||||||
|
await update.message.reply_text("Cannot convert this.")
|
||||||
|
|
||||||
|
def main(token: str) -> None:
|
||||||
|
application = Application.builder().token(token).build()
|
||||||
|
application.add_handler(CommandHandler("start", start))
|
||||||
|
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, streaming_link))
|
||||||
|
application.run_polling(allowed_updates=Update.ALL_TYPES)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
token = os.getenv("TELEGRAM_TOKEN")
|
||||||
|
if token:
|
||||||
|
main(token)
|
||||||
|
else:
|
||||||
|
print("Missing TELEGRAM_TOKEN environment variable", file=sys.stderr)
|
||||||
11
streaming-link-bot/shell.nix
Normal file
11
streaming-link-bot/shell.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
(pkgs.python3.withPackages (py: [
|
||||||
|
py.yt-dlp
|
||||||
|
py.spotipy
|
||||||
|
py.ytmusicapi
|
||||||
|
py.python-telegram-bot
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
||||||
196
temperature-development/Human Development Index - Full.csv
Normal file
196
temperature-development/Human Development Index - Full.csv
Normal file
File diff suppressed because one or more lines are too long
137
temperature-development/Untitled.ipynb
Normal file
137
temperature-development/Untitled.ipynb
Normal file
File diff suppressed because one or more lines are too long
20741
temperature-development/combined_temperature.csv
Normal file
20741
temperature-development/combined_temperature.csv
Normal file
File diff suppressed because it is too large
Load Diff
12
temperature-development/shell.nix
Normal file
12
temperature-development/shell.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
(pkgs.python3.withPackages (py: [
|
||||||
|
py.jupyter
|
||||||
|
py.seaborn
|
||||||
|
py.matplotlib
|
||||||
|
py.pandas
|
||||||
|
py.numpy
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user