repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/arran4/resume
https://raw.githubusercontent.com/arran4/resume/main/README.md
markdown
# <NAME> Resume This is my attempt at a public resume / cv. An unabridged version, abridged versions might be discoverable in snapshots. If you have any suggestions, issues, and the like please raise an issue or a PR. Why else would I do this in git. You can download the latest compiled version (in PDF form) from: https://github.com/arran4/resume/releases Or build it yoursellf, you will need to install `typst` on your platform. Details on how to do that can be found here: https://typst.app/ Feel free to fork and use for your own resume, however this is based off [Modern CV](https://typst.app/universe/package/modern-cv/) so you are best to start there, however feel free to copy the github actions code for compiling on tagging: https://github.com/arran4/resume/blob/main/.github/workflows/typst.yaml For suggestions / updates etc, please create a fork and then from there create a PR.
https://github.com/WooSeongChoi/perl-5-study
https://raw.githubusercontent.com/WooSeongChoi/perl-5-study/main/chapters/chapter01/introduction.typ
typst
#set image(width: 70%) = Introduction == 얎디에 Perl을 사용하는가? === 얎디에 좋은가? - 수분 낮 빠륎게 싀행되는 것을 만듀 때 - 텍슀튞륌 닀룚는 것읎 거의 대부분읞 겜우 === 얎디에 별로읞가? - 고성능읎 필요한 ê³³ - 불투명한 바읎너늬 생성 == windows perl 섀치 #figure( image("./resource/install/01_search_google.png"), caption: [ 구Ꞁ에서 perl 검색 ] ) 구Ꞁ에서 perl을 검색핎서 Strawberry Perl을 선택한닀. #figure( image("./resource/install/02_search_older_version.png"), caption: [ 닀륞 늎늬슈 ì°Ÿêž° ] ) 추구하는 것은 대부분의 Linux distro에서 사용할 수 있는 perl 묞법읎Ʞ 때묞에 최신 버전의 perl은 플한닀. #figure( image("./resource/install/03_download.png"), caption: [ Perl 5.16 버전 닀욎로드 ] ) CentOS 7 Ʞ쀀 perl 5.16 버전읎 Ʞ볞 섀치되얎 있윌므로 핎당 버전을 섀치한닀. == IntelliJ Perl 섀정 === Perl 플러귞읞 섀치 #figure( image("./resource/intellij/plugin/01_preference.png"), caption: [ 섀정찜윌로 읎동 ] ) #figure( image("./resource/intellij/plugin/02_install.png"), caption: [ perl 플러귞읞 섀치 ] ) === Perl 프로젝튞 섀정 #figure( image("./resource/intellij/project/01_create_project.png"), caption: [ 새 perl 프로젝튞 생성 ] ) #figure( image("./resource/intellij/project/02_new_perl_project.png"), caption: [ perl 프로젝튞 선택 ] ) #figure( image("./resource/intellij/project/03_select_perl_interpreter.png"), caption: [ 로컬에 섀치된 perl 5 읞터프늬터 사용 섀정 ] ) #figure( image("./resource/intellij/project/04_define_perl_interpreter_path.png"), caption: [ perl 5 interpreter 겜로 섀정 ] ) #figure( image("./resource/intellij/project/05_define_project_name.png"), caption: [ 프로젝튞 읎늄 선정 ] ) === Perl 윔드 생성 & 싀행 #figure( image("./resource/intellij/execute/01_create_perl_script.png"), caption: [ 새로욎 perl 슀크늜튞 생성 ] ) #figure( image("./resource/intellij/execute/02_define_script_name.png"), caption: [ 슀크늜튞로 선택 & 슀크늜튞 읎늄 선정 ] ) #figure( image("./resource/intellij/execute/03_execute_script.png"), caption: [ 슀크늜튞 싀행 ] ) 자동윌로 싀행 섀정읎 생성되도록 음닚 싀행한닀. #figure( image("./resource/intellij/execute/04_select_run_config.png"), caption: [ 싀행 섀정 적용 ] ) 필요한 싀행 섀정을 적용한닀.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2980.typ
typst
Apache License 2.0
#let data = ( ("TRIPLE VERTICAL BAR DELIMITER", "Sm", 0), ("Z NOTATION SPOT", "Sm", 0), ("Z NOTATION TYPE COLON", "Sm", 0), ("LEFT WHITE CURLY BRACKET", "Ps", 0), ("RIGHT WHITE CURLY BRACKET", "Pe", 0), ("LEFT WHITE PARENTHESIS", "Ps", 0), ("RIGHT WHITE PARENTHESIS", "Pe", 0), ("Z NOTATION LEFT IMAGE BRACKET", "Ps", 0), ("Z NOTATION RIGHT IMAGE BRACKET", "Pe", 0), ("Z NOTATION LEFT BINDING BRACKET", "Ps", 0), ("Z NOTATION RIGHT BINDING BRACKET", "Pe", 0), ("LEFT SQUARE BRACKET WITH UNDERBAR", "Ps", 0), ("RIGHT SQUARE BRACKET WITH UNDERBAR", "Pe", 0), ("LEFT SQUARE BRACKET WITH TICK IN TOP CORNER", "Ps", 0), ("RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER", "Pe", 0), ("LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER", "Ps", 0), ("RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER", "Pe", 0), ("LEFT ANGLE BRACKET WITH DOT", "Ps", 0), ("RIGHT ANGLE BRACKET WITH DOT", "Pe", 0), ("LEFT ARC LESS-THAN BRACKET", "Ps", 0), ("RIGHT ARC GREATER-THAN BRACKET", "Pe", 0), ("DOUBLE LEFT ARC GREATER-THAN BRACKET", "Ps", 0), ("DOUBLE RIGHT ARC LESS-THAN BRACKET", "Pe", 0), ("LEFT BLACK TORTOISE SHELL BRACKET", "Ps", 0), ("RIGHT BLACK TORTOISE SHELL BRACKET", "Pe", 0), ("DOTTED FENCE", "Sm", 0), ("VERTICAL ZIGZAG LINE", "Sm", 0), ("MEASURED ANGLE OPENING LEFT", "Sm", 0), ("RIGHT ANGLE VARIANT WITH SQUARE", "Sm", 0), ("MEASURED RIGHT ANGLE WITH DOT", "Sm", 0), ("ANGLE WITH S INSIDE", "Sm", 0), ("ACUTE ANGLE", "Sm", 0), ("SPHERICAL ANGLE OPENING LEFT", "Sm", 0), ("SPHERICAL ANGLE OPENING UP", "Sm", 0), ("TURNED ANGLE", "Sm", 0), ("REVERSED ANGLE", "Sm", 0), ("ANGLE WITH UNDERBAR", "Sm", 0), ("REVERSED ANGLE WITH UNDERBAR", "Sm", 0), ("OBLIQUE ANGLE OPENING UP", "Sm", 0), ("OBLIQUE ANGLE OPENING DOWN", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN", "Sm", 0), ("MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN", "Sm", 0), ("REVERSED EMPTY SET", "Sm", 0), ("EMPTY SET WITH OVERBAR", "Sm", 0), ("EMPTY SET WITH SMALL CIRCLE ABOVE", "Sm", 0), ("EMPTY SET WITH RIGHT ARROW ABOVE", "Sm", 0), ("EMPTY SET WITH LEFT ARROW ABOVE", "Sm", 0), ("CIRCLE WITH HORIZONTAL BAR", "Sm", 0), ("CIRCLED VERTICAL BAR", "Sm", 0), ("CIRCLED PARALLEL", "Sm", 0), ("CIRCLED REVERSE SOLIDUS", "Sm", 0), ("CIRCLED PERPENDICULAR", "Sm", 0), ("CIRCLE DIVIDED BY HORIZONTAL BAR AND TOP HALF DIVIDED BY VERTICAL BAR", "Sm", 0), ("CIRCLE WITH SUPERIMPOSED X", "Sm", 0), ("CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN", "Sm", 0), ("UP ARROW THROUGH CIRCLE", "Sm", 0), ("CIRCLED WHITE BULLET", "Sm", 0), ("CIRCLED BULLET", "Sm", 0), ("CIRCLED LESS-THAN", "Sm", 0), ("CIRCLED GREATER-THAN", "Sm", 0), ("CIRCLE WITH SMALL CIRCLE TO THE RIGHT", "Sm", 0), ("CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT", "Sm", 0), ("SQUARED RISING DIAGONAL SLASH", "Sm", 0), ("SQUARED FALLING DIAGONAL SLASH", "Sm", 0), ("SQUARED ASTERISK", "Sm", 0), ("SQUARED SMALL CIRCLE", "Sm", 0), ("SQUARED SQUARE", "Sm", 0), ("TWO JOINED SQUARES", "Sm", 0), ("TRIANGLE WITH DOT ABOVE", "Sm", 0), ("TRIANGLE WITH UNDERBAR", "Sm", 0), ("S IN TRIANGLE", "Sm", 0), ("TRIANGLE WITH SERIFS AT BOTTOM", "Sm", 0), ("RIGHT TRIANGLE ABOVE LEFT TRIANGLE", "Sm", 0), ("LEFT TRIANGLE BESIDE VERTICAL BAR", "Sm", 0), ("VERTICAL BAR BESIDE RIGHT TRIANGLE", "Sm", 0), ("BOWTIE WITH LEFT HALF BLACK", "Sm", 0), ("BOWTIE WITH RIGHT HALF BLACK", "Sm", 0), ("BLACK BOWTIE", "Sm", 0), ("TIMES WITH LEFT HALF BLACK", "Sm", 0), ("TIMES WITH RIGHT HALF BLACK", "Sm", 0), ("WHITE HOURGLASS", "Sm", 0), ("BLACK HOURGLASS", "Sm", 0), ("LEFT WIGGLY FENCE", "Ps", 0), ("RIGHT WIGGLY FENCE", "Pe", 0), ("LEFT DOUBLE WIGGLY FENCE", "Ps", 0), ("RIGHT DOUBLE WIGGLY FENCE", "Pe", 0), ("INCOMPLETE INFINITY", "Sm", 0), ("TIE OVER INFINITY", "Sm", 0), ("INFINITY NEGATED WITH VERTICAL BAR", "Sm", 0), ("DOUBLE-ENDED MULTIMAP", "Sm", 0), ("SQUARE WITH CONTOURED OUTLINE", "Sm", 0), ("INCREASES AS", "Sm", 0), ("SHUFFLE PRODUCT", "Sm", 0), ("EQUALS SIGN AND SLANTED PARALLEL", "Sm", 0), ("EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE", "Sm", 0), ("IDENTICAL TO AND SLANTED PARALLEL", "Sm", 0), ("GLEICH STARK", "Sm", 0), ("THERMODYNAMIC", "Sm", 0), ("DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK", "Sm", 0), ("DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK", "Sm", 0), ("BLACK DIAMOND WITH DOWN ARROW", "Sm", 0), ("BLACK LOZENGE", "Sm", 0), ("WHITE CIRCLE WITH DOWN ARROW", "Sm", 0), ("BLACK CIRCLE WITH DOWN ARROW", "Sm", 0), ("ERROR-BARRED WHITE SQUARE", "Sm", 0), ("ERROR-BARRED BLACK SQUARE", "Sm", 0), ("ERROR-BARRED WHITE DIAMOND", "Sm", 0), ("ERROR-BARRED BLACK DIAMOND", "Sm", 0), ("ERROR-BARRED WHITE CIRCLE", "Sm", 0), ("ERROR-BARRED BLACK CIRCLE", "Sm", 0), ("RULE-DELAYED", "Sm", 0), ("REVERSE SOLIDUS OPERATOR", "Sm", 0), ("SOLIDUS WITH OVERBAR", "Sm", 0), ("REVERSE SOLIDUS WITH HORIZONTAL STROKE", "Sm", 0), ("BIG SOLIDUS", "Sm", 0), ("BIG REVERSE SOLIDUS", "Sm", 0), ("DOUBLE PLUS", "Sm", 0), ("TRIPLE PLUS", "Sm", 0), ("LEFT-POINTING CURVED ANGLE BRACKET", "Ps", 0), ("RIGHT-POINTING CURVED ANGLE BRACKET", "Pe", 0), ("TINY", "Sm", 0), ("MINY", "Sm", 0), )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/closure-11.typ
typst
Other
// Too many arguments. #{ let f(x) = x + 1 // Error: 8-13 unexpected argument f(1, "two", () => x) }
https://github.com/hrbrmstr/2023-10-20-wpe-quarto-typst
https://raw.githubusercontent.com/hrbrmstr/2023-10-20-wpe-quarto-typst/main/blank-test/blank-r.typ
typst
// needed for callout support #import "@preview/fontawesome:0.1.0": * // Some definitions presupposed by pandoc's typst output. #let blockquote(body) = [ #set text( size: 0.92em ) #block(inset: (left: 1.5em, top: 0.2em, bottom: 0.2em))[#body] ] #let horizontalrule = [ #line(start: (25%,0%), end: (75%,0%)) ] #let endnote(num, contents) = [ #stack(dir: ltr, spacing: 3pt, super[#num], contents) ] #show terms: it => { it.children .map(child => [ #strong[#child.term] #block(inset: (left: 1.5em, top: -0.4em))[#child.description] ]) .join() } // Some quarto-specific definitions. #show raw: it => { if it.block { block(fill: luma(230), width: 100%, inset: 8pt, radius: 2pt, it) } else { it } } #show ref: it => locate(loc => { let target = query(it.target, loc).first() if it.at("supplement", default: none) == none { it return } let sup = it.supplement.text.matches(regex("^45127368-afa1-446a-820f-fc64c546b2c5%(.*)")).at(0, default: none) if sup != none { let parent_id = sup.captures.first() let parent_figure = query(label(parent_id), loc).first() let parent_location = parent_figure.location() let counters = numbering( parent_figure.at("numbering"), ..parent_figure.at("counter").at(parent_location)) let subcounter = numbering( target.at("numbering"), ..target.at("counter").at(target.location())) // NOTE there's a nonbreaking space in the block below link(target.location(), [#parent_figure.at("supplement") #counters#subcounter]) } else { it } }) // 2023-10-09: #fa-icon("fa-info") is not working, so we'll eval "#fa-info()" instead #let callout(body: [], title: "Callout", background_color: rgb("#dddddd"), icon: none, icon_color: black) = { block(breakable: false, fill: background_color, stroke: (paint: icon_color, thickness: 0.5pt, cap: "round"), width: 100%, radius: 2pt)[ #block(inset: 1pt, width: 100%, below: 0pt)[#block(fill: background_color, width: 100%, inset: 8pt)[#text(icon_color, weight: 900)[#icon] #title]] #block(inset: 1pt, width: 100%)[#block(fill: white, width: 100%, inset: 8pt)[#body]]] } #let article( margin: (x: 1.25in, y: 1.25in), paper: "us-letter", lang: "en", region: "US", doc ) = { set page( paper: paper, margin: margin, ) set text( lang: lang, region: region, ) doc } #show: doc => article( margin: (x: 1in,y: 1in,), doc ) #set page( fill: rgb("#142933") ) #set text( fill: white, font: ("Tilt Prism"), size: 32pt ) #set align(center) This is the base for your document content. #set align(left) #set text( font: "Inconsolata", size: 12pt, ) Exercitation ullamco proident id pariatur eu magna nisi. Minim consequat minim qui pariatur commodo officia ad ea. Irure ut reprehenderit dolor eiusmod est occaecat labore fugiat. Veniam irure anim eu culpa fugiat exercitation. Non voluptate deserunt ullamco exercitation quis minim deserunt do eu dolore laboris. Aliquip fugiat aliqua proident commodo. Consequat ut aliqua fugiat ullamco deserunt adipisicing consequat. Tempor proident in cupidatat cupidatat laborum et ut et. Aliquip aute non aliquip anim sint proident ea nostrud ex voluptate. Ut sit nulla id aute et enim. Laboris amet tempor dolore aute est sint consequat. Voluptate sint cillum cillum laboris ad sint adipisicing pariatur non enim elit proident velit. Cillum cupidatat eiusmod nisi qui adipisicing aliqua esse in. In tempor ea sint pariatur ipsum ea duis. #set align(center) #v(24pt) #block[ #block[ #box([#image("blank-r_files/figure-typst/plt1-1.svg", width: 5in, height: 3in)]) ] ] #set align(left) #v(24pt) Mollit ad adipisicing non irure sit dolore irure commodo veniam proident laborum ullamco. Et officia anim sunt reprehenderit esse qui aliqua veniam amet consectetur excepteur elit culpa reprehenderit. Deserunt voluptate et laborum sint dolore cupidatat nostrud anim ut duis ea. Sunt culpa aute do minim fugiat cillum. #pagebreak() #set align(center) #set table( stroke: 0.25pt + white ) #block[ #block[ #align(center)[#table( columns: 11, align: (col, row) => (auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,).at(col), inset: 6pt, [mpg], [cyl], [disp], [hp], [drat], [wt], [qsec], [vs], [am], [gear], [carb], [21.0], [6], [160.0], [110], [3.90], [2.620], [16.46], [0], [1], [4], [4], [21.0], [6], [160.0], [110], [3.90], [2.875], [17.02], [0], [1], [4], [4], [22.8], [4], [108.0], [93], [3.85], [2.320], [18.61], [1], [1], [4], [1], [21.4], [6], [258.0], [110], [3.08], [3.215], [19.44], [1], [0], [3], [1], [18.7], [8], [360.0], [175], [3.15], [3.440], [17.02], [0], [0], [3], [2], [18.1], [6], [225.0], [105], [2.76], [3.460], [20.22], [1], [0], [3], [1], [14.3], [8], [360.0], [245], [3.21], [3.570], [15.84], [0], [0], [3], [4], [24.4], [4], [146.7], [62], [3.69], [3.190], [20.00], [1], [0], [4], [2], [22.8], [4], [140.8], [95], [3.92], [3.150], [22.90], [1], [0], [4], [2], [19.2], [6], [167.6], [123], [3.92], [3.440], [18.30], [1], [0], [4], [4], [17.8], [6], [167.6], [123], [3.92], [3.440], [18.90], [1], [0], [4], [4], [16.4], [8], [275.8], [180], [3.07], [4.070], [17.40], [0], [0], [3], [3], [17.3], [8], [275.8], [180], [3.07], [3.730], [17.60], [0], [0], [3], [3], [15.2], [8], [275.8], [180], [3.07], [3.780], [18.00], [0], [0], [3], [3], [10.4], [8], [472.0], [205], [2.93], [5.250], [17.98], [0], [0], [3], [4], [10.4], [8], [460.0], [215], [3.00], [5.424], [17.82], [0], [0], [3], [4], [14.7], [8], [440.0], [230], [3.23], [5.345], [17.42], [0], [0], [3], [4], [32.4], [4], [78.7], [66], [4.08], [2.200], [19.47], [1], [1], [4], [1], [30.4], [4], [75.7], [52], [4.93], [1.615], [18.52], [1], [1], [4], [2], [33.9], [4], [71.1], [65], [4.22], [1.835], [19.90], [1], [1], [4], [1], ) ] ] ] #set align(left) #v(24pt) Do culpa cillum nulla reprehenderit amet ipsum. Pariatur cillum amet in sint commodo sint ex ullamco deserunt est dolore sint do. Id laborum ipsum aliqua exercitation mollit in quis labore nisi minim amet ad. Ex est laborum id et reprehenderit adipisicing ullamco duis adipisicing ad deserunt cillum. Aliqua ex nulla eu mollit eiusmod qui. Reprehenderit laboris eu irure ex qui aliquip voluptate adipisicing nisi nulla tempor non exercitation. Esse ut deserunt labore enim. Magna eiusmod duis culpa id laborum cillum. Sunt sit anim ad aute incididunt nisi amet ipsum minim. Magna sint ullamco proident qui dolore ullamco elit mollit aute ut cillum. Mollit aliquip labore excepteur occaecat.
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/zalmy/Z_PaneJaVolam.typ
typst
#import "/style.typ": * #set par(first-line-indent: 1em) #subheader[Psalóm 140] #note[(... Pokračovanie)] Poloşí Hóspodi chranénije ustóm mojím, \* i dvér ohraÅŸdénija o ustnách mojích. Ne ukloní sérdca mojehó v slovesá lukávstvija, \* nepščeváti vinÃœ o hrisích. So čelovíki ďílajuščimi bezzakónije, \* i ne sočtúsja s izbránnymi ích. Nakáşet mjá právednik mílostiju, i obličít mjá, \* jeléj ÅŸe hríšnaho da ne namástit hlavÃœ mojejá. Jáko jéšče i molítva mojá v blahovolénijich ích, \* poşérty bÜša pri kámeni sudijí ích. UslÜšatsja hlahóly mojá jáko vozmohóša: \* jáko tólšča zemlí prosídesja na zemlí, rastočíšasja kósti ích pri áďi. Jáko k tebí Hóspodi, Hóspodi óči mojí, \* na ťá upovách, ne otimí duÅ¡u mojú. Sochraní mjá ot síti, júşe sostáviÅ¡a mí, \* i ot soblázn ďílajuščich bezzakónije. Pádut vo mréşu svojú hríšnicy, \* jedín jésm áz dóndeÅŸe prejdú. #subheader[Psalóm 141] Hlásom mojím k Hóspodu vozzvách, \* hlasóm mojím ko Hóspodu pomolíchsja. Prolíju préd ním molénije mojé, \* pečáğ mojú préd ním vozviščú. Vnehdá isčezáti ot mené dúchu mojemú, \* i tÃœ poznal jesí stezí mojá. Na putí sém po nemúşe choÅŸdách, \* skrÜša síť mňí. Smotrjách odesnúju i vozhÄŸadách, \* i ne bí znájaj mené. Pohíbe bíhstvo ot mené, \* i ňísÅ¥ vzyskajáj duší mojejá. Vozzvách k tebí Hóspodi rích: \* tÃœ jesí upovánije mojé, čásÅ¥ mojá jesí na zemlí şívych. Voňmí moléniju mojemú, \* jáko smiríchsja ziló. Izbávi mjá ot hoňáščich mjá, \* jáko ukripíšasja páče mené.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/bytefield/0.0.1/README.md
markdown
Apache License 2.0
# typst-bytefield A simple way to create network protocol headers in typst. Using [tablex](https://github.com/PgBiel/typst-tablex) under the hood. ## Example ![ipv4 example](https://github.com/jomaway/typst-bytefield/blob/9ef42c9472ff1d8eddb869867a45cf4af21a8478/ipv4-example.png) ```typst bytefield( bits(4)[Version], bits(4)[TTL], bytes(1)[TOS], bytes(2)[Total Length], bytes(2)[Identification], bits(3)[Flags], bits(13)[Fragment Offset], bytes(1)[TTL], bytes(1)[Protocol], bytes(2)[Header Checksum], bytes(4)[Source Address], bytes(4)[Destination Address], bytes(3)[Options], bytes(1)[Padding] ) ``` ## Usage To use this library through the Typst package manager (for Typst v0.6.0+), import bytefield with `#import="@preview/bytefield:0.0.1": *` at the top of your file. The package contains some of the most common network protocol headers: `ipv4`, `ipv6`, `icmp`, `icmpv6`, `dns`, `tcp`, `udp`. ## Features At the moment very limited features. Feel free to extend if you like. - Select the number of bits in one row. The default value is 32. `bytefield(bits: 32)` - Specify the shown bit numbers in the header through the `header` argument. Example: `bytefield(header: (0,8,16,31))` - Select the height of the rows. Default is **2.5em**. Example: `bytefield(rowheight: 20pt)` - Adding fields with a predefined length of bits or bytes. - Fields with a length greater than a row will automatically wrap. - If a field-length is the multiple of a row-length it will automatically render with a higher rowheight. Example see *Ipv6*. - Fill up the remaining space of a row with the `padding` field. - Coloring fields through the `fill` argument. For example: `bits(32, fill: red.lighten(30%))[Test]` ## Changelog ### v0.0.1 Initial Release Added `bytefield`, as main function to create an new bytefield diagram. Added `bit`, `bits`, `byte`, `bytes`, `padding`, as high level API for adding fields to a bytefield. Added `flagtext` as a utility function to create rotate text for short flag descriptions. Added `ipv4`, `ipv6`, `icmp`, `icmpv6`, `dns`, `tcp`, `udp` as predefined diagrams.
https://github.com/StanleyDINNE/php-devops-tp
https://raw.githubusercontent.com/StanleyDINNE/php-devops-tp/main/documents/Rapport/Typst/Template_default.typ
typst
#import "Util.typ": to_string, add_title, insert_code-snippet #let __constants_toml = toml("__private_tools/constants.toml") #let __local_placeholder_constants = ( title: "Title", authors: "", context: none, date: datetime.today().display(), header_logo: none, ) #let set_config_header_footer( title: __local_placeholder_constants.title, authors: __local_placeholder_constants.authors, context: __local_placeholder_constants.context, date: __local_placeholder_constants.date, header_logo:__local_placeholder_constants.header_logo, document_ ) = { let h_f_content( side, content, color: rgb(__constants_toml.color.header_footer_grey) ) = align(side, text( weight: "thin", size: __constants_toml.size.foot_head * 1pt, fill: color )[#content] ) set page( header: grid( columns: (15%, 70%, 15%), h_f_content(left + horizon, date), h_f_content(center + horizon, header_logo), h_f_content(right, [by #authors]), ), footer: grid( columns: (20%, 60%, 20%), h_f_content(left + horizon, par(justify: false)[#text(hyphenate: false)[#context]]), h_f_content(center + horizon, par(justify: false)[#text(hyphenate: false)[#title]]), h_f_content(right + horizon, counter(page).display("1/1", both: true), color: black), ) ) document_ } #let set_config_document_style(document_) = { // set heading(numbering: "1.1 " + str.from-unicode(__constants_toml.char.em-dash)) set heading(numbering: (..nums) => { nums.pos().map(str).join(".") }) set par( first-line-indent: 2em, justify: true ) set text(lang: "fr") show link: underline // Thx to https://github.com/typst/typst/discussions/2812#discussioncomment-7721649 show heading: h => { let number_dash = if h.numbering != none { [#counter(heading).display() #str.from-unicode(__constants_toml.char.em-dash) ] } else { [] } pad(left: 1em * (h.level - 1), [#number_dash#h.body]) + text(0pt, white)[.] } document_ } #let set_config( title: __local_placeholder_constants.title, title_prefix: "Homework #?: ", authors:__local_placeholder_constants.authors, context:__local_placeholder_constants.context, date: __local_placeholder_constants.date, image_banner: none, header_logo: none, document_, ) = { set document(title: to_string[#title], author: authors) document_ = [ #image_banner #add_title[#title_prefix#title] #document_ ] document_ = set_config_document_style[#document_] document_ = set_config_header_footer( title: title, authors: authors, context: context, date: date, header_logo: header_logo, )[#document_] document_ }
https://github.com/morrisLuke/typst_quarto_barebones_report_template
https://raw.githubusercontent.com/morrisLuke/typst_quarto_barebones_report_template/main/typst-show.typ
typst
#show: psc-report.with( $if(title)$ title: "$title$", $endif$ )
https://github.com/gomazarashi/typst_slydst
https://raw.githubusercontent.com/gomazarashi/typst_slydst/main/example.typ
typst
#set text(lang: "ja") // 蚀語を日本語に蚭定 #set text(font: ("Yu Gothic")) // フォントを蚭定 #set heading(numbering: none) #import "@preview/slydst:0.1.1": * #import "@preview/codelst:2.0.1":* #import "@preview/showybox:2.0.1":* #show: slides.with( title: "Typstでスラむドを䜜成する ", // 必須 authors: ("ごた"), date: [#datetime.today().display()], subtitle: "slydstで手軜に静的スラむドを䜜ろう", layout: "medium", ratio: 4 / 3, title-color: none, ) == showyboxを䜿っおみる #v(10%) #showybox(title: "Green's Theorem", frame: ( border-color: olive, title-color: olive.lighten(10%), body-color: olive.lighten(95%), footer-color: olive.lighten(80%), ), footer: "蚌明は省略する。")[ 閉曲線$C$で囲たれた領域$D$においお、$C^1$玚関数$P(x,y)$ず$Q(x,y)$に察しお、以䞋が成り立぀。 $ integral.cont_C (P dif x + Q dif y ) = integral.double_D ((diff Q)/(diff x)-(diff P)/(diff y)) dif x dif y $ ]
https://github.com/valentinvogt/npde-summary
https://raw.githubusercontent.com/valentinvogt/npde-summary/main/src/colors.typ
typst
#let darkmode = "false" #let page-color = white #let text-color = black #let brown-box = rgb(255, 236, 217) #let tip-stroke = rgb(170, 170, 200) #let unimportant-color = rgb("f6f6f6") #let link-color = blue.darken(30%) #if darkmode == "true" { page-color = rgb(39, 43, 50) text-color = white brown-box = rgb(80, 80, 80) tip-stroke = rgb(70, 70, 100) unimportant-color = gray link-color = blue.lighten(40%) }
https://github.com/Robotechnic/diagraph
https://raw.githubusercontent.com/Robotechnic/diagraph/main/examples/test.typ
typst
MIT License
#import "@preview/diagraph:0.3.0": * #let labels = ( "a" :$1$, "b" :$2$, "c" :$3$, "d" :$4$, "e" :$5$, "f" :$9$, "g" :$10$, "h" :$11$, "i" :$12$, "j" :$13$, "k" :$14$, "l" :$15$, "m" :$19$, "n": $20$, "p" : $50$ ) #let graph = (nodes) => { let result = "digraph {" for (i,n) in nodes.keys().enumerate() { for m in nodes.keys().slice(i) { result += n.at(0) + " -> " + m.at(0) + ";" } } render(result + "}", labels: nodes, width: 100%) } #for i in range(2, labels.len()) { for j in range(0, labels.len() - i) { graph(labels.keys().slice(j, j + i).fold(("z":"2"), (acc, e) => { acc.insert(e, labels.at(e)); acc })) } }
https://github.com/rayfiyo/myTypst
https://raw.githubusercontent.com/rayfiyo/myTypst/main/mystyle_report/main.typ
typst
BSD 3-Clause "New" or "Revised" License
#import "./template.typ": * #import "@preview/codelst:2.0.0": sourcecode, sourcefile, lineref, code-frame #show: cover.with( number: "7", title: "Typstで曞く修論のテンプレ", id: "12-34567", author: "右埀 巊埀", university: "東京倧孊倧孊院", school: "工孊系研究科", department: "航空宇宙工孊専攻", mentor: "魚 ç«¿", room: "すごい実隓宀", // // Experiment environment exp_year: "", exp_month: "", exp_day: "", exp_day_of_week: "月", // weather: "晎れ", temperature: "23", humidity: "70", atmospheric_pressure: "1024", // group: "", member1: "hoge1", member2: "hoge2", member3: "hoge3", member4: "hoge4", member5: "hoge5", member6: "hoge6", // purpose: [ 実隓の目的ずはなんだろうか数行皋床で圓たれられるこずが倚い ], // abstract_ja: [ 近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っこの分の最埌""でちょうど200文字になりたす 近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っ.この分の最埌""でちょうど400文字になりたす ], bibliography-file: "references.bib", ) // #show: master_thesis.with( // title: "Typstで曞く修論のテンプレ", author: "右埀 巊埀", university: "東京倧孊倧孊院", school: "工孊系研究科", department: "航空宇宙工孊専攻", id: "12-345678", mentor: "魚 ç«¿", mentor-post: "准教授", class: "修士", member: "hoge男", abstract_ja: [ // 近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っこの分の最埌""でちょうど200文字になりたす // 近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っおほんたすごい近幎の宇宙っ.この分の最埌""でちょうど400文字になりたす // ], bibliography-file: "references.bib", // ) /* = 実隓目的 = 実隓原理 = 実隓方法ず手順 = 䜿甚噚具 = 実隓結果 = 考察 // = 参考文献 // 自動生成 = チヌトシヌト == コヌドブロック #sourcecode(numbers-start: 1)[```c #include <stdio.h> int main() { printf("Hello, World!\n"); return 0; } ```] // #sourcefile(read("ぱす"), file:"ファむル名") == 匕甚 @ss8843592 == 数匏 $ A = mat(1, 2;3, 4) $ <eq1> @eq1 を衚瀺 == 画像 #img( image("appendix/images/ladder.svg", width: 20%), caption: [オリゞナルのThe Go gopherGopherくんは、Renée Frenchによっおデザむンされたした。], ) <img1>\ @img1 を衚瀺 == è¡š #tbl(table( columns: (7em, auto), // columns: 2, なども可 align: (left, left), // [名称], [倀], // [A], [2], // [B], [6], // ), caption: [テヌブル]) <tbl1> @tbl1 を衚瀺 == URL埋め蟌み #link("https://typst.app/docs")[公匏ドキュメント] == 定理 #let theorem = thmbox("theorem", "定理", base_level: 1) #theorem("ヲむラ-")[ Typst はすごいのである. ] <theorem> == 補題 #let lemma = thmbox("theorem", "補題", base_level: 1) #lemma[ Texはさようならである. ] <lemma> == 定矩 #let definition = thmbox("definition", "定矩", base_level: 1, stroke: black + 1pt) #definition[ Typst is a new markup-based typesetting system for the sciences. ] <definition> */
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.3.0/src/lib.typ
typst
Apache License 2.0
#import "version.typ": version #import "canvas.typ": canvas #import "draw.typ" // Expose utilities #import "vector.typ" #import "matrix.typ" #import "styles.typ" #import "coordinate.typ" #import "intersection.typ" #import "drawable.typ" #import "process.typ" #import "util.typ" #import "path-util.typ" #import "mark.typ" #import "mark-shapes.typ" // Libraries #import "lib/palette.typ" #import "lib/angle.typ" #import "lib/tree.typ" #import "lib/decorations.typ" // Stubs #import "lib/plot-stub.typ" as plot
https://github.com/totikom/slides
https://raw.githubusercontent.com/totikom/slides/main/2024-05-01-turing-blockchain/colors.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#let background-color = rgb("#111122") #let text-color = rgb("#dddddd") #let dim-text-color = text-color.darken(30%)
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/docs/thinking-ide.md
markdown
Apache License 2.0
I have implemented nearly all LSP features. The implementations are incomplete but bring some insights. The requirement of analysis may unveil some shortcomings to building incremental analysis (computation) for typst-ide with existing crates, e.g. comemo. First, to get LSP features, we have two approaches to extract information from Typst's source code: - dynamic analysis, that triggers `analyze_{expr,import,...}`, which is heavily used by current typst-ide. - static analysis, which iterates `SyntaxNode/`LinkedNode/Content/Frame`, which is also used by the current typst-ide but no cache is taken. I list some typical ways to get LSP features. "Go to function definition" can be implemented partially with dynamic analysis, but "Go to variable definition" looks impossible, so we need to have static analysis eventually. "Go to references" initially acquires both dynamic and static analysis. "Inlay hint" can be easily implemented with dynamic analysis, but it has really poor performance since a single inlay hint request triggers many compilations. The dynamic analysis part in Typst is attractive in comparison with other programming languages from my view. We can usually get nice and wonderful analysis results (autocompletion) by tracking some span to get corresponding values dynamically, but it is not perfect. - Lossy information: For a non-function value, we cannot track its definition (assignment) site currently. - Performance overhead: A single compilation is proven to be fast, but to get the best analysis result we may trigger multiple times of compilation and get exhausted memory and long time (observed in implemented inlay hint and goto references feature). My solution is to introduce more static analysis and cache them heavily. But I find it problematic to build one with comemo. There are limitations observed for implementing performant static analysis. - Bad performance is caused by hashing, especially on recursive structures. comemo compares input and constraints by hash, which is inefficient enough. I encounter the following cases frequently: ```rs #[comemo::memorize] fn analyze(input: SomeRecursiveStructure) -> Output {} ``` It is elegant, but causes poor performance frequently, as the CPUs are tired of calculating hashes on the recursive structures repeatedly. Specifically, the leaf will be hashed by `O(d)` times, where `d` is the number of wrapped `LazyHash` from the root node to the leaf node. Even though we have `LazyHash`, the overhead is not acceptable when the calculation is cheaper than hashing the input. - Lack of revision management (comemo is global), hence causing poor memory efficiency. Now we have a keep-running compilation task along with multiple incoming IDE tasks at some random times, how do we run the global `comemo::evict` for best performance? When we trigger `comemo::evict` frequently for each IDE task, the compilation caches all go away. - Cannot do task cancellation when analyses are nested by `comemo::memorized`: - When some expensive analysis task is running in the background, how do we cancel if it is nested in deep `comemo::memorized`? The cancellation will cause "side effects". - This problem also occurs with a long-time compilation for canceling. I compared salsa (used by rust analyzer) and comemo, and found salsa solves some problems, but I'm not yet sure whether we should use salsa for caching analyses and It is also not actively maintained. --- I think we have reached some consensus and can land a basic go-to definition feature. For the comemo part, we can just keep discussing and seek opportunities for optimization if possible. > I think by extending Scope (storing a span) and the Tracer a bit, we could maybe solve that. Though intra-file go-to-definition is also fairly simple on the syntax tree I think, and more efficient. So, we could also go with a hybrid approach: Intra-file syntax-based and inter-file using dynamic analysis on the module and checks the span in the Scope. This is what I'm doing. The approach may not fit in some other LSP features, but is totally fine with a go to definition feature. We can forget other features first. > Maybe we can let the Tracer trace more things in a single compilation, so that you can run various analyses at once? We can do it, but I'm worrying whether it will affect performance on regular compilation. Furthermore, there are some cases will extremely extend time to dynamic analysis. I can give a simple example: ```js for i in range(5000000) {} ``` When you try to get a `typst::foundations::Func` instance for the `range` function by `analyze_expr`, it will cost 11s on my computer! IMO we should prefer static analysis whenever possible, even if the dynamic analysis is quite wonderful, as we may not like to get user reports that they randomly click some identifier for definition and the browser stucks or crashes... The performance and static analysis are usually more reliable and predictable. > If you have intermediate LazyHash structures, every leaf should be hashed just once For example, let's think of an extreme case: `pub enum Either { A(Box<Either>), B }`, and the analysis: ```rs #[comemo::memorize] fn analyze(input: Either) -> Output {} ``` We have several simple options: + doesn't use lazy hash inside `pub enum Either { A(Box<Either>), B }`, then the `analyze` function will have poor performance when the `Either` is big. + intrude a lazy hash inside `pub enum Either { A(Box<LazyHash<Either>>), B }`, then the `analyze` function will trigger for `d` times if the depth of `B` is `d`. + add an extra variant, and make a "HashA" when it is big enough `pub enum Either { A(Box<Either>), B, HashA(Box<LazyHash<Either>>) }`. it is possible but not operatable for me. Overall, I feel salsa's intern-based solution is more efficient for comparing and computing many small inputs than comemo's hash-based solution. > That's a problem indeed. If you have any proposals how we could extend comemo to make eviction smarter, I'd be interested to hear them. Maybe we can steal some stuff from salsa here, e.g. the durability concept. > Yeah, I think that's a more fundamental problem. Maybe we could build some cancellation feature into comemo. How big is this problem in practice? Do you frequently notice a lack of cancellation or would it just be cleaner to be able to do it? > I looked at salsa before building comemo. Maybe I just didn't "get it", but it felt a lot more complicated and it also forces you to write the compiler in a very specific way. Do you think there are some things to its approach that are fundamentally impossible in the comemo approach, rather than just not implemented? I believe you have investigated salsa and there should be wonderful stuff to steal, for example, the durability concept, which also looks matter for optimizing the performance when the incoming events are mostly user editions. I mentioned these Cons of comemo, because I want to let you know which problems I've encountered when I try to cache static analysis with comemo. We can revisit them when they're becoming a big problem during building our LSP/IDE features.
https://github.com/loreanvictor/master-thesis
https://raw.githubusercontent.com/loreanvictor/master-thesis/main/thesis_typ/acknowledgement.typ
typst
MIT License
#let acknowledgement() = { set page( margin: (left: 30mm, right: 30mm, top: 40mm, bottom: 40mm), numbering: none, number-align: center, ) let body-font = "New Computer Modern" let sans-font = "New Computer Modern Sans" set text( font: body-font, size: 12pt, lang: "en" ) set par(leading: 1em) // --- Acknowledgements --- align(left, text(font: sans-font, 2em, weight: 700,"Acknowledgements")) text[ I would like to sincerely thank my supervisor Prof. Dr. <NAME> for providing me with this opportunity and guiding me along the way. I would also like to thank members of the Artemis team for their direct and indirect help and support throughout this thesis, and for enabling such a vibrant environment where a constant influx of passionate students can contribute to real-world projects through their work and research. I would like to specifically mention members of the Apollon team <NAME> and <NAME> for their continuous support and feedback. I would also like to express my sincere gratitude to my family and friends for their ever-present support and encouragement throughout my studies, specifically my fiancee Dr. <NAME> for accompanying me on this journey and making it a lot more enjoyable and memorable. ] v(15mm) }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/037%20-%20Ravnica%20Allegiance/007_The%20Gathering%20Storm%3A%20Chapter%2013.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Gathering Storm: Chapter 13", set_name: "Ravnica Allegiance", story_date: datetime(day: 04, month: 09, year: 2019), author: "<NAME>", doc ) Vraska looked down at her map, inked lines on parchment covered in pencil cross-hatching. Just lines on paper, for now. But what they represented . . . #emph[You are distressed, friend-Vraska] , Xeddick projected into her mind. Vraska leaned back in her throne of petrified bodies, now heavily cushioned and much more comfortable. She let her head rest on the thick pillow that covered the screaming face of a shadow elf, and looked up into the vaulted ceiling. Light-globes hung at intervals, glowing softly with bioluminescence, suspended in vast mats of cobweb. Vraska closed her eyes and pressed her fingers to her forehead. Her skull ached, and the tendrils on her head hung limp and lifeless. #emph[You must rest] , Xeddick said, moving forward from the shadows beside the throne. Aside from a few Erstwhile guards, he was the only one in the throne room. She’d banished everyone else the night before. #emph[You push yourself too hard.] "It’s all I can do," Vraska muttered, and shook her head. She sat up and looked across at the albino kraul. He was small for his race, his fluttering wings weak and useless, but his mind was extraordinary. #emph[And he cares about me.] That, these days, was a rare commodity. "Sorry. You’re right. I just . . ." She gestured at the map. #emph[You plan for the attack of the surface dwellers] , Xeddick said. #emph[You are certain they are coming?] "They’re coming," Vraska said grimly. "<NAME> won’t give up. It’s not in his nature." Her lip twisted. "One of his more charming qualities." #emph[Then they will come] , Xeddick said. #emph[And you will defeat them.] She could feel his total confidence, and it made her wince. "There’ll be a cost, and your people will bear the brunt of it." #emph[There is always a cost, friend-Vraska. And my people owe you more than we can possibly repay. We will take the burden, and gladly.] "Mazirek may not agree." #emph[Mazirek has grown apart from the rest of the kraul] , Xeddick said. He sounded uncertain—it wasn’t in his nature to criticize. #emph[He has become . . . proud. He has forgotten the purpose of all kraul is to serve the hive. It is the hive that endures, when the individual fails.] #emph[Exactly] , Vraska thought. She flung the words into the depths of her own mind, where she had a nasty feeling that she’d find Jace looking back at her. #emph[I did what I had to do for the Golgari. These are my people, my responsibility. I have to protect them better than Jarad, so no one has to suffer what I did.] Prison, torture, and nearly death, for no better reason than that she’d been born a gorgon. #emph[And besides.] Vraska forced a smile, showing pointed teeth. #emph[I enjoyed it.] Watching the great sphinx Isperia—the judge who’d destroyed her life with a casual signature on a form—harden into lifeless stone. #emph[I should have done that a long time ago.] Xeddick shifted uneasily. #emph[Friend-Vraska] , he said, #emph[the guards have captured an intruder.] "Another assassin?" Vraska looked down at the throne. "I don’t need him for the throne. Have them toss him—" #emph[Pardon, but it does not appear to be an assassin. She claims to be an emissary from the Rakdos.] "From #emph[Rakdos] ?" Vraska frowned. "Bring her in." A few moments later, a pair of Erstwhile came in, escorting a bedraggled figure in a patchwork leather bodysuit, soaked to the skin. Water had washed the paste from her hair, leaving it lying flat and dripping. "Hekara," Vraska said, with a sigh. "Vrasky!" Hekara said, bouncing and spattering water everywhere. "What happened to you?" Vraska said. "Fell in the moat," Hekara said promptly. "The moat is full of crocodiles," Vraska said. "Found that out," Hekara said, still grinning. "Bitey!" Vraska shook her head, tendrils curling in amusement. "Does Ral know you’re here?" "No," Hekara said. "I just wanted to talk." She bit her lip, then looked at the guards and Xeddick. "Leave us," Vraska said. "You as well, Xeddick. I’ll speak with you later." The kraul bent his front legs in his species’ version of a bow and withdrew, the shuffling Erstwhile following after. Hekara, still dripping, skipped up toward the throne. "I like what you’ve done with the place," she said. "Very #emph[you] , you know?" She bent to examine one of the twisted statues that made up the throne. "Nice chair, too. Must be tough to chisel out all the fiddly bits." "That was . . . not a problem," Vraska said, grinning in spite of herself. "What are you doing here, Hekara? Have you come to speak on behalf of Rakdos?" "Nope. His Flaminghood is right pissed at you for the whole . . . thing. Doesn’t like being betrayed, he says, which is weird because he’s always betraying everybody else, right? Demons!" She laughed, though it sounded a little forced. "I’m not here on anyone’s behalf. Just mine." "All right," Vraska said. "What is it you want to say?" "I’ve thought about what happened," Hekara said. "An’ I think you should come back." "Come back," Vraska said, deadpan. "Yeah." Hekara bounced on the balls of her feet. "‘Cause we’re mates. You and me and Ral. We shouldn’t be fighting each other." "Ral is probably . . . ‘right pissed’ at me as well." "Eh. He’ll get over it." Hekara waved a hand. "He’s got a new thing which I’m not supposed to talk about, which is okay because it doesn’t make much sense to me, and he gets on these long tangents when he hasn’t gotten enough sleep and starts drawing on the walls, and now I think I’m lost and I forgot what I was saying. But #emph[anyway] you should come back because we’re mates and I’ve got no hard feelings and he’ll stop being mad eventually." "That’s quite an offer," Vraska said, leaning back in her throne again. "I thought so," Hekara said. "So you’ll come?" "Unfortunately, I don’t think it’s that simple." Hekara’s brow creased. "Why not?" "I have . . . responsibilities." "Burn ’em!" Hekara said promptly. "Burn—" Vraska shook her head. "Burning solves most things, I find," Hekara said. "It’s not . . ." Vraska took a deep breath. "The Golgari need me. I have a duty to protect them." "My old teacher used to say, you’ve got three duties. Listen to your boss, look after your mates, and look after yourself." Hekara cocked her head. "You #emph[are] the boss, so that’s number one taken care of. You can bring your bug-friend with you if you want. I’ll keep him in my room. Nobody will find out." "I can’t, Hekara," Vraska said, gently. "But you can’t stay here." Hekara’s lip quivered. "Or else you’ll end up fighting Ral. And you’re #emph[mates] . I tried to tell him the same thing, but he wouldn’t listen. He’s got that dragon for a boss, though, and you don’t, so I thought . . ." #emph[I have another dragon entirely.] Vraska kept the thought to herself. #emph[Even if I didn’t have Bolas, I’d still have the Golgari people to answer to.] "I’m sorry," Vraska said. "You’re #emph[stupid] ," Hekara said, stomping her foot. "And so is Ral. You don’t #emph[understand] ." She spun on her heel and stalked out, leaving a trail of damp footprints. A few moments later, Xeddick reappeared. #emph[Your visitor has fallen in the moat again] , he said. "Fish her out," Vraska said. "And make sure she gets back to the surface safely." It was the least she could. #emph[The only thing I can do.] #emph[And the defenses?] the kraul said, gesturing at the map with a forelimb. "Tell Mazirek and his people to start laying them out," Vraska said. "As quickly as he can. We don’t have much time." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Kaya followed <NAME> to Teysa’s office, walking down the elegantly furnished hallways of the most privileged parts of Orzhova. Up here, it definitely looked more like a bank than a church, with frowning portraits of past Orzhov notables on every wall, gilt furnishings, and lots of marble. Tomik paused in front of a set of double doors carved with an elaborate frieze, and Kaya came to an awkward halt beside him. #emph[If I’m the guildmaster] , she thought, #emph[why do I feel like I’m the one getting called on the carpet?] Tomik rapped lightly on the wood. Teysa’s voice came from inside. "Yes?" "I’ve brought the guildmaster, <NAME>, as you asked." "Of course. Come in." There was a coldness in Teysa’s words that Kaya didn’t like the sound of. They entered. Teysa’s office was almost entirely marble, with a fire roaring in a massive hearth that made it nearly stifling. Tall, narrow windows occupied the wall behind the great hardwood desk, lashed by rain. Lightning flashed from cloud to cloud outside, and Kaya heard a low roll of thunder. Teysa, sitting between two stacks of large, leather-bound books, looked up from the ledger she’d been writing in and gave a humorless smile. "Guildmaster," she said. "Um . . . Teysa." Kaya wasn’t sure of her official title. "How’s it going?" "I have been going over the numbers," Teysa said, gesturing at the books. "I can see." Kaya glanced at Tomik, who’d taken an unobtrusive place in the corner. "I thought you had people for that?" "The leader of the Orzhov—the #emph[guildmaster] —should have a personal appreciation of the state of our accounts. We are, after all, a bank. The balance of our assets against outstanding obligations is a matter of grave concern." "Right." Kaya shrugged. "Look, we both know that’s not something #emph[I’m] going to be able to do, so if that’s what this is about—" Teysa looked up, expression cold with suppressed anger. "I #emph[am] aware of that. In fact, you agreed to stay well away from Orzhov policy as guildmaster, and leave those matters to me. But now . . ." She tapped her finger on the ledger. "The numbers don’t add up." Kaya feigned confusion. "I don’t understand." "Let me make it simple, then. You’ve been forgiving debts, without consulting me or any other Orzhov official." "I . . ." #emph[Hell with it.] Kaya shook her head. "All right, so what if I have? It hasn’t been that many—" "Sixty-seven people, to date. To a total value of two hundred forty-six thousand three hundred twelve zinos net present value, assuming . . . well, any number of things." "I’m sure the Orzhov can afford it," Kaya said. "I can #emph[feel] our contracts, remember. These are only a tiny fraction of them." "Whether we can #emph[afford] it is not the point," Teysa said, her voice rising. "You promised me you would keep out of Orzhov business." "It doesn’t matter if I #emph[want] to stay out of it, or what we agreed to," Kaya said. "You told all these people that I’m the guildmaster. Can you blame them when they treat me like it?" "I’m not blaming #emph[them] . Just tell them no!" Kaya felt her anger rising. "Why? So you can keep extracting debts from their great-grandchildren?" Teysa’s pale face colored. "Every contract the Orzhov enter into is in accordance with Ravnican law, and voluntary on both sides. We are only enforcing our rights." "Sure. Some poor bastard wants to pay a doctor to help his wife, and that gives you the #emph[right] to work his family like slaves for the next three generations." "He was told the terms. He could always choose not to sign—" "And let his loved ones die." Kaya shook her head. "Don’t you understand that what you’re doing to these people is wrong?" "We aren’t doing anything!" Teysa said. "Whatever happens to them, they bring on themselves. We only . . . facilitate." They stared at one another for a long moment. Teysa had her hands flat on the ledger, breathing hard. Kaya grit her teeth. "Regardless of your . . . scruples," Teysa said, in careful tones, "as a practical matter we cannot simply forgive our debtors. The Orzhov has obligations of our own, and we must have income to meet them. If we were to default, the consequences for Ravnica would be incalculable." "Just because you’ve tied yourself in a knot doesn’t mean you have to keep pulling it tighter," Kaya said. "It doesn’t mean you can’t try to work yourself loose, a little at a time." "Kaya . . ." Teysa put her hand to her forehead. "If we did what you wanted, then it would mean the destruction of the guild." "If the guild depends on enslaving children for the debts of their fathers, then maybe it deserves to be destroyed." "I hope those words won’t leave this room," Teysa said, with a sharp glance at Tomik. "Or I won’t be responsible for the consequences." "Very subtle," Kaya said. "I am trying to #emph[help] you. All you have to do is . . ." Teysa waved a hand vaguely. "Nothing. Sit on the throne and mouth a few empty platitudes. Wave at official functions. When our lawmages figure out how to extract you from our obligations, you will be free to go, with my blessing. Until then—" "Until then, I just let everyone think I’m okay with being the head of this organization?" Kaya heard her own voice rising. She hadn’t realized, until that moment, how strongly she felt. "However it happened, I have the power to change things for the better here. Don’t tell me not to use it." "Apparently, I can’t tell you anything," Teysa said. "Except that you should watch your back." "Fortunately for all of us," Kaya snapped, "I’m good at that." She got to her feet and stalked away. Tomik hurried over, to open the double doors, but Kaya simply strode through them in a burst of purple light. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) For Ral, the apartment in Dogsrun was supposed to have been a refuge. Unfortunately, at the moment, it felt like that refuge was under siege by the rest of Ravnica. He let himself in, a few drops of rain spattering around him, and slammed the door against the driving wind. Thunderstorms usually made him feel a kind of euphoria. All that power, coursing freely through the air, brilliant streams of energy writing themselves across his skin in trails of fire. He could reach out and touch it, taste it, smell the ozone heat. Now, though . . . #emph[It’s not enough.] Lightning bolts could crack stone and melt steel. But they couldn’t make the wheels of bureaucracy grind faster, or triangulate resonators more accurately, or align mizzium coils. #emph[They can’t make a bunch of bloody idiots do what they’re told.] They were making progress. The resonators were going up, all across the Tenth District, humming, spinning contraptions of mizzium, crystal, and steel. Each had to be painstakingly sited, then adjusted so that its main coils rotated with just the correct frequency and direction with respect to its fellows. Done properly, they would form a network, amplifying and altering the magical field of the Guildpact just enough that Niv-Mizzet could get what he wanted. One mistake, though, and all their efforts would be worse than useless. The resonators would fail, or worse. The potential power of a destructive resonance was devastating. Ral had neglected to mention that to the other guilds, when he’d been explaining the plan. #emph[But if we fail, none of it matters.] He could almost feel Bolas’s hot breath on the back of his neck. The dragon was #emph[coming] , closer and closer, and if the resonators weren’t ready in time then the only thing that would stand between him and Ravnica would be the Beacon, Niv-Mizzet’s desperate backup plan. #emph[Shouting into the void, and hoping somebody answers.] Ral shuddered. #emph[If we have to rely on ] that#emph[, then we’re probably doomed.] The lock clicked, and Ral realized he was still leaning against the door. He stepped out of the way before it opened again to reveal Tomik, huddled under a wet raincoat and clutching a paper sack. He raised an eyebrow at Ral and adjusted his glasses. "Um. I brought curry?" he said. "The kind you like. Can I come in?" Ral realized he was still standing in the doorway, and hurriedly stepped aside. "Sorry." "It’s all right," Tomik said, coming inside. "It’s not like it’s absolutely pouring. Not all of us have our own personal magical umbrella, you know?" "Even I get wet on days like this," Ral groused. "Too much wind." "You have my utmost sympathy." Tomik tossed the bag of curry on their little table. He took off his rain-spotted glasses, went to wipe them on his shirt, and stopped when he found it already soaked. "Have you got a—" Ral came up behind him and put a hand on his shoulder, turning him round. Before Tomik could finish the sentence, he kissed him, with all the pent-up frustration and worry of the past few days. Tomik stumbled back a step, against the wall, and Ral pressed hard against him. "—towel?" Tomik finished weakly, when Ral finally pulled away for a moment. He took a deep breath. "The curry . . ." "Later," Ral growled. "Later," Tomik agreed, laying his glasses carefully on the table. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Later arrived, as it tends to do, with depressing haste. "I know what #emph[I’m] worried about," Ral said. They were in the bedroom, and he was pacing in front of the broad window. Lightning flashed on the horizon, connecting some tower to the sky for a moment, and Ral raised his hands and let an answer crackling walk across his knuckles. He ran one hand through his sweat-damped hair and let a crackle of electricity restore its frizz. "What’s eating #emph[you] ?" "Who says anything’s eating me?" Tomik muttered. He was still lying in bed, his lanky frame covered only by a thin bedsheet. Ral watched his reflection in the window with an appreciative eye when he rolled over and sighed. "You’re sulking," Ral said. "I’m not sulking, I’m thinking," Tomik said. "You might try it sometime." "Fine," Ral said. "So what are you thinking?" "Guild business," Tomik said, and sighed. Ral looked over his shoulder. Tomik’s brow was creased, and for a moment Ral wanted to push him further. But they’d always kept their respective positions out of their relationship, and while Ral’s circumstances had changed—#emph[if I succeed, no one in Izzet would dare challenge me, and if I fail, it won’t matter] —Tomik’s had only gotten more confused, with his master Teysa now serving under the Planeswalker Kaya. "You know you have my help, if you need it," Ral said, after a moment of silence. "Thank you." Tomik sat up and fumbled for his glasses. "It’s . . . complicated." "I’m sure." Ral cocked his head. "Curry?" "Curry," Tomik agreed. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em)  #linebreak "The Gruul have stepped up their attacks across the Tenth District," Aurelia said. Her glowing eyes were hard to read, but Ral thought there was a hint of concern on even the angel’s beatific face. "Our garrisons along the rubblebelts are assailed almost daily. There are more of them then we imagined, and they’re better organized. It is regrettable you did not capture this Domri; his leadership appears highly capable." "Apologies," Ral said. "We were a little bit busy. How is <NAME>, by the way?" "Injured, but she will recover." Aurelia inclined her head at the map on the war room table. "Unfortunately, I fear our contribution to your effort against the Golgari will be less than I initially anticipated." "Understandable," said <NAME>. "The Senate will provide what it can, as I promised, but our numbers are limited." "I’ve spoken with the Firemind about employing some of our more . . . effective assets for the attack," Ral said. "But with the need to build and protect the resonators, we’re spread thin as well." "I was under the impression that Rakdos would be contributing to the effort," Aurelia said. "So was I," Ral muttered under his breath. He hadn’t seen Hekara for days, and while it was nice not to have her constantly underfoot, he was starting to worry. #emph[At least the resonator in Rakdos territory is still on schedule, even if we keep having to drag the workers out of the clubs.] "I’ll see what I can do, but time is short. Kaya, do you think your people can make up the numbers?" "They can," Kaya said firmly. "We can, I mean. Name the time and place, and we’ll be there." "The time is tomorrow," Ral said. He shuffled the maps until he found one that showed the Undercity, more a collection of fragmentary sketches than a solid depiction of that notoriously chaotic domain. But the chamber he wanted was marked clearly enough, a vast circular cavern with an underground waterway running through the heart of it. "And the place is here. Grek’ospen, the Golgari call it." "This large space," Aurelia said, leaning closer to the map. Her folded wings nearly brushed the ceiling. "It is open ground?" "I don’t think so," Ral said. "As best our scouts can tell, it’s some kind of hive belonging to the giant insects allied with the Golgari." "The kraul," <NAME> said. "A fascinating species. Eusocial behavior is exceedingly rare among full sentients." "It will not be good ground for battle," Aurelia said. "Cluttered and confused. Ideal for the Golgari." "Unfortunately," Ral said, "we don’t have a choice. The node we need is there. And Vraska probably knows we’re coming." Far too many people had worked on the plan for there to be a real chance of concealing it from Golgari spies, even with Lazav doing his best to weed out Vraska’s agents. "We should plan on a difficult fight." "I understand," Aurelia said. "I will lead our forces personally." At Ral’s look of surprise, the angel raised one delicate eyebrow. "I committed the Legion to your cause, and I take my promises seriously. This is the best way to assure success." "While I regret I will not be able to join the expedition," <NAME> said, "our best soldiers will be with you." "And I’ll be there, of course," Kaya said, leaning forward. "Frankly, I could use the action." "Right, then," Ral said. "Tomorrow." #emph[And if Vraska shows herself, I’ll get the chance to nail her traitorous head to the wall.]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/path_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 7-9 path vertex must have 1, 2, or 3 points // #path(())
https://github.com/ryuryu-ymj/mannot
https://raw.githubusercontent.com/ryuryu-ymj/mannot/main/src/lib.typ
typst
MIT License
#import "mark.typ": mark, core-mark #import "annot.typ": annot, core-annot
https://github.com/choglost/LessElegantNote
https://raw.githubusercontent.com/choglost/LessElegantNote/main/pages/elegant-cover.typ
typst
MIT License
#import "../utils/style.typ": 字号, 字䜓 #let elegant-cover( // documentclass 䌠入的参数 twoside: false, info: (:), // datetime-display: datetime-display, ) = { // 1. 默讀参数 info = ( title: ("LessElegantNote\n䞀䞪Typst笔记暡版"), author: "匠䞉", date: datetime.today(), cover-image: "", ) + info // 2. 对参数进行倄理 // 倄理提亀日期 if type(info.date) == datetime { info.date = info.date.display("[year]/[month]/[day]") //[year]幎[month]月[day]日 } // // 劂果是字笊䞲则䜿甚换行笊将标题分隔䞺列衚 if type(info.title) == str { info.title = info.title.split("\n") } // 3. 正匏枲染 // pagebreak(weak: true, to: if twoside { "odd" }) set page(margin: 0pt) if info.cover-image != "" { image(info.cover-image, width: 100%, height: 55%) v(20pt) } else { } set align(horizon) for s in range(info.title.len()) { text(font: 字䜓.宋䜓, size: 字号.䞀号)[#h(40pt)*#info.title.at(s)*] v(20pt) } text(font: 字䜓.楷䜓, size: 字号.小四)[#h(50pt)䜜者#info.author] v(0pt) text(font: 字䜓.楷䜓, size: 字号.小四)[#h(50pt)日期#info.date] v(50pt) }
https://github.com/rlpundit/typst
https://raw.githubusercontent.com/rlpundit/typst/main/Typst/fr-Rapport/chaps/chpt1.typ
typst
MIT License
/* ------------------------------- NE PAS MODIFIER ------------------------------ */ #import "../common/metadata.typ": title, chap1 #set page(header: smallcaps(title) + h(1fr) + emph(chap1) + line(length: 100%)) #text(white)[= #chap1 <chp:chap1>]#v(-1cm) /* ------------------------------------------------------------------------------ */ == Introduction #lorem(32) == Section 1 #lorem(16) === Sous-section 1.1 #lorem(64) === Sous-section 1.2 #lorem(64) == Section 2 #lorem(16) === Sous-section 2.1 #lorem(64) === Sous-section 2.2 #lorem(64) #figure( image("images/typst.svg", width: 40%), caption: "Typst logo", ) <fig:typst-logo> @fig:typst-logo affiche le logo de `Typst`. #figure( table( columns: (auto, auto, auto), [a], [b], [c], [$a$], [$b$], [$c$], ), caption: "Une table", ) <tab:une-table> @tab:une-table montre un tableau. == Conclusion #lorem(32)
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/05-group-theory/08-group-on-set.typ
typst
Other
#import "../../utils/core.typ": * == ДействОе группы Ма ЌМПжестве #ticket[ДействОе группы Ма ЌМПжестве. ОпреЎелеМОе О прОЌеры] #def[ ЗЎесь О Ўалее $G$ --- группа, $X$ --- ЌМПжествП. ДействОе $G$ Ма $X$ --- гПЌПЌПрфОзЌ, $G --> S(X)$. ($S(X)$ --- ЌМПжествП бОекцОй Оз $X$ Ма себя.) ] #def[ ДействОе $G$ Ма $X$ --- ПтПбражеМОе $ G times X &--> X\ (g, x) &maps g x $ с ЎвуЌя свПйстваЌО: + $g_1 (g_2 x) = (g_1 g_2) x space.quad forall g_1, g_2 in G, x in X$ + $e x$ = $x space forall x in X$ ] #proof(name: [СПпПставлеМОе ПпреЎелеМОй])[ ВППбще гПвПря, вМешМе этО Ўва ПпреЎелеМОя пПчтО МОкак Ме связаМы. Мы ПпреЎелОлО Ўва вППбще разМых Пбъекта. ППэтПЌу Ќы ЎПказываеЌ, чтП ЌежЎу этОЌО ПбъектаЌО существует пПМятМПе сППтвествОе. "$1 ==> 2$": $phi: G --> S(X)$ --- гПЌПЌПрфОзЌ, тПгЎа рассЌПтрОЌ $ G times X &--> X\ (g, x) &maps phi(g)(x) $ ПрПверОЌ свПйства: + $phi(g_1)(phi(g_2)(x)) = phi(g_1 g_2)(x)$ + $underbrace(phi(e), id_X)(x) = x$ "$2 ==> 1$": РассЌПтрОЌ $psi: G times X --> X$ О ПтПбражеМОе $phi$: $ G &limits(-->)^phi S(X)\ g &maps (x maps g x) #[--- этП бОекцОя (есть ПбратМый к $x$)] $ ПрПверОЌ, чтП этП гПЌПЌПрфОзЌ: $ phi(g_1 g_2) x = (g_1 g_2) x = g_1 (g_2 x) = phi(g_1) (phi(g_2) x). $ ] #example(plural: true)[ + $G = A_n, space X = {1, ..., n}$, $phi: A_n overbrace(arrow.r.hook, #place(move(dy: -1em, [#box(scale(sym.arrow.b.curve, x: -100%)) ОМъектОвМПе ПтПбражеМОе]))) S_n, (phi = i_(A_n))$ + $G = D_n, space X #[--- плПскПсть, $X supset P$ --- правОльМый пятОугПльМОк], space D_n < S(X), space phi = i_(D_n)$ + $G = RR, space X = CC$ $ G times X &--> X\ (a, z) &maps (cos(2 pi a) + i sin (2 pi a))z $ + $G$ --- группа, $X = G$ $ G times X &--> G\ (g, h) &maps g h $ + $G$ --- группа, $X = G$ $ (g_1 h) = g h g_(-1) \ (g_1 g_2)h(g_1 g_2)^(-1) = g_1 (g_2 h g_2 ^(-1)) g_1^(-1) $ + $G = S_n, space X = RR^n$ $ sigma vec(alpha_1, dots.v, alpha_n) = vec(alpha_(sigma(1)), dots.v, alpha_(sigma(n))) $ + $G = S_n, space X = V$ --- лОМейМПе прПстраМствП с базОсПЌ $e_1, ..., e_n$ $ sigma(alpha_1 e_1 + ... + alpha_n e_n) = alpha_1 e_(sigma(1)) + ... + alpha_n e_(sigma(n)) $. ] #ticket[ОрбОты О стабОлОзатПры] #def[ Пусть $G$ Ўействует Ма $X$, $x in X$. _ОрбОта_ $x$ --- этП ЌМПжествП $ G x = {g x bar g in G} $ ] #def[ Пусть $x in X$. _СтабОлОзатПр_ $x$: $ St_x = {g in G bar g x = x} < G $ ] #pr[ Пусть $abs(G) < infinity$, $G$ Ўействует Ма $X$. ТПгЎа $ forall x in X: abs(G) = abs(St_x) dot abs(G x) $ ] #proof[ РассЌПтрОЌ (зЎесь ОЎет речь П ЌМПжестве левых сЌежМых классПв, $St_x$ Ме ПбязаМ быть МПрЌальМПй пПЎгруппПй!) $ G fg St_x &limits(-->)^phi G x \ g &maps g x $ ДПкажеЌ кПрректМПсть $phi$: $ g_2 = g_1 h "гЎе" h in St_x, space g_2 x = g_1 h x = g_1 x. $ $G x = Im phi$ --- пП ПпреЎелеМОю. ПрПверОЌ, чтП $phi$ --- ОМъектОвМа: $ g_2 x = g_1 x &==> g_1^(-1) (g_2 x ) = g_1^(-1) (g_1 x) = x \ &==> g_1^(-1) g_2 in St_x ==> g_2 in g_1 St_x. $ ] #ticket[ЊеМтр кПМечМПй $p$-группы] #def[ $G$ --- группа. ТПгЎа _цеМтр группы_ --- этП $ Z(G) = {h in G bar forall g in G: h g = g h}. $ ] #pr[ Пусть $abs(G) = p^n$, $p$ --- прПстПе, $n in NN$. ТПгЎа $Z(G) != {e}$ ] #proof[ Пусть $G$ Ўействует Ма себе сПпряжеМОеЌ ($(g, x) maps g x g^(-1)$). РассЌПтрОЌ $h in G$. ТПгЎа $ G = union.big_(i in I) C_i, "гЎе" C_i #[--- ПрбОты], \ abs(G) space dots.v space abs(C_i) ==> abs(C_i) = p^m "Ўля" 0 <= m <= n. $ ОбПзМачОЌ за $k_i$ чОслП ПрбОт разЌера $p^i$. ТПгЎа $ p^n = abs(G) = k_0 mul 1 + k_1 mul p + dots + k_n mul p^n ==> p bar k_0 \ k_0 >= 1, "так как ПрбОта" e "сПстПОт тПлькП Оз " e", МП" p >= 2 $ ВПзвращаеЌся к требуеЌПЌу: $ abs(G h) = 1 &<==> abs({g h g^(-1) bar g in G}) = 1 \ &<==> forall g in G: g h g^(-1) = h \ &<==> h in Z(G) $ ТакОЌ ПбразПЌ $abs(Z(G)) >= p$. ]
https://github.com/SillyFreak/tu-wien-software-engineering-notes
https://raw.githubusercontent.com/SillyFreak/tu-wien-software-engineering-notes/main/optimizing-compilers/notes.typ
typst
#import "../template/template.typ": notes #import "oc/oc.typ": instr, succ, pred, Spec, Func, fw, bw, Const, Id, Vars, Consts, Terms, Ops, Eval, path, Paths, CM, BCM, ALCM, LCM, SpCM, Insert, Repl, Comp, Transp, Safe, Correct, Available, VeryBusy, Earliest, Delayed, Latest, Isolated #import "oc/lattices.typ": * #import "oc/flow-graphs.typ": * #show: notes.with( title: "Optimizing Compiler Notes", authors: ( "<NAME>, 01126573", ), ) #[ #set heading(numbering: none) = License This work ©2023 by <NAME> is licensed under CC BY-SA 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ = Revision history - no "published" version yet. = About this document This document is based on Uwe Egly's Optimizing Compilers lecture at Vienna University of Technology; particularly from taking it in the 2022/23 winter term and refreshing my knowledge on it mid-2023. Corrections and additions are welcome as pull requests at https://github.com/SillyFreak/tu-wien-software-engineering-notes This document leaves out several details and was written primarily for me, but I hope it is useful for other people as well. Among the things one reading it should keep in mind: - This is not a replacement to Prof. Egly's slides or the lecture in any way. Much of the information may require context and/or preliminaries found in the slides or in the lecture. - I liberally skip proofs. They make up a large part of the professor's slides, and I don't think it would be very useful to repeat them here. - In general, I skip formal definitions where they were basic enough for me; for example, I gloss over structure and semantics of programs, which are important for most program analyses. Your mileage may vary. - I skip chapters 1 (Motivation) and 2 (Classical Gen/Kill Data Flow Analyses) in favor of starting with the DFA framework, which subsumes that material anyway. - The document is in general still incomplete. - I am fallible and make errors or overlook some points' importance. If you have questions, feel free to reach out on Github. I may at least occasionally be motivated enough to answer questions, extend the document with explanations based on your question, or help you with adding it yourself. #pagebreak() ] = The DFA framework In the general data flow analysis framework, a DFA problem on an edge-labelled flow graph $G$ is formulated through a lattice with corresponding local semantics and some additional meta-information. The lattice is formed in some _carrier set_, $Carrier$: $ Spec_G &= (Lattice(Carrier), Func(), c_s , d) \ "where" Lattice(Carrier) &= (Carrier, rel, meet, join, bot, top) \ Func() &: E -> Carrier -> Carrier \ c_s &in Carrier \ d &in {fw, bw} $ $Func()$ is the DFA functional that returns for each edge a function defining the semantics of that edge. For example, if $instr_e = skip$, then $Func(e: e) = Id_Carrier = lambda c. c$. For other instructions, the semantics will vary by DFA specification. Whether the DFA functional is (for each edge) only monotonic or also distributive determines whether the MaxFP solution will only approximate or even coincide with the MOP solution. $d$ is the direction of the problem, and $c_s$ is the initial information at the start/end node, depending on the direction. = Gen/Kill analysis specification #[ #let pointwise = $italic("pw")$ Gen/kill or bitvector analyses store a single bit of information for each node of the control flow graph, i.e. $Carrier := BB$. The term _bitvector_ analysis reflects that $n$ such analyses (e.g. the availability of $n$ expressions) can be carried out efficiently at the same time by combining boolean values into a bitvector, resulting in $Carrier := BB^n$. When doing so, the relevant connectives (e.g. $lt.eq$, $and$) are adapted to point-wise application (e.g. $lt.eq_pointwise$, $and_pointwise$). These two formulations are ultimately equivalent. ] Depending on the quantification of the problem, the boolean lattice or its inverse is used: $ Lattice(BB) := & (BB, and, or, lt.eq, "false", "true") &quad& #[for universally quantified problems] \ Lattice(BB_or) := & (BB, or, and, gt.eq, "true", "false") && #[for existentially quantified problems] $ #align(center)[ #grid( columns: 2, gutter: 4em, figure( caption: [Hasse diagram of $Lattice(BB)$], numbering: none, hasse-boolean ), figure( caption: [Hasse diagram of $Lattice(BB_or)$], numbering: none, hasse-boolean-inv ), ) ] The DFA functional and direction depend on the specific analysis. In the DFA functionals, we will refer to some basic boolean functions: $ Const_"true" &= lambda b. "true" \ Const_"false" &= lambda b. "false" \ Id_BB &= lambda b. b $ == Reaching definitions A defintion of some variable $v$ is an assignment to that variable at a specific edge $accent(e, hat)$. The reach of a definition flows forward in the flow graph, until another definition shadows it. $ Spec_G & = (Lattice(BB_or), Func(), b_s, fw) \ "where" Func(e: e) &= cases( Const_"true" &quad& #[if $e = accent(e, hat)$, i.e. this is the site of the definition], Const_"false" && #[if $instr_e$ redefines $v$], Id_BB && #[otherwise], ) $ == Available Expressions An expression becomes available when it is computed and stops being available when a variable appearing in it is redefined. This is again a forward analysis. An expression needs to be available on all paths to be available at a node. $ Spec_G & = (Lattice(BB), Func(), b_s, fw) \ "where" Func(e: e) &= cases( Const_"false" &quad& #[if $instr_e$ redefines a variable appearing in the expression], Const_"true" && #[if $instr_e$ computes the expression], Id_BB && #[otherwise], ) $ == Live variables A variable $v$ is live at a node if it is later used on some paths before being redefined. The information flows backwards from the use sites, until a definition site is encountered. $ Spec_G & = (Lattice(BB_or), Func(), b_e, bw) \ "where" Func(e: e) &= cases( Const_"true" &quad& #[if $instr_e$ reads/uses $v$], Const_"false" && #[if $instr_e$ redefines $v$], Id_BB && #[otherwise], ) $ == Very busy expressions An expression is very busy at a node if, no matter what path is taken from the node, the expression is always used before any of the variables occurring in it is redefined. The information flows backwards from the use sites, until a definition site of one of the variables in the expression is encountered. $ Spec_G & = (Lattice(BB), Func(), b_e, bw) \ "where" Func(e: e) &= cases( Const_"true" &quad& #[if $instr_e$ computes/uses the expression], Const_"false" && #[if $instr_e$ redefines a variable appearing in the expression], Id_BB && #[otherwise], ) $ #pagebreak(weak: true) = Constant propagation We now want to know whether a variable (or term) has, at some node, a known constant value. Both the variable and term version are undecidable, so we need conservative approximations. Let's consider a few examples of pseudocode. In each example, we are interested in whether the printed variable is constant: #align(center)[ #grid( columns: 5, gutter: 1.5em, block(width: 2.5cm)[ ```py a = 0 b = a print(b) ``` ], block(width: 2.5cm)[ ```py a = 0 b = a + 1 print(b) ``` ], block(width: 2.5cm)[ ```py if p: a = 0 else: a = 0 print(a) ``` ], block(width: 2.5cm)[ ```py if p: a = 0 else: return print(a) ``` ], block(width: 2.5cm)[ ```py b = a * 0 print(b) ``` ], ) ] In the first example, `a` is constant and `b` is assigned this variable's value. Naturally, we want an analysis that recognizes that `b` has the constant value zero. In the second example, we are dealing with an arithmetic expression that contains only constant operands. Again, it is desirable to recognize `b` always has value one. The third and fourth example demonstrates how joining control flow needs to be considered: as variable `a` is known to be _the same_ constant in both branches of example 3, its value after the conditional is that same value. As one branch _diverges_ in example 4, the other branch(es) determine the value after the conditional. The last example shows how certain operations can result in constant results with non-constant operands: `a` is not known, yet `b` is known to be zero. == Data domain & extended domain To reason about values that variables/terms can take, we first need a data domain $DD$ (for which we require a distinguised element $bot in DD$). While in $Lattice(BB)$ and $Lattice(BB_or)$, the two values $"true"$ and $"false"$ are related through $rel$, for constant propagation, they have no meaning except for being distinct. We therefore work on a _flat lattice_ $FL_DD = (DD', subset.eq.sq, sect.sq, union.sq, bot, top)$, with the extended domain $DD' = DD union {top}$ containing another distinguished element: #align(center)[ #grid( columns: 2, gutter: 4em, figure( caption: [Hasse diagram of $FL_BB$], numbering: none, hasse-flat-boolean ), figure( caption: [Hasse diagram of $FL_ZZ$], numbering: none, hasse-flat-integers(2) ), ) ] We can now talk about _states_, which assign a value to each variable (this is why we require $bot in DD$: even variables not defined at some program points need to be covered). A state is thus a function $sigma: Vars -> DD$. We also define DFA states that allow all values of the extended domain: $sigma: Vars -> DD'$ and the sets of all (extended) states: $ Sigma &= { sigma | sigma in Vars -> DD } \ Sigma' &= { sigma | sigma in Vars -> DD' } $ This latter set is significant because we can construct a lattice on it by _pointwise ordering_ according to the ordering of $FL_(DD')$: $ sigma rel_(Sigma') sigma' &quad& #[iff $forall v in Vars: sigma(v) rel_(FL_(DD')) sigma'(v)$] $ Or in words: two DFA states are related according to the lattice's ordering iff all variable assignments in these states are related. This results in pointwise meet and join operations as well, and two distinguished top and bottom states: $ sigma meet_(Sigma') sigma' &= lambda v. sigma(v) meet_(FL(DD)) sigma'(v) \ sigma join_(Sigma') sigma' &= lambda v. sigma(v) join_(FL(DD)) sigma'(v) \ sigma_bot &= lambda v. bot \ sigma_top &= lambda v. top $ $ Lattice(Sigma') = (Sigma', subset.eq.sq, sect.sq, union.sq, sigma_bot, sigma_top) $ Consider some control flow examples again in light of this flat lattice: #align(center)[ #grid( columns: 3, gutter: 2em, block(width: 3cm)[ ```py if p: a = true else: a = false print(a) ``` ], block(width: 3cm)[ ```py if p: a = true else: a = true print(a) ``` ], block(width: 3cm)[ ```py if p: a = true else: return print(a) ``` ], ) ] Before exiting the conditional, we have two states $sigma_1$ and $sigma_2$, and right after a state $sigma_3 = sigma_1 meet sigma_2$. According to the lattice, we get $ "Example 1:" &quad& sigma_1(a) &= "true", &thick&& sigma_2(a) &= "false" &thick&& => sigma_3(a) &= bot \ "Example 2:" &quad& sigma_1(a) &= "true", &&& sigma_2(a) &= "true" &&& => sigma_3(a) &= "true" \ "Example 3:" &quad& sigma_1(a) &= "true", &&& sigma_2(a) &= top &&& => sigma_3(a) &= "true" $ We can see that $bot$ means the value is unknown (not constant) and $top$ means the value does not exist (due to the divergence of the branch). Since the $top$ value only represents impossibilities, we define another set $Sigma'_"Init"$ excluding those states that contain $top$ variable assignments: $ Sigma'_"Init" = {sigma in Sigma' | forall v in Vars. sigma(v) != top} $ == Variables, terms and operators It is no longer sufficient (as it was for bitvector analyses) to just look at _what_ variables appear in expressions; to know whether an expression is constant, and if so what contstant it evaluates to, we need to consider _how_ an expression combines variables. We therefore consider the disjoint sets $Vars$ of variables, $Consts$ of constants, $Ops$ of operators, and $Terms$ of terms. The set of terms contains the syntaxtically possible combinations of the other three. On top of these, the semantics can be defined. == (Extended) interpretation, evaluation function, state transformer The (extended) interpretation $I_0$ ($I_0'$) describe the semantics of constants and operators; they can be thought of as "overloaded" for these two kinds of parameters: $ I_0 &: cases( Consts -> DD, Ops -> (DD^k -> DD) &quad #[for a $k$-ary operator] ) \ I_0' &: cases( Consts -> DD', Ops -> (DD'^k -> DD') &quad #[for a $k$-ary operator] ) $ These functions satisfy that - if some of the operands of an operator are $bot$, the operation's result is $bot$; and - (for the extended interpretation) otherwise, if some of the operands of an operator are $top$, the operation's result is $top$. Based on that, the (extended) evaluation function $Eval$ ($Eval'$) is defined: $ Eval &: Terms -> (Sigma -> DD) \ Eval' &: Terms -> (Sigma' -> DD') $ Intuitively, these functions recursively apply themselves to parts of the expression, grounding themselves in $I_0$ ($I_0'$) for constants and operators, and in the current state for variables. The exact form of these functions depends on the kind of constant propagation. For example, the term `a * 0` is not a simple constant, but it is a linear constant. Likewise, the (extended) state transformer $Theta$ ($Theta'$) transforms an (extended) state into another based on the local semantics of an instruction: $ Theta &: Sigma -> Sigma \ Theta' &: Sigma' -> Sigma' $ With this, we can finally formulate a DFA specification for constant propagation: $ Spec_G & = (Lattice(Sigma'), Func(), sigma_s, fw) \ "where" Func(e: e) &= Theta'_instr_e \ sigma_s &in Sigma'_"Init" $ The difference between constant propagation specifications lies in how the extended evaluation function $Eval'$ deals with different kinds of terms: == Simple constants The simple constant analysis evaluates terms containing only constants and constant variables to non-$bot$ values: $ Eval'(t)(sigma) &= cases( sigma(v) &quad #[if $t equiv v in Vars$], I_0'(c) &quad #[if $t equiv c in Consts$], I_0'("op")(Eval'(t_1)(sigma), ..., Eval'(t_k)(sigma)) &quad #[if $t equiv ("op", t_1, ..., t_k)$] ) $ == Copy constants The copy constant analysis only deals with terms that are either constants themselves, or are just a variable reference. Other terms are assumed to be not constant. In other words, _copying_ one variable value into another variable is the only kind of constant _propagation_ that is performed: $ Eval'(t)(sigma) &= cases( sigma(v) &quad #[if $t equiv v in Vars$], I_0'(c) &quad #[if $t equiv c in Consts$], bot &quad #[otherwise] ) $ == Linear constants The linear constants analysis limits itself to linear arithmetic terms: it considers terms of the form $c*v plus.circle d$ (with $c, d in Consts$, $v in Vars$, $plus.circle in {+, -}$) specifically (as well as other semantically equivalent forms such as $d eq.est 0*v + d$, $c*v eq.est c*v + 0$, etc.): $ Eval'(t)(sigma) &= cases( sigma(v) &quad #[if $t equiv v in Vars$], Eval_"SC" (t)(sigma) &quad #[if $t equiv c*v plus.circle d$], bot &quad #[otherwise] ) $ where $Eval_"SC"$ is the extended evaluation function for simple constants. == Q constants (Kam & Ullman) The Q constants analysis does not use a different evaluation function; instead, the MaxFP algorithm is modified slightly. Consider these code examples and a simple constant analysis on them: #align(center)[ #grid( columns: 2, gutter: 2em, block(width: 3cm)[ ```py if p: a = 2 b = 3 else: a = 2 b = 3 c = a + b print(c) ``` ], block(width: 3cm)[ ```py if p: a = 2 b = 3 else: a = 3 b = 2 c = a + b print(c) ``` ], ) ] In the first example, both $a$ and $b$ are constants after the conditional, but in the first example they are not; $a + b$, however, is a constant not detected by the simple constant analysis. Recall: - Before exiting the conditional, we have $sigma_1$ with $a=2, b=3$ and $sigma_2$ with $a=3, b=2$. - We compute $sigma_3 = sigma_1 meet sigma_2$ and find that in this state, $a=bot, b=bot$. - We evaluate $Eval'(a+b)(sigma_3) = bot$. The Q constants approach is now to perform the meet operation later: - Before exiting the conditional, we have $sigma_1$ with $a=2, b=3$ and $sigma_2$ with $a=3, b=2$. - We evaluate $Eval'(a+b)(sigma_1) = 5, Eval'(a+b)(sigma_2) = 5$. - We compute the result $5 meet 5 = 5$ and thus detected the result as a constant. Taking the meet "lazily" after the evaluation results in more evaluations overall, but improves precision. This approach can be generalized to taking the meet more than one step later. == Finite constants In contrast to the CP analyses so far, the finite constants analysis is based on _terms_: the problem illustrated for Q constants was that while previous analyses kept track of variable values (e.g. of $a$ and $b$), the value of terms such as $a+b$ was not remembered. If we stored $a+b=5$ as part of the information at the end of both branches, the MaxFP algorithm would naturally preserve and forward that information. There are infinitely many possible terms, but fortunately, only a finite set of them needs to be considered (why?), leading to the name _finite constants_. == Conditional constants In previous examples, the predicate variable $p$ was left as an unknown; if however a condition is itself constant, this means we don't need to join control flows and can avoid the lossy meet operation at the end altogether. To do so, we need to extend our domain to include boolean values: $DD_BB = DD union BB$, and extend our definitions to allow for comparisons and logical operators, so that boolean terms can be formed. On top of this, we use the flat lattice $FL_DD_BB$ and state lattice $Lattice(Sigma')$ == Value graph approach TODO #pagebreak(weak: true) = Partial redundancy elimination (PRE) PRE is an optimization that avoids recomputing the same value multiple times. The tool for this is moving computations to one or more earlier points in the flow graph (particularly outside a loop the original computation appeared in). Whenever these stored results are used, none of the variables used in the computation must have changed in the meantime ("correctness"). The three goals which can be traded are - performance: minimize the number of computations done at runtime - register pressure: minimize the amount of time a result needs to be held in a register - code size: minimize the number of instructions in the flow graph Classically, there is an additional requirement for the code motion: no program path that originally did not compute the value may be made to compute the value after code motion. This is called "safety", because the extra computation could result in a failure even though the branch originally containing the failing code wasn't taken. Trading these in different ways leads to a taxonomy of multiple code motion strategies, for example: - *Busy code motion* (BCM) moves calculations to the earliest opportunity. It is computationally optimal. - *Lazy code motion* (LCM) moves calculations to the latest opportunity. It is computationally and lifetime optimal. - *Sparse code motion* (SpCM) moves calculations to the latest position where the resulting program is code size optimal. Computational and lifetime optimality is not achieved, but no program of the same size is better. == Code motions and admissibility A code motion transformation ($CM$) of some candidate expression $t in Terms$ on a _node-labelled_ flow graph is defined by - $Insert_CM (n)$: whether a computation of the form $h := t$, where $h$ is a new variable name, is inserted at the entry of node $n$; - $Repl_CM (n)$: whether occurrences of $t$ are replaced by references to $h$ at $n$. Obviously, not all CMs lead to correct code, thus we define admissibility: we want CMs that satisfy the following properties: - Safety: a computation is only inserted on paths where the original program also computed the term. That means an insertion only happens at a node $n$ where the term is either available (= "up-safe": it has been computed without redefinition in the original program on all paths leading to $n$), or very busy (= "down-safe": it will be used without redefinition on all paths coming from $n$). - Correctness: whenever $h$ is used, there is a definition of $h$ before that and $h$'s operands have not been redefined since then. $ forall n in N. &&Insert_CM (n) &=> Safe(n) \ forall n in N. &&Repl_CM (n) &=> Correct_CM (n) $ $ "where" quad Safe(n) = &Available(n) or VeryBusy(n) \ Correct_CM (n) = &forall path(#$n_1, ..., n_k$) in Paths[s, n]. exists i. \ &quad Insert_CM (n_i) and Transp^forall (path(#$n_i, ..., n_(k-1)$)) $ Where $Transp(n)$ means that $t$'s operands are not redefined at $n$ and $Transp^forall (p)$ extends that to apply to all nodes on path $p$. === Safety example What follows is a node-labelled flow graph where the up- and down safety of the expression $a+b$ is highlighted in blue and green, respectively. The highlighted nodes are thus the ones where computations of the form $h := a+b$ may be inserted. #align(center)[ #set text(size: 8pt) #let node = stmt-node.with(width: 5.5em) #let dummy-node = node.with(stroke: none) #let av-node = node.with(fill: green) #let vb-node = node.with(fill: blue) #let vb-av-node(..opts) = { move(dx: 4pt, dy: 4pt, vb-node(inset: 0pt, move(dx: -4pt, dy: -4pt, av-node(..opts) ))) } #let nodes = ( // put something in column 1 so that spacing is correct "dummy": ((0, 1), dummy-node()), "1": ((0, 4), node()), "2": ((1, 3), node($assign(a, c)$)), "3": ((2, 3), av-node($assign(x, a+b)$)), "4": ((2, 5), node()), "5": ((3, 4), node()), "6": ((4, 3), av-node()), "7": ((4, 5), node()), "8": ((5, 2), av-node()), "9": ((5, 4), av-node()), "10": ((6, 0), av-node($assign(y, a+b)$)), "11": ((6, 2), av-node()), "12": ((6, 4), av-node()), "13": ((6, 6), av-node()), "14": ((7, 2), av-node($assign(x, a+b)$)), "15": ((7, 4), av-node($assign(x, a+b)$)), "16": ((8, 3), vb-av-node($z := a+b$)), "17": ((8, 5), av-node($x := a+b$)), "18": ((9, 5), node()), ) #let edge = edge.with(nodes: nodes) #let edges = edges.with(nodes: nodes) #node-labelled-graph( node-padding: (-12pt, 20pt), nodes: nodes, ..edges("1", "2", "3", "5", "6", "8", "11", "14", "16", "18"), ..edges("1", "4", "5", "7"), ..edges("6", "9", "12", "15", "16"), ..edges("17", "18"), edge("11", "10", curve: 40deg), edge("10", "11", curve: 40deg), edge("12", "13", curve: -40deg), edge("13", "12", curve: -40deg), edge("12", "17", curve: 26deg), edge("7", "18", curve: 60deg), ) ] == Busy code motion (BCM) BCM uses the earliestness principle to decide where to put computations, then eliminates redundant computations (i.e. those that can be replaced by referencing the new variable, e.g. $h$). Earliestness is defined as follows: $ Earliest(n) = Safe(n) and cases( "true" &#[if $n$ is the start node], limits(or.big)_(m in pred(n)) not Transp(m) or not Safe(m) quad &#[otherwise], ) $ The BCM transformation is thus defined by $ Insert_BCM (n) = Earliest(n) \ Repl_BCM (n) = Comp(n) $ BCM is computationally optimal, but maximizes register pressure. Code size can grow. == Lazy code motion (LCM) LCM is both computationally and lifetime optimal. It moves computations to the latest possible point that still results in the minimum number of computations. We first need the notion of delayability: a computation (of $t$) can be delayed to node $n$ when all paths to $n$ inlcude the earliest node for the computation, and these paths do not include a computation between the earliest node (inclusive) and $n$ (exclusive). $ Delayed(n) = &forall p in Paths[s, n]. exists i <= lambda_p. \ &quad Earliest(p_i) and not Comp^exists (p lr([i, lambda_p\[)) $ Similarly to $Earliest$, we now define $Latest$: $ Latest(n) = Delayed(n) and (Comp(n) or or.big_(m in succ(n)) not Delayed(m)) $ This leads is to a precursor of LCM: the ALCM transformation is computationally and _almost_ lifetime optimal. $ Insert_ALCM (n) = Latest(n) \ Repl_ALCM (n) = Comp(n) $ As a simple example for how this is not lifetime optimal yet, take the simple example $assign(x, a+b)$. While there is no improvement to achieve, ALCM would still hoist the computation to directly before the original assignment: $assign(h, a+b); assign(x, h)$. Note that the "uselessness" of the hoisting depends on the CM transformation being applied. We thus need to further consider a notion of _isolatedness_ regarding a specific CM transformation: a node $n$ is isolated if all paths from there to the end node that contain a replacement of $t$ at some later node $p_i$ satisfy that a computation was inserted at some node between $n$ (exclusive) and $p_i$ (inclusive). We are specifically interested in isolatedness relative to the BCM transformation: $ Isolated_CM (n) = &forall p in Paths[n, e]. forall 1 < i <= lambda_p. \ &quad Repl_CM (p_i) => Insert_CM^exists (p lr(]1, i])) \ Isolated_BCM (n) = &forall p in Paths[n, e]. forall 1 < i <= lambda_p. \ &quad Comp(p_i) => Earliest^exists (p lr(]1, i])) $ A node $n$ is isolated (w.r.t. BCM) if either no path from there computes $t$ (at a later node than $n$), or if $t$ is computed on some paths, all computations on those paths are preceded by an earliest node that comes after $n$ and before or at the computation. This allows us to specify the LCM transformation: $ Insert_LCM (n) = Latest(n) and not Isolated_BCM (n) \ Repl_LCM (n) = Comp(n) and not (Latest(n) and Isolated_BCM (n)) $ // TODO are nodes 9, 12, 13 of the example graph isolated?
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiProgetto/sections/PianificazioneSprint/TerzoSprint.typ
typst
MIT License
#import "../../functions.typ": glossary === Terzo #glossary[sprint] *Inizio*: Venerdì 08/12/2023 *Fine*: Giovedì 14/12/2023 *Obiettivi dello #glossary[sprint]*: - Apportare modifiche al sito vetrina per semplificare il processo di consultazione dei documenti; - Proseguire la stesura delle _Norme di Progetto_, ponendo particolare attenzione su: spiegazione dei diagrammi #glossary[UML] dei casi d'uso utilizzati nell'_Analisi dei Requisiti_ e la descrizione dettagliata del significato e delle formule pertinenti alle metriche per la qualità; - Proseguire la stesura del _Piano di Progetto_, con l'aggiornamento di pianificazione e preventivo pertinenti allo #glossary[sprint] 3 e l'inserimento del consuntivo pertinente allo #glossary[sprint] 2; - Proseguire la stesura dell'_Analisi dei Requisiti_: - Rimozione dei casi d'uso superflui in quanto pertinenti a sensori che si Ú deciso di eliminare; - Inserimento dei diagrammi #glossary[UML] realizzati precedentemente; - Classificazione dei requisiti funzionali in obbligatori, desiderabili e opzionali. - Proseguire la stesura del _Piano di Qualifica_ con una bozza delle metriche da adottare per valutare la qualità dei processi primari e i processi di supporto e relativi valori di accettazione e ideali; - Apportare migliorie al #glossary[PoC]: - Migliorare la dimostrazione dell'andamento sinusoidale della temperatura aumentando la velocità di generazione dei dati per poter modellare una giornata in pochi minuti; - Utilizzare la funzione aggregata "MovingAverage" per ottimizzare le query; - Implementare ed utilizzare una funzionalità di filtraggio all'interno di #glossary[Grafana] per mezzo di #glossary[Grafana] variables.
https://github.com/tingerrr/hydra
https://raw.githubusercontent.com/tingerrr/hydra/main/CONTRIBUTING.md
markdown
MIT License
# Contribution ## Bug fixes If you want to fix an issue please leave a comment there so others know you are working on it. If you want to fix a bug which doesn't have an issue yet, please create an issue first. Exceptions are typos or minor improvements, just making the PR will be enough in those cases. ## Features When adding features, make sure you add regression tests for this feature. See the testing section below on testing. Make sure to document the feature, see the manual section on manual and examples below. ## Testing To ensure that your changes don't break exisiting code test it using the package's regression tests. This is done automatically on pull requests, so you don't need not install [typst-test], but it's nontheless recommended for faster iteration. In general, running `typst-test run` will be enough to ensure your changes are correct. ## Manual and examples The manual and example images are created from a quite frankly convoluted nushell script. If you have, or don't mind installing, [nushell], [just] and [imagemagick], then you can simply run `just gen` to generate a new manual and examples. The examples inside the docs currently don't make it easy to simplify this without generating them manually the whole time. Typst is missing a feature or plugin that allows embedding whole other Typst documents at the moment. That being said, it's fine to leave this step out on a PR and have me generate it once the rest of the PR is done. [typst-test]: https://github.com/tingerrr/typst-test [just]: https://just.systems/ [nushell]: https://www.nushell.sh/ [imagemagick]: https://imagemagick.org/
https://github.com/ryuryu-ymj/mannot
https://raw.githubusercontent.com/ryuryu-ymj/mannot/main/examples/usage3.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: (x: 2cm, y: 1cm), fill: white) #set text(24pt) #show: mannot-init $ mark(x, tag: #<x>) // Need # before tags. #annot(<x>)[Annotation] $
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2A00.typ
typst
Apache License 2.0
#let data = ( ("N-ARY CIRCLED DOT OPERATOR", "Sm", 0), ("N-ARY CIRCLED PLUS OPERATOR", "Sm", 0), ("N-ARY CIRCLED TIMES OPERATOR", "Sm", 0), ("N-ARY UNION OPERATOR WITH DOT", "Sm", 0), ("N-ARY UNION OPERATOR WITH PLUS", "Sm", 0), ("N-ARY SQUARE INTERSECTION OPERATOR", "Sm", 0), ("N-ARY SQUARE UNION OPERATOR", "Sm", 0), ("TWO LOGICAL AND OPERATOR", "Sm", 0), ("TWO LOGICAL OR OPERATOR", "Sm", 0), ("N-ARY TIMES OPERATOR", "Sm", 0), ("MODULO TWO SUM", "Sm", 0), ("SUMMATION WITH INTEGRAL", "Sm", 0), ("QUADRUPLE INTEGRAL OPERATOR", "Sm", 0), ("FINITE PART INTEGRAL", "Sm", 0), ("INTEGRAL WITH DOUBLE STROKE", "Sm", 0), ("INTEGRAL AVERAGE WITH SLASH", "Sm", 0), ("CIRCULATION FUNCTION", "Sm", 0), ("ANTICLOCKWISE INTEGRATION", "Sm", 0), ("LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE", "Sm", 0), ("LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE", "Sm", 0), ("LINE INTEGRATION NOT INCLUDING THE POLE", "Sm", 0), ("INTEGRAL AROUND A POINT OPERATOR", "Sm", 0), ("QUATERNION INTEGRAL OPERATOR", "Sm", 0), ("INTEGRAL WITH LEFTWARDS ARROW WITH HOOK", "Sm", 0), ("INTEGRAL WITH TIMES SIGN", "Sm", 0), ("INTEGRAL WITH INTERSECTION", "Sm", 0), ("INTEGRAL WITH UNION", "Sm", 0), ("INTEGRAL WITH OVERBAR", "Sm", 0), ("INTEGRAL WITH UNDERBAR", "Sm", 0), ("JOIN", "Sm", 0), ("LARGE LEFT TRIANGLE OPERATOR", "Sm", 0), ("Z NOTATION SCHEMA COMPOSITION", "Sm", 0), ("Z NOTATION SCHEMA PIPING", "Sm", 0), ("Z NOTATION SCHEMA PROJECTION", "Sm", 0), ("PLUS SIGN WITH SMALL CIRCLE ABOVE", "Sm", 0), ("PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE", "Sm", 0), ("PLUS SIGN WITH TILDE ABOVE", "Sm", 0), ("PLUS SIGN WITH DOT BELOW", "Sm", 0), ("PLUS SIGN WITH TILDE BELOW", "Sm", 0), ("PLUS SIGN WITH SUBSCRIPT TWO", "Sm", 0), ("PLUS SIGN WITH BLACK TRIANGLE", "Sm", 0), ("MINUS SIGN WITH COMMA ABOVE", "Sm", 0), ("MINUS SIGN WITH DOT BELOW", "Sm", 0), ("MINUS SIGN WITH FALLING DOTS", "Sm", 0), ("MINUS SIGN WITH RISING DOTS", "Sm", 0), ("PLUS SIGN IN LEFT HALF CIRCLE", "Sm", 0), ("PLUS SIGN IN RIGHT HALF CIRCLE", "Sm", 0), ("VECTOR OR CROSS PRODUCT", "Sm", 0), ("MULTIPLICATION SIGN WITH DOT ABOVE", "Sm", 0), ("MULTIPLICATION SIGN WITH UNDERBAR", "Sm", 0), ("SEMIDIRECT PRODUCT WITH BOTTOM CLOSED", "Sm", 0), ("SMASH PRODUCT", "Sm", 0), ("MULTIPLICATION SIGN IN LEFT HALF CIRCLE", "Sm", 0), ("MULTIPLICATION SIGN IN RIGHT HALF CIRCLE", "Sm", 0), ("CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT", "Sm", 0), ("MULTIPLICATION SIGN IN DOUBLE CIRCLE", "Sm", 0), ("CIRCLED DIVISION SIGN", "Sm", 0), ("PLUS SIGN IN TRIANGLE", "Sm", 0), ("MINUS SIGN IN TRIANGLE", "Sm", 0), ("MULTIPLICATION SIGN IN TRIANGLE", "Sm", 0), ("INTERIOR PRODUCT", "Sm", 0), ("RIGHTHAND INTERIOR PRODUCT", "Sm", 0), ("Z NOTATION RELATIONAL COMPOSITION", "Sm", 0), ("AMALGAMATION OR COPRODUCT", "Sm", 0), ("INTERSECTION WITH DOT", "Sm", 0), ("UNION WITH MINUS SIGN", "Sm", 0), ("UNION WITH OVERBAR", "Sm", 0), ("INTERSECTION WITH OVERBAR", "Sm", 0), ("INTERSECTION WITH LOGICAL AND", "Sm", 0), ("UNION WITH LOGICAL OR", "Sm", 0), ("UNION ABOVE INTERSECTION", "Sm", 0), ("INTERSECTION ABOVE UNION", "Sm", 0), ("UNION ABOVE BAR ABOVE INTERSECTION", "Sm", 0), ("INTERSECTION ABOVE BAR ABOVE UNION", "Sm", 0), ("UNION BESIDE AND JOINED WITH UNION", "Sm", 0), ("INTERSECTION BESIDE AND JOINED WITH INTERSECTION", "Sm", 0), ("CLOSED UNION WITH SERIFS", "Sm", 0), ("CLOSED INTERSECTION WITH SERIFS", "Sm", 0), ("DOUBLE SQUARE INTERSECTION", "Sm", 0), ("DOUBLE SQUARE UNION", "Sm", 0), ("CLOSED UNION WITH SERIFS AND SMASH PRODUCT", "Sm", 0), ("LOGICAL AND WITH DOT ABOVE", "Sm", 0), ("LOGICAL OR WITH DOT ABOVE", "Sm", 0), ("DOUBLE LOGICAL AND", "Sm", 0), ("DOUBLE LOGICAL OR", "Sm", 0), ("TWO INTERSECTING LOGICAL AND", "Sm", 0), ("TWO INTERSECTING LOGICAL OR", "Sm", 0), ("SLOPING LARGE OR", "Sm", 0), ("SLOPING LARGE AND", "Sm", 0), ("LOGICAL OR OVERLAPPING LOGICAL AND", "Sm", 0), ("LOGICAL AND WITH MIDDLE STEM", "Sm", 0), ("LOGICAL OR WITH MIDDLE STEM", "Sm", 0), ("LOGICAL AND WITH HORIZONTAL DASH", "Sm", 0), ("LOGICAL OR WITH HORIZONTAL DASH", "Sm", 0), ("LOGICAL AND WITH DOUBLE OVERBAR", "Sm", 0), ("LOGICAL AND WITH UNDERBAR", "Sm", 0), ("LOGICAL AND WITH DOUBLE UNDERBAR", "Sm", 0), ("SMALL VEE WITH UNDERBAR", "Sm", 0), ("LOGICAL OR WITH DOUBLE OVERBAR", "Sm", 0), ("LOGICAL OR WITH DOUBLE UNDERBAR", "Sm", 0), ("Z NOTATION DOMAIN ANTIRESTRICTION", "Sm", 0), ("Z NOTATION RANGE ANTIRESTRICTION", "Sm", 0), ("EQUALS SIGN WITH DOT BELOW", "Sm", 0), ("IDENTICAL WITH DOT ABOVE", "Sm", 0), ("TRIPLE HORIZONTAL BAR WITH DOUBLE VERTICAL STROKE", "Sm", 0), ("TRIPLE HORIZONTAL BAR WITH TRIPLE VERTICAL STROKE", "Sm", 0), ("TILDE OPERATOR WITH DOT ABOVE", "Sm", 0), ("TILDE OPERATOR WITH RISING DOTS", "Sm", 0), ("SIMILAR MINUS SIMILAR", "Sm", 0), ("CONGRUENT WITH DOT ABOVE", "Sm", 0), ("EQUALS WITH ASTERISK", "Sm", 0), ("ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT", "Sm", 0), ("APPROXIMATELY EQUAL OR EQUAL TO", "Sm", 0), ("EQUALS SIGN ABOVE PLUS SIGN", "Sm", 0), ("PLUS SIGN ABOVE EQUALS SIGN", "Sm", 0), ("EQUALS SIGN ABOVE TILDE OPERATOR", "Sm", 0), ("DOUBLE COLON EQUAL", "Sm", 0), ("TWO CONSECUTIVE EQUALS SIGNS", "Sm", 0), ("THREE CONSECUTIVE EQUALS SIGNS", "Sm", 0), ("EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW", "Sm", 0), ("EQUIVALENT WITH FOUR DOTS ABOVE", "Sm", 0), ("LESS-THAN WITH CIRCLE INSIDE", "Sm", 0), ("GREATER-THAN WITH CIRCLE INSIDE", "Sm", 0), ("LESS-THAN WITH QUESTION MARK ABOVE", "Sm", 0), ("GREATER-THAN WITH QUESTION MARK ABOVE", "Sm", 0), ("LESS-THAN OR SLANTED EQUAL TO", "Sm", 0), ("GREATER-THAN OR SLANTED EQUAL TO", "Sm", 0), ("LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE", "Sm", 0), ("GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE", "Sm", 0), ("LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE", "Sm", 0), ("GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE", "Sm", 0), ("LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT", "Sm", 0), ("GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT", "Sm", 0), ("LESS-THAN OR APPROXIMATE", "Sm", 0), ("GREATER-THAN OR APPROXIMATE", "Sm", 0), ("LESS-THAN AND SINGLE-LINE NOT EQUAL TO", "Sm", 0), ("GREATER-THAN AND SINGLE-LINE NOT EQUAL TO", "Sm", 0), ("LESS-THAN AND NOT APPROXIMATE", "Sm", 0), ("GREATER-THAN AND NOT APPROXIMATE", "Sm", 0), ("LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN", "Sm", 0), ("GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN", "Sm", 0), ("LESS-THAN ABOVE SIMILAR OR EQUAL", "Sm", 0), ("GREATER-THAN ABOVE SIMILAR OR EQUAL", "Sm", 0), ("LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN", "Sm", 0), ("GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN", "Sm", 0), ("LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL", "Sm", 0), ("GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL", "Sm", 0), ("LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL", "Sm", 0), ("GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL", "Sm", 0), ("SLANTED EQUAL TO OR LESS-THAN", "Sm", 0), ("SLANTED EQUAL TO OR GREATER-THAN", "Sm", 0), ("SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE", "Sm", 0), ("SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE", "Sm", 0), ("DOUBLE-LINE EQUAL TO OR LESS-THAN", "Sm", 0), ("DOUBLE-LINE EQUAL TO OR GREATER-THAN", "Sm", 0), ("DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN", "Sm", 0), ("DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN", "Sm", 0), ("SIMILAR OR LESS-THAN", "Sm", 0), ("SIMILAR OR GREATER-THAN", "Sm", 0), ("SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN", "Sm", 0), ("SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN", "Sm", 0), ("DOUBLE NESTED LESS-THAN", "Sm", 0), ("DOUBLE NESTED GREATER-THAN", "Sm", 0), ("DOUBLE NESTED LESS-THAN WITH UNDERBAR", "Sm", 0), ("GREATER-THAN OVERLAPPING LESS-THAN", "Sm", 0), ("GREATER-THAN BESIDE LESS-THAN", "Sm", 0), ("LESS-THAN CLOSED BY CURVE", "Sm", 0), ("GREATER-THAN CLOSED BY CURVE", "Sm", 0), ("LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL", "Sm", 0), ("GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL", "Sm", 0), ("SMALLER THAN", "Sm", 0), ("LARGER THAN", "Sm", 0), ("SMALLER THAN OR EQUAL TO", "Sm", 0), ("LARGER THAN OR EQUAL TO", "Sm", 0), ("EQUALS SIGN WITH BUMPY ABOVE", "Sm", 0), ("PRECEDES ABOVE SINGLE-LINE EQUALS SIGN", "Sm", 0), ("SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN", "Sm", 0), ("PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO", "Sm", 0), ("SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO", "Sm", 0), ("PRECEDES ABOVE EQUALS SIGN", "Sm", 0), ("SUCCEEDS ABOVE EQUALS SIGN", "Sm", 0), ("PRECEDES ABOVE NOT EQUAL TO", "Sm", 0), ("SUCCEEDS ABOVE NOT EQUAL TO", "Sm", 0), ("PRECEDES ABOVE ALMOST EQUAL TO", "Sm", 0), ("SUCCEEDS ABOVE ALMOST EQUAL TO", "Sm", 0), ("PRECEDES ABOVE NOT ALMOST EQUAL TO", "Sm", 0), ("SUCCEEDS ABOVE NOT ALMOST EQUAL TO", "Sm", 0), ("DOUBLE PRECEDES", "Sm", 0), ("DOUBLE SUCCEEDS", "Sm", 0), ("SUBSET WITH DOT", "Sm", 0), ("SUPERSET WITH DOT", "Sm", 0), ("SUBSET WITH PLUS SIGN BELOW", "Sm", 0), ("SUPERSET WITH PLUS SIGN BELOW", "Sm", 0), ("SUBSET WITH MULTIPLICATION SIGN BELOW", "Sm", 0), ("SUPERSET WITH MULTIPLICATION SIGN BELOW", "Sm", 0), ("SUBSET OF OR EQUAL TO WITH DOT ABOVE", "Sm", 0), ("SUPERSET OF OR EQUAL TO WITH DOT ABOVE", "Sm", 0), ("SUBSET OF ABOVE EQUALS SIGN", "Sm", 0), ("SUPERSET OF ABOVE EQUALS SIGN", "Sm", 0), ("SUBSET OF ABOVE TILDE OPERATOR", "Sm", 0), ("SUPERSET OF ABOVE TILDE OPERATOR", "Sm", 0), ("SUBSET OF ABOVE ALMOST EQUAL TO", "Sm", 0), ("SUPERSET OF ABOVE ALMOST EQUAL TO", "Sm", 0), ("SUBSET OF ABOVE NOT EQUAL TO", "Sm", 0), ("SUPERSET OF ABOVE NOT EQUAL TO", "Sm", 0), ("SQUARE LEFT OPEN BOX OPERATOR", "Sm", 0), ("SQUARE RIGHT OPEN BOX OPERATOR", "Sm", 0), ("CLOSED SUBSET", "Sm", 0), ("CLOSED SUPERSET", "Sm", 0), ("CLOSED SUBSET OR EQUAL TO", "Sm", 0), ("CLOSED SUPERSET OR EQUAL TO", "Sm", 0), ("SUBSET ABOVE SUPERSET", "Sm", 0), ("SUPERSET ABOVE SUBSET", "Sm", 0), ("SUBSET ABOVE SUBSET", "Sm", 0), ("SUPERSET ABOVE SUPERSET", "Sm", 0), ("SUPERSET BESIDE SUBSET", "Sm", 0), ("SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET", "Sm", 0), ("ELEMENT OF OPENING DOWNWARDS", "Sm", 0), ("PITCHFORK WITH TEE TOP", "Sm", 0), ("TRANSVERSAL INTERSECTION", "Sm", 0), ("FORKING", "Sm", 0), ("NONFORKING", "Sm", 0), ("SHORT LEFT TACK", "Sm", 0), ("SHORT DOWN TACK", "Sm", 0), ("SHORT UP TACK", "Sm", 0), ("PERPENDICULAR WITH S", "Sm", 0), ("VERTICAL BAR TRIPLE RIGHT TURNSTILE", "Sm", 0), ("DOUBLE VERTICAL BAR LEFT TURNSTILE", "Sm", 0), ("VERTICAL BAR DOUBLE LEFT TURNSTILE", "Sm", 0), ("DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE", "Sm", 0), ("LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL", "Sm", 0), ("SHORT DOWN TACK WITH OVERBAR", "Sm", 0), ("SHORT UP TACK WITH UNDERBAR", "Sm", 0), ("SHORT UP TACK ABOVE SHORT DOWN TACK", "Sm", 0), ("DOUBLE DOWN TACK", "Sm", 0), ("DOUBLE UP TACK", "Sm", 0), ("DOUBLE STROKE NOT SIGN", "Sm", 0), ("REVERSED DOUBLE STROKE NOT SIGN", "Sm", 0), ("DOES NOT DIVIDE WITH REVERSED NEGATION SLASH", "Sm", 0), ("VERTICAL LINE WITH CIRCLE ABOVE", "Sm", 0), ("VERTICAL LINE WITH CIRCLE BELOW", "Sm", 0), ("DOWN TACK WITH CIRCLE BELOW", "Sm", 0), ("PARALLEL WITH HORIZONTAL STROKE", "Sm", 0), ("PARALLEL WITH TILDE OPERATOR", "Sm", 0), ("TRIPLE VERTICAL BAR BINARY RELATION", "Sm", 0), ("TRIPLE VERTICAL BAR WITH HORIZONTAL STROKE", "Sm", 0), ("TRIPLE COLON OPERATOR", "Sm", 0), ("TRIPLE NESTED LESS-THAN", "Sm", 0), ("TRIPLE NESTED GREATER-THAN", "Sm", 0), ("DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO", "Sm", 0), ("DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO", "Sm", 0), ("TRIPLE SOLIDUS BINARY RELATION", "Sm", 0), ("LARGE TRIPLE VERTICAL BAR OPERATOR", "Sm", 0), ("DOUBLE SOLIDUS OPERATOR", "Sm", 0), ("WHITE VERTICAL BAR", "Sm", 0), ("N-ARY WHITE VERTICAL BAR", "Sm", 0), )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/par-bidi-07.typ
typst
Other
// Test whether L1 whitespace resetting destroys stuff. الغالؚ #h(70pt) ن#" "Ø©
https://github.com/lf-/typst-algorithmic
https://raw.githubusercontent.com/lf-/typst-algorithmic/main/README.md
markdown
<!-- SPDX-FileCopyrightText: 2023 <NAME> SPDX-License-Identifier: MIT --> # typst-algorithmic This is a package inspired by the LaTeX [`algorithmicx`][algorithmicx] package for Typst. It's useful for writing pseudocode and typesetting it all nicely. [algorithmicx]: https://ctan.org/pkg/algorithmicx ![screenshot of the typst-algorithmic output, showing line numbers, automatic indentation, bolded keywords, and such](./docs/assets/demo-rendered.png) Example: ```typst #import "@preview/algorithmic:0.1.0" #import algorithmic: algorithm #algorithm({ import algorithmic: * Function("Binary-Search", args: ("A", "n", "v"), { Cmt[Initialize the search range] Assign[$l$][$1$] Assign[$r$][$n$] State[] While(cond: $l <= r$, { Assign([mid], FnI[floor][$(l + r)/2$]) If(cond: $A ["mid"] < v$, { Assign[$l$][$m + 1$] }) ElsIf(cond: [$A ["mid"] > v$], { Assign[$r$][$m - 1$] }) Else({ Return[$m$] }) }) Return[*null*] }) }) ``` This DSL is implemented using the same trick as [CeTZ] uses: a code block of arrays gets those arrays joined together. [CeTZ]: https://github.com/johannes-wolf/typst-canvas Currently this library is not really customizable. Please vendor it and hack it up as needed then file an issue for the customization option you're missing. ## Reference #### stmt Statement-level contexts in `algorithmic` generally accept the type `body` in the following: ``` body = (ast|content)[] | ast | content ast = (change_indent: int, body: body) ``` #### inline Inline functions will generate plain content. #### `algorithmic(..bits)` Takes one or more lists of `ast` and creates an algorithmic block with line numbers. ### Control flow #### `Function`/`Procedure` (stmt) Defined as `f(name: string|content, args: content[]?, ..body)`. Body can be one or more `body` values. #### `If`/`ElseIf`/`Else`/`For`/`While` (stmt) Defined as `f(cond: string|content, ..body)`. Body can be one or more `body` values. Generates an indented block with the body, and the specified `cond` between the two keywords as condition. ### Statements #### `Assign` (stmt) Defined as `Assign(var: content, val: content)`. Generates `#var <- #val`. #### `CallI` (inline), `Call` (stmt) Defined as `f(name, args: content|content[])`. Calls a function with the function name styled in smallcaps and the args joined by commas. #### `Cmt` (stmt) Defined as `Cmt(body: content)`. Makes a line comment. #### `FnI` (inline), `Fn` (stmt) Defined as `f(name, args: content|content[])`. Calls a function with the function name styled in bold and the args joined by commas. #### `Ic` (inline) Defined as `Ic(body: content) -> content`. Makes an inline comment. #### `Return` (stmt) Defined as `Return(arg: content)`. Generates `return #arg`. #### `State` (stmt) Defined as `State(body: content)`. Turns any content into a line.
https://github.com/coco33920/.files
https://raw.githubusercontent.com/coco33920/.files/mistress/typst_templates/dept-news/main.typ
typst
#import "template.typ": * #show: dept-news.with( title: "Chemistry Department", edition: [ March 18th, 2023 \ Purview College ], hero-image: ( path: "newsletter-cover.jpg", caption: [Award-wining science], ), publication-info: [ The Dean of the Department of Chemistry. \ Purview College, 17 Earlmeyer D, Exampleville, TN 59341. \ #link("mailto:<EMAIL>") ], ) = The Sixtus Award goes to Purview It's our pleasure to announce that our department has recently been awarded the highly-coveted Sixtus Award for Excellence in Chemical Research. This is a massive achievement for our department, and we couldn't be prouder. #blockquote[Prof. Herzog][ Our Lab has synthesized the most elements of them all. ] The Sixtus Award is a prestigious recognition given to institutions that have demonstrated exceptional performance in chemical research. The award is named after the renowned chemist <NAME>, who made significant contributions to the field of organic chemistry. This achievement is a testament to the hard work, dedication, and passion of our faculty, students, and staff. Our department has consistently produced groundbreaking research that has contributed to the advancement of the field of chemistry, and we're honored to receive this recognition. The award will be presented to our department in a formal ceremony that will take place on May 15th, 2023. We encourage all members of our department to join us in celebrating this achievement. #article[ = Guest lecture from Dr. <NAME> <NAME>, a leading researcher in the field of biochemistry, spoke about her recent work on the development of new cancer treatments using small molecule inhibitors, and the lecture was very well-attended by both students and faculty. In case you missed it, there's a recording on #link("http://purview.edu/lts/2023-lee")[EDGARP]. ] #article[ = Safety first Next Tuesday, there will be a Lab Safety Training. These trainings are crucial for ensuring that all members of the department are equipped with the necessary knowledge and skills to work safely in the laboratory. *Attendance is mandatory.* ] #figure( rect(width: 100%, height: 80pt, fill: white, stroke: 1pt), caption: [Our new department rectangle], ) #article[ = Tigers win big #text(weight: "bold", font: "Syne", pad(x: 12pt, grid( columns: (1fr, auto, 1fr), row-gutter: 8pt, text(32pt, align(right)[12]), text(32pt)[---], text(32pt)[4], align(right)[Tigers], none, [Eagles] ))) Another great game on the path to win the League. \ Go tigers! ] == Another Success #lorem(20) #lorem(20)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/src/elements/logic/gate.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.2": draw, coordinate #import "../ports.typ": add-ports, add-port #import "../element.typ" #let default-draw-shape(id, tl, tr, br, bl, fill, stroke) = { let f = {draw.rect(tl, br, fill: fill, stroke: stroke)} return (f, tl, tr, br, bl) } /// Draws a logic gate. This function is also available as `element.gate()` /// /// - draw-shape (function): see #doc-ref("element.elmt") /// - x (number, dictionary): see #doc-ref("element.elmt") /// - y (number, dictionary): see #doc-ref("element.elmt") /// - w (number): see #doc-ref("element.elmt") /// - h (number): see #doc-ref("element.elmt") /// - inputs (int): The number of inputs /// - fill (none, color): see #doc-ref("element.elmt") /// - stroke (stroke): see #doc-ref("element.elmt") /// - id (str): see #doc-ref("element.elmt") /// - inverted (str, array): Either "all" or an array of port ids to display as inverted /// - inverted-radius (number): The radius of inverted ports dot /// - debug (dictionary): see #doc-ref("element.elmt") #let gate( draw-shape: default-draw-shape, x: none, y: none, w: none, h: none, inputs: 2, fill: none, stroke: black + 1pt, id: "", inverted: (), inverted-radius: 0.1, debug: ( ports: false ) ) = draw.get-ctx(ctx => { let width = w let height = h let x = x let y = y if x == none { panic("Parameter x must be set") } if y == none { panic("Parameter y must be set") } if w == none { panic("Parameter w must be set") } if h == none { panic("Parameter h must be set") } if (type(x) == dictionary) { let offset = x.rel let to = x.to let (ctx, to-pos) = coordinate.resolve(ctx, (rel: (offset, 0), to: to)) x = to-pos.at(0) } if (type(y) == dictionary) { let from = y.from let to = y.to let dy if to == "out" { dy = height / 2 } else { dy = height * (i + 0.5) / inputs } let (ctx, from-pos) = coordinate.resolve(ctx, from) y = from-pos.at(1) + dy - height } let tl = (x, y + height) let tr = (x + width, y + height) let br = (x + width, y) let bl = (x, y) // Workaround because CeTZ needs to have all draw functions in the body let func = {} (func, tl, tr, br, bl) = draw-shape(id, tl, tr, br, bl, fill, stroke) func let space = 100% / inputs for i in range(inputs) { let pct = (i + 0.5) * space let a = (tl, pct, bl) let b = (tr, pct, br) let int-name = id + "i" + str(i) draw.intersections( int-name, func, draw.hide(draw.line(a, b)) ) let port-name = "in" + str(i) let port-pos = int-name + ".0" if inverted == "all" or port-name in inverted { draw.circle(port-pos, radius: inverted-radius, anchor: "east", stroke: stroke) port-pos = (rel: (-2 * inverted-radius, 0), to: port-pos) } add-port( id, "west", (id: port-name), port-pos, debug: debug.ports ) } let out-pos = id + ".east" if inverted == "all" or "out" in inverted { draw.circle(out-pos, radius: inverted-radius, anchor: "west", stroke: stroke) out-pos = (rel: (2 * inverted-radius, 0), to: out-pos) } add-port( id, "east", (id: "out"), out-pos, debug: debug.ports ) })
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/fudan.typ
typst
// This theme is based on "Clean" theme, which contains ideas from the former "bristol" theme, contributed by // https://github.com/MarkBlyth #import "polylux/logic.typ" #import "polylux/helpers.typ" #let fudan-footer = state("fudan-footer", []) #let fudan-short-title = state("fudan-short-title", none) #let fudan-color = state("fudan-color", teal) #let fudan-logo = state("fudan-logo", none) #let fudan-theme( aspect-ratio: "16-9", footer: [], short-title: none, logo: none, background-logo: image("assets/fudan-background-o.png", width: 11cm), color: teal, body ) = { let background = if background-logo != none { place( top + left, dx: 80% - background-logo.at("width", default: 11cm) / 2, dy: 25%, background-logo ) } else { none } set page( paper: "presentation-" + aspect-ratio, margin: 0em, header: none, footer: none, background: background ) set text(size: 25pt) show footnote.entry: set text(size: .6em) fudan-footer.update(footer) fudan-color.update(color) fudan-short-title.update(short-title) fudan-logo.update(logo) body } #let title-slide( title: none, subtitle: none, authors: (), date: none, watermark: none, secondlogo: none, ) = { let content = locate( loc => { let color = fudan-color.at(loc) let logo = fudan-logo.at(loc) let authors = if type(authors) in ("string", "content") { ( authors, ) } else { authors } if watermark != none { set image(width: 100%) place(watermark) } v(5%) grid(columns: (5%, 1fr, 1fr, 5%), [], if logo != none { set align(bottom + left) set image(height: 3em) logo } else { [] }, if secondlogo != none { set align(bottom + right) set image(height: 3em) secondlogo } else { [] }, [] ) v(-10%) align(center + horizon)[ #block( stroke: ( y: 1mm + color ), inset: 1em, breakable: false, [ #text(1.3em)[*#title*] \ #{ if subtitle != none { parbreak() text(.9em)[#subtitle] } } ] ) #set text(size: .8em) #grid( columns: (1fr,) * calc.min(authors.len(), 3), column-gutter: 1em, row-gutter: 1em, ..authors ) #v(1em) #date ] }) logic.polylux-slide(content) } #let slide(title: none, columns: none, gutter: none, ..bodies) = { let header = align(top, locate( loc => { let color = fudan-color.at(loc) let logo = fudan-logo.at(loc) let short-title = fudan-short-title.at(loc) show: block.with(stroke: (bottom: 1mm + color), width: 100%, inset: (y: .3em)) set text(size: .5em) grid( columns: (1fr, 1fr), if logo != none { set align(left) set image(height: 4em) logo } else { [] }, if short-title != none { align(horizon + right, grid( columns: 1, rows: 1em, gutter: .5em, short-title, helpers.current-section )) } else { align(horizon + right, helpers.current-section) } ) })) let footer = locate( loc => { let color = fudan-color.at(loc) block( stroke: ( top: 1mm + color ), width: 100%, inset: ( y: .3em ), text(.5em, { fudan-footer.display() h(1fr) logic.logical-slide.display() }) ) }) set page( margin: ( top: 4em, bottom: 2em, x: 1em ), header: header, footer: footer, footer-descent: 1em, header-ascent: 1.5em, ) let bodies = bodies.pos() let gutter = if gutter == none { 1em } else { gutter } let columns = if columns == none { (1fr,) * bodies.len() } else { columns } if columns.len() != bodies.len() { panic("number of columns must match number of content arguments") } let body = pad(x: .0em, y: .5em, grid(columns: columns, gutter: gutter, ..bodies)) let content = { if title != none { heading(level: 2, title) } body } logic.polylux-slide(content) } #let focus-slide(background: teal, foreground: white, body) = { set page(fill: background, margin: 2em) set text(fill: foreground, size: 1.5em) logic.polylux-slide(align(horizon, body)) } #let new-section-slide(name) = { set page(margin: 2em) let content = locate( loc => { let color = fudan-color.at(loc) set align(center + horizon) show: block.with(stroke: ( bottom: 1mm + color ), inset: 1em,) set text(size: 1.5em) strong(name) helpers.register-section(name) }) logic.polylux-slide(content) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10EC0.typ
typst
Apache License 2.0
#let data = ( "2": ("ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW", "Lo", 0), "3": ("ARABIC LETTER TAH WITH TWO DOTS VERTICALLY BELOW", "Lo", 0), "4": ("ARABIC LETTER KAF WITH TWO DOTS VERTICALLY BELOW", "Lo", 0), "3c": ("ARABIC COMBINING ALEF OVERLAY", "Mn", 0), "3d": ("ARABIC SMALL LOW WORD SAKTA", "Mn", 220), "3e": ("ARABIC SMALL LOW WORD QASR", "Mn", 220), "3f": ("ARABIC SMALL LOW WORD MADDA", "Mn", 220), )
https://github.com/kilpkonn/msc-thesis
https://raw.githubusercontent.com/kilpkonn/msc-thesis/master/annotation.typ
typst
#set text(lang: "ee") Rust on Ìldotstarbeline programmeerimiskeel nii sÌsteemi kui ka rakenduste tarkvara loomiseks. Erinevalt teistest programmeerimiskeeltest suudab Rust garanteerida turvalise mÀlu kasutuse kasutamata spetsiaalset mÀluhaldurit. Rust konkureerib programmeerimiskeeltega C ja C++ pakkudes arendajale paremaid tööriistu ja paremat arenduse kogemust jÀrele andmata programmi kiiruses. Rusti tÌÌbisÌsteem sarnaneb funktsionaalsete keelte tÌÌbisÌsteemidele sisaldades algebralisi andmetÌÌpe. Arendaja kogemus Rustis sarnaneb seetõttu rohkem kogemusele kõrgematasemelistes funktsionaalsetes programmeerimiskeeltes kui kogemusele C/C++ arenduses. Samas Rustis puudub hetkel tööriist, mis suudaks automaatselt genereerida avaldisi, mis vastavad oodatud tÌÌbile. Sellised tööriistad on tavalised funktsionaalsetes programmeerimiskeeltes ja me usume, et ka Rustil on taolisest tööriistast kasu. KÀesolevas töös arendame edasi Rusti ametlikku tööriista `rust-analyzer`, lisades sellele võimekuse genereerida avaldisi tÌÌpide alusel. Lisaks programmide genereerimisele uurime, kas avaldise otsingut on võimalik kasutada ka targema automaatse sõnalõpetuse loomiseks. Me arendame oma algoritmi kolme iteratsioonina. Esimene iteratsioon on kõige lihtsam ja sarnaneb suuresti algoritmile mida kasutatakse Agsys, sarnases tööriistas Agda jaoks. Teises iteratsioonis arendame algoritmi edasi muutes otsingu suuna vastupidiseks. Sooritades otsingut vastupidises suunas saame lihtsalt lisada vahepealsete vÀÀrtuste puhverdamise ning teisi optimeerimisi. Viimases versioonis muudame otsingu kahesuunaliseks. Sooritades otsingut kahes suunas, suudame leida avaldise rohkemates kohtades ilma algoritmi tööd oluliselt aeglustamata. Töö tulemuste hindamiseks jooksutame me algoritmi 155-l vabavaralisel Rusti programmil. Kustutame osa olemasolevast lÀhtekoodist, jÀttes programmi koodi "augud". NÌÌd kasutame oma algoritmi, et genereerida kood nende aukude jaoks. Mõõdame kui palju auke suudab algoritm tÀita ja kui tihti suudab algoritm genereerida tagasi originaalse lÀhtekoodi. Töö vÀljundina saadame oma algoritmi ametlikku `rust-analyzer`'i, et seda saaksid kasutada kõik Rusti arendajad. Lõputöö on kirjutatud inglise keeles keeles ning sisaldab teksti #context counter(page).at(<end>).first() lehekÌljel, #context counter(heading).at(<conclusion>).first() peatÌkki, #context counter(figure.where(kind: image)).final().first() joonist #context counter(figure.where(kind: raw)).final().first() koodinÀidist ja #context counter(figure.where(kind: table)).final().first() tabelit.
https://github.com/pklaschka/typst-hidden-bib
https://raw.githubusercontent.com/pklaschka/typst-hidden-bib/main/hidden-citations.typ
typst
MIT License
#import "lib.typ": * == Hidden Citations In some documents, it may be necessary to include items in your bibliography which weren't explicitly cited at any specific point in your document. This can easily be achieved by using the `hidden-cite` function instead of `cite` after importing the `hidden-bib` package. @hidden-bib[`hidden-cite` function] The code then looks like this: ```typ #import "@preview/hidden-bib:0.1.0": hidden-cite #hidden-cite("example1") ``` #hidden-cite("example1") === Multiple Hidden Citations If you want to include a large number of items in your bibliography without having to use `hidden-cite` (to still get autocompletion in the web editor), you can use the `hidden-citations` environment. @hidden-bib The code then looks like this: ```typ #import "@preview/hidden-bib:0.1.0": hidden-citations #hidden-citations[ @example1 @example2 ] ``` #hidden-citations[ @example1 @example2 ] #bibliography("refs.yml", style: "chicago-author-date")
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-112B0.typ
typst
Apache License 2.0
#let data = ( ("KHUDAWADI LETTER A", "Lo", 0), ("KHUDAWADI LETTER AA", "Lo", 0), ("KHUDAWADI LETTER I", "Lo", 0), ("KHUDAWADI LETTER II", "Lo", 0), ("KHUDAWADI LETTER U", "Lo", 0), ("KHUDAWADI LETTER UU", "Lo", 0), ("KHUDAWADI LETTER E", "Lo", 0), ("KHUDAWADI LETTER AI", "Lo", 0), ("KHUDAWADI LETTER O", "Lo", 0), ("KHUDAWADI LETTER AU", "Lo", 0), ("KHUDAWADI LETTER KA", "Lo", 0), ("KHUDAWADI LETTER KHA", "Lo", 0), ("KHUDAWADI LETTER GA", "Lo", 0), ("KHUDAWADI LETTER GGA", "Lo", 0), ("KHUDAWADI LETTER GHA", "Lo", 0), ("KHUDAWADI LETTER NGA", "Lo", 0), ("KHUDAWADI LETTER CA", "Lo", 0), ("KHUDAWADI LETTER CHA", "Lo", 0), ("KHUDAWADI LETTER JA", "Lo", 0), ("KHUDAWADI LETTER JJA", "Lo", 0), ("KHUDAWADI LETTER JHA", "Lo", 0), ("KHUDAWADI LETTER NYA", "Lo", 0), ("KHUDAWADI LETTER TTA", "Lo", 0), ("KHUDAWADI LETTER TTHA", "Lo", 0), ("KHUDAWADI LETTER DDA", "Lo", 0), ("KHUDAWADI LETTER DDDA", "Lo", 0), ("KHUDAWADI LETTER RRA", "Lo", 0), ("KHUDAWADI LETTER DDHA", "Lo", 0), ("KHUDAWADI LETTER NNA", "Lo", 0), ("KHUDAWADI LETTER TA", "Lo", 0), ("KHUDAWADI LETTER THA", "Lo", 0), ("KHUDAWADI LETTER DA", "Lo", 0), ("KHUDAWADI LETTER DHA", "Lo", 0), ("KHUDAWADI LETTER NA", "Lo", 0), ("KHUDAWADI LETTER PA", "Lo", 0), ("KHUDAWADI LETTER PHA", "Lo", 0), ("KHUDAWADI LETTER BA", "Lo", 0), ("KHUDAWADI LETTER BBA", "Lo", 0), ("KHUDAWADI LETTER BHA", "Lo", 0), ("KHUDAWADI LETTER MA", "Lo", 0), ("KHUDAWADI LETTER YA", "Lo", 0), ("KHUDAWADI LETTER RA", "Lo", 0), ("KHUDAWADI LETTER LA", "Lo", 0), ("KHUDAWADI LETTER VA", "Lo", 0), ("KHUDAWADI LETTER SHA", "Lo", 0), ("KHUDAWADI LETTER SA", "Lo", 0), ("KHUDAWADI LETTER HA", "Lo", 0), ("KHUDAWADI SIGN ANUSVARA", "Mn", 0), ("KHUDAWADI VOWEL SIGN AA", "Mc", 0), ("KHUDAWADI VOWEL SIGN I", "Mc", 0), ("KHUDAWADI VOWEL SIGN II", "Mc", 0), ("KHUDAWADI VOWEL SIGN U", "Mn", 0), ("KHUDAWADI VOWEL SIGN UU", "Mn", 0), ("KHUDAWADI VOWEL SIGN E", "Mn", 0), ("KHUDAWADI VOWEL SIGN AI", "Mn", 0), ("KHUDAWADI VOWEL SIGN O", "Mn", 0), ("KHUDAWADI VOWEL SIGN AU", "Mn", 0), ("KHUDAWADI SIGN NUKTA", "Mn", 7), ("KHUDAWADI SIGN VIRAMA", "Mn", 9), (), (), (), (), (), ("KHUDAWADI DIGIT ZERO", "Nd", 0), ("KHUDAWADI DIGIT ONE", "Nd", 0), ("KHUDAWADI DIGIT TWO", "Nd", 0), ("KHUDAWADI DIGIT THREE", "Nd", 0), ("KHUDAWADI DIGIT FOUR", "Nd", 0), ("KHUDAWADI DIGIT FIVE", "Nd", 0), ("KHUDAWADI DIGIT SIX", "Nd", 0), ("KHUDAWADI DIGIT SEVEN", "Nd", 0), ("KHUDAWADI DIGIT EIGHT", "Nd", 0), ("KHUDAWADI DIGIT NINE", "Nd", 0), )
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas8/3_Streda.typ
typst
#let V = ( "HV": ( ("","Múčenicy Hospódni","Na kresťí Christé prihvóşdsja, pronzájem v rúci i nózi, v rebró ÅŸe svjatóje probodén bÃœl jesí, istočája mí kápli boşéstvennaho spasénija, preblahíj, króv ÅŸe i vódu, jáko da omÃœjeÅ¡i mój hnój i skvérnu: sláva tvojéj vseščédre bláhosti."), ("","","Stradáti preterpíl jesí VladÃœko, jáko da bezstrástije vsím podási, poklaňájuščymsja tvojím strástém, i vóğnomu zakoléniju, i kopijú, i hvozdém, i trósti, jáşe dolhoterpilívno choťá preterpíl jesí: jáko da i mňí ischodátaiÅ¡i Hóspodi, rádi strástéj tvojích bezstrástije."), ("","","Júnica neskvérnaja, juncá víďašči na drévo vozdvíşena vóleju, rydájušči umíğno vopijáše: uvÃœ mňí, vozğúblenňijÅ¡eje čádo, čtó ti sónm vozdadé bezblahodátnyj jevréjskij, choťá mjá bezčádstvovati ot tebé vseÄŸubímyj?"), ("","","Ne terpğú čádo, zríti ťá na drévi usnúvÅ¡a, bódrosÅ¥ vsím dajúščaho: jáko da drévle ot prestuplénija plodá, snóm vsepáhubnym usnúvÅ¡ym, boşéstvennuju i spasíteÄŸnuju bódrosÅ¥ podási, Ďíva hlahólaÅ¡e pláčuščisja, júşe veličájem."), ("","","Sobór neprávednyj tebé na krest vozdvíşe áhnca, vzémÄŸuščaho míra prehrišénija, i kopijém tvojá rébra probodóša dolhoterpilíve, i rúki prihvozdíša tvojá i nóhi. O suróvstva zláho! Ole derznovénija! Prečístaja sijá vzyváše umíğno slezjášči."), ("","","Čtó zrímoje sijé, jéşe nÜňi víşdu VladÃœko? Íşe hórstiju vsjú tvár prečúdňi soderşáj, na drévi jákoÅŸe áhnec neprávedňi vísiÅ¡i, Slóve Bóşij, ot ráb nepokorívych povíšen? Ole terpínija! Ole tvojejá bláhosti vseščédre! Slezjášči hlahólaÅ¡e preneporóčnaja."), ("Krestobohoródičen","","Áhnca ťá jehdá áhnica i Dévaja k zakoléniju vedóma uzrí so slezámi Slóve posğídovaÅ¡e, i vzyváše: hďí tščíšisja čádo mojé? Sšéstvuju tebí sladčájÅ¡ij, ne terpğú bo ne zríti tebé Iisúse mój mnohomílostive."), ), "S": ( ("","","VoznesÃœjsja na krest Christé Bóşe, i spásl jesí čelovíčeskij ród: slávim stradánija tvojá."), ("","","Prihvozdílsja jesí na kresťí Christé Bóşe, i otvérzl jesí rájskija dvéri: slávim BoÅŸestvó tvojé."), ("Múčeničen","","Múčenicy tvojí Hóspodi, zabÜša ÅŸitéjskaja, nebréhÅ¡e o mučénijich, búduščija rádi şízni, tojá nasğídnicy javíšasja: ťímÅŸe i so ánhely rádujutsja. ŀích molítvami dáruj ğúdem tvojím véliju mílosÅ¥."), ("Krestobohoródičen","Hóspodi, ášče i na sudíšči","Hóspodi, jehdá Å¥a sólnca právednaho sólnce víďi na dréve povíšena, lučÜ skrÃœ, i luná svít vo Å¥mú preloşí: vseneporóčnaja ÅŸe tvojá Máti utróboju ujazvğášesja."), ), ) #let P = ( "1": ( ("","","Vódu prošéd jáko súšu, i jehípetskaho zlá izbişáv, IzráiÄŸÅ¥anin vopijáše: izbáviteÄŸu i Bóhu nášemu pojím."), ("","","Mnóhimi soderşím napásÅ¥mi, k tebí pribiháju spasénija iskíj, o Máti Slóva i Ďívo! Ot ťáşkich i ğútych mjá spasí."), ("","","Strastéj mjá smuščájut prilózi, mnóhaho unÃœnija ispólniti mojú dúšu: umirí otrokovíce tiÅ¡inóju SÃœna i Bóha tvojehó vseneporóčnaja."), ("","","Spása róşdÅ¡uju ťá i Bóha, moğú Ďívo, izbáviti mi sja ğútych: k tebí bo nÜňi pribihája, prostiráju i dúšu i pomyÅ¡lénije."), ("","","Nedúhujušča ťílom i dušéju, posiščénija boşéstvennaho, i promyÅ¡lénija ot tebé spodóbi jedína Bohomáti, jáko blahája, blaháho ÅŸe RodíteÄŸnice."), ), "3": ( ("","","Nebésnaho krúha verchotvórče Hóspodi, i cérkve ziÅŸdíteÄŸu, tÃœ mené utverdí v ÄŸubví tvojéj, ÅŸelánij kráju, vírnych utverÅŸdénije, jedíne čelovikoğúbče."), ("","","PredstáteÄŸstvo i pokróv şízni mojejá, polaháju ťá BohorodíteÄŸnice Ďívo, tÃœ mja okormí ko pristánišču tvojemú, blahích vinóvna, vírnych utverÅŸdénije, jedína vsepítaja."), ("","","Moğú Ďívo, dušévnoje smuščénije, i pečáli mojejá búrju razoríti: tÃœ bo Bohonevístnaja, načáğnika tiÅ¡inÃœ Christá rodilá jesí jedína prečístaja."), ("","","BlahodéteÄŸa róşdÅ¡i dóbrych vinóvnaho, blahoďijánija bohátstvo vsím istočí: vsjá bo móşeÅ¡i, jáko síğnaho v kríposti Christá róşdÅ¡i, Bohoblaşénnaja."), ("","","Ĝútymi nedúhi, i boğíznennymi strasÅ¥mí isÅ¥azájemu, Ďívo, tÃœ mi pomozí, iscilénij bo neoskúdnoje ťá znáju sokróvišče preneporóčnaja, neiÅŸdivájemoje."), ), "4": ( ("","","UslÜšach Hóspodi, smotrénija tvojehó tájinstvo: razuméch ďilá tvojá, i proslávich tvojé BoÅŸestvó."), ("","","Strastéj mojích smuščénije, kórmčiju róşdÅ¡aja Hóspoda, i búrju utiší mojích prehrišénij, Bohonevístnaja."), ("","","Milosérdija tvojehó bézdnu prizyvájušču podáşď mí, jáşe blahosérdaho róşdÅ¡aja, i Spása vsích pojúščich ťá."), ("","","NaslaÅŸdájuščesja prečístaja, tvojích darovánij, blahodárstvennoje vospivájem pínije, vídušče ťá Bohomáter."), ("","","Na odrí boğízni mojejá, i némošči nizleşášču mí, jáko blahoÄŸubíva pomozí Bohoródice, jedína prisnoďívo."), ), "5": ( ("","","Prosvití nás poveğíniji tvojími Hóspodi, i mÜšceju tvojéju vysókoju tvój mír podáşď nám, čelovikoğúbče."), ("","","Ispólni čístaja, vesélija sérdce mojé, tvojú netğínnuju dajúšči rádosÅ¥, vesélija róşdÅ¡aja vinóvnaho."), ("","","Izbávi nás ot bíd Bohoródice čístaja, víčnoje róşdÅ¡i izbavlénije, i mír vsják úm preimúščij."), ("","","Razriší mhlú prehrišénij mojích Bohonevísto, prosviščénijem tvojejá svítlosti, svít róşdÅ¡aja boşéstvennyj i prevíčnyj."), ("","","Iscilí čístaja, duší mojejá nemoşénije, posiščénija tvojehó spodóbÄŸÅ¡aja, i zdrávije molítvami tvojími podáşď mí."), ), "6": ( ("","","Molítvu prolijú ko Hóspodu, i tomú vozviščú pečáli mojá, jáko zól dušá mojá ispólnisja, i ÅŸivót mój ádu priblíşisja, i moğúsja jáko Jóna: ot tlí Bóşe, vozvedí mja."), ("","","Smérti i tlí jáko spásl jésÅ¥, sám sjá izdáv smérti, tğínijem i smértiju mojé jestestvó játo bÃœvÅ¡eje, Ďívo, molí Hóspoda i SÃœna tvojehó, vrahóv zloďíjstvija mjá izbáviti."), ("","","PredstáteÄŸnicu ťá ÅŸivotá vím, i chraníteÄŸnicu tvérdu Ďívo, i napástej rišášču molvÃœ, i nalóhi bisóv othoňájušču: i moğúsja vsehdá. Ot tlí strastéj mojích izbáviti mjá."), ("","","Jáko sťínu pribíşišča sÅ¥aşáchom, i dúš vsesoveršénnoje spasénije, i prostránstvo v skórbech, otrokovíce, i prosviščénijem tvojím prísno rádujemsja. o VladÜčice, i nÜňi nás ot strastéj i bíd spasí."), ("","","Na odrí nÜňi nemoščstvújaj leşú, i ňísÅ¥ iscilénija plóti mojéj: no Bóha i Spása míru, i izbáviteÄŸa nedúhov róşdÅ¡aja, tebí moğúsja blahój, ot tlí nedúh vozstávi mjá."), ), "S": ( ("","","Áhnca i pástyrja, i Spása míra, na kresťí zrjášči, róşdÅ¡aja ťá, hlahólaÅ¡e slezjášči: mír úbo rádujetsja, prijémÄŸa izbavlénije: utróba ÅŸe mojá horít, zrjášči tvojé raspjátije, jéşe za vsích terpíši SÃœne i Bóşe mój."), ), "7": ( ("","","Ot Judéji došédÅ¡e ótrocy v Vavilóňi inohdá, víroju Tróičeskoju plámeň péščnyj popráša, pojúšče: otcév Bóşe, blahoslovén jesí."), ("","","Náše spasénije jákoÅŸe voschoťíl jesí Spáse, ustrójiti, vo utróbu ďívyja vselílsja jesí, júşe míru predstáteÄŸnicu pokazál jesí: otéc nášich Bóşe, blahoslovén jesí."), ("","","VolíteÄŸa mílosti jehóşe rodilá jesí Máti čístaja, umolí, izbávitisja ot prehrišénij, i dušévnych skvérn, víroju zovúščym: otéc nášich Bóşe, blahoslovén jesí."), ("","","Sokróvišče spasénija, i istóčnik netğínija, ťá róşdÅ¡uju, i stólp utverÅŸdénija, i dvér pokajánija zovúščym pokazál jesí: otéc nášich Bóşe, blahoslovén jesí."), ("","","Å€ilésnyja slábosti, i dušévnyja nedúhi BohorodíteÄŸnice, ÄŸubóviju pristupájuščich k króvu tvojemú Ďívo, iscilíti spodóbi, Spása Christá nám róşdÅ¡aja."), ), "8": ( ("","","Carjá nebésnaho, jehóşe pojút vóji ánheÄŸstiji, chvalíte i prevoznosíte vo vsjá víki."), ("","","Pómošči jáşe ot tebé trébujuščyja ne prézri Ďívo, pojúščyja i prevoznosjáščyja ťá vo víki."), ("","","Nemoşénije duší mojejá isciğájeÅ¡i, i Å¥ilésnyja boğízni Ďívo, da ťá proslávÄŸu čístaja vo víki."), ("","","Iscilénij bohátstvo izlivájeÅ¡i, vírno pojúščym ťá Ďívo, i prevoznosjáščym neizrečénnoje tvojé roÅŸdestvó."), ("","","Napástej tÃœ prilóhi othoňájeÅ¡i, i strastéj nachódy Ďívo: ťímÅŸe ťá pojém vo vsjá víki."), ), "9": ( ("","","Voístinnu Bohoródicu ťá ispovídujem spasénniji tobóju Ďívo čístaja, s bezplótnymi líki ťá veličájušče."), ("","","Tóka sléz mojích ne otvratísja, jáşe ot vsjákaho licá vsjáku slézu otjémÅ¡aho, Ďívo, Christá róşdÅ¡aja."), ("","","Rádosti mojé sérdce ispólni Ďívo: jáşe rádosti prijémÅ¡aja ispolnénije, hrichóvnuju pečáğ potrebğájušči."), ("","","Svíta tvojehó zarjámi prosvití Ďívo, mrák nevíďinija othoňášči, blahovírno Bohoródicu ťá ispovídajuščich."), ("","","Na mísÅ¥i ozloblénija némošči, smirívÅ¡ahosja Ďívo, iscilí, iz nezdrávija vo zdrávije pretvorjájušči."), ), ) #let U = ( "S1": ( ("","","Víďa razbójnik načáğnika şízni, na kresťí vísjašča, hlahólaÅ¡e: ášče ne by Bóh bÃœl voplóščsja, íşe s námi raspnÃœjsja: ne bÃœ sólnce lučÜ svojá potajílo, nişé by zemğá trepéščušči trjaslásja: no vsjá terpjáj, pomjaní mja Hóspodi, vo cárstviji tvojém."), ("","","Posreďí dvojú razbójniku, mírilo právednoje obrítesja krest tvój: óvomu úbo nizvodímu vo ád Å¥ahotóju chulénija: druhómu ÅŸe lehčáščusja ot prehrišénij k poznániju Bohoslóvija. Christé Bóşe, sláva tebí."), ("Krestobohoródičen","","Áhnca i pástyrja, i izbáviteÄŸa, áhnica zrjášči na kresťí neprávedno vozdvíşena, pláčuščisja hórko vzyváše: mír úbo rádujetsja, prijémÄŸa tobóju izbavlénije: utróba ÅŸe mojá horít, zrjášči tvojé raspjátije, jéşe terpíši za milosérdije mílosti Bóşe preblahíj, bezhríšne Hóspodi. JéjÅŸe vírno vozopijím: blahoutróbije pokaşí Ďívo na nÃœ, i sohrišénij ostavlénije dáruj, poklaňájuščymsja tohó stradánijem."), ), "S2": ( ("","","Posreďí Jedéma drévo procvité smérÅ¥, posreďí ÅŸe vsejá zemlí drévo vozrastí şízň: vkusívÅ¡e bo pérvije plodá, netğínni súšče, tğínni bÃœchom: ulučívÅ¡e ÅŸe vtoróje, netğínija nasladíchomsja: krestóm bo spasájeÅ¡i jáko Bóh, ród čelovíčeskij."), ("","","V rají mja préşde drévo obnaşí, vnušénijem vráh vnosjá umerščvlénije: krestá ÅŸe drévo, şízni víčnyja oďijánija čelovíkom nosjá, vodruzísja na zemlí, i mír vés ispólnisja vsjákija rádosti. Jehóşe zrjášče voznosíma, Bóhu víroju ğúdije sohlásno vozopijím: ispólň slávy dóm tvój."), ("Múčeničen","","Vselénňij svitíla prisnosvítlaja pokazástesja víroju: múčeničeskuju vsjú vozloşívÅ¡e nadéşdu na Bóha, i mÃœslennym jeléjem Dúcha svjatáho, dušévnyja sviščÜ váša prosvitíste. ŀímÅŸe i čášy úmnyja, čelovíkom prolivájušče iscilénija jákoÅŸe vódy, cérkvi javístesja, strastotérpcy vsechváğniji. Molíte Christá Bóha, prehrišénij ostavlénije darováti, prázdnujuščym ÄŸubóviju svjatúju pámjaÅ¥ vášu."), ("Krestobohoródičen","","Ďívo iz tebé voplóščšahosja, jáko víďila jesí vozvyšájema na krest posreďí dvojú razbójniku, pláč vosprijémÅ¡i vopijáše: uvÃœ mňí čádo sladčájÅ¡eje, káko vóleju ráspjat bÃœsÅ¥, íşe hrichí vzémÄŸaj míra jáko blahoutróben? Čelovíčeskim choťá, jáko Bóh, písnem chvalénija prinosímym bÃœti tebí."), ), "S3": ( ("","Poveğínnoje tájno","Na kresťí ťá víďivÅ¡e vozvÜšena, sólnca nezachodímaho Christé, stráchom sólnce pomračísja ábije: zemğá pokolebásja, i kámenije trépetom raspadášesja, i cerkóvnaja zavísa razdrásja, i mértviji ot hrób vostáša, slavoslóvjašče strášnoje tvojé i boşéstvennoje snizchoÅŸdénije jedínaho Bóha nášeho."), ("","","Drévo hóresÅ¥ vo jedémi préşde proiznesé, drévo ÅŸe krestnoje sládkuju şízň procvité: Adám bo jadÃœj vo tğú popolzésja: mÃœ ÅŸe naslaÅŸdájuščesja plóti Christóvy oÅŸivğájemi byvájem, i oboşájemi táinstvenňi, cárstvije prijémÄŸušče prisnosúščnoje Bóşije. ŀímÅŸe i víroju zovém: sláva, Slóve, strásti tvojéj."), ("Krestobohoródičen","","SÃœna tvojehó i Bóha krestóm Ďívo, sochraňájemi prísno, bisóvskija prilóhi i kózni pobiÅŸdájem, súščuju Bohoródicu ťá voístinnu vospivájušče: i ÄŸubóviju vsí ródi blaşím prečístaja, jákoÅŸe proreklá jesí. ŀímÅŸe sohrišénij nášich ostavlénije molítvami tvojími dáruj."), ), "K": ( "P1": ( "1": ( ("","","KolesnicehoníteÄŸa faraóňa pohruzí, čudotvorjáj inohdá moiséjskij şézl, krestoobrázno porazív, i razďilív móre: IzráiÄŸa ÅŸe bihlecá piÅ¡echódca spasé, písň Bóhovi vospivájušča."), ("","","Íşe ot dréva slástnoju sňídiju mértva mjá bÃœvÅ¡aho, na kresťí Slóve umertvívyjsja, oÅŸivíl jesí, i slávoju udobríl jesí: poklaňájusja tvojéj derşávi, slavoslóvja stradánija, i blahoutróbije neisčétnoje."), ("","","Jehdá rasprostrésja na drévi vinohrád nevozďílannyj, vinó nám boşéstvennyja blahodáti istočí, serdcá veseğáščeje, i prélesti pijánstvo otňúd potrebğájuščeje, i hrichí očiščájuščeje."), ("Múčeničen","","Preispeščréni ránami velikomúčenicy, i stradánij boğízňmi ukrašájemi, krasnÃœ dobrotvoríteÄŸnomu VladÃœci predstáste so slávoju, vseslávno veseğáščesja, i bohovídny poznavájemi."), ("Múčeničen","","Síloju boşéstvennoju projavlénno ukripğájemi svjatíji, síğnaho vsjú kríposÅ¥ hubíteÄŸnuju múşeski nizloşíste: i vinčávÅ¡esja krasnó pobidíteÄŸnymi vincÃœ, rádujuščesja Bóhu predstáste."), ("Bohoródičen","","Predstojášči krestú tvojemú Hóspodi, neiskusobráčnaja, i tvojé ujazvlénije zrjášči VladÃœko, ujazvğájema hlahólaÅ¡e: uvÃœ mňí čádo, boğízni izbíhÅ¡i v roÅŸdeství tvojém, nÜňi boğíznenno terzájusja."), ), "2": ( ("","","KolesnicehoníteÄŸa faraóňa pohruzí, čudotvorjáj inohdá moiséjskij şézl, krestoobrázno porazív, i razďilív móre: IzráiÄŸa ÅŸe bihlecá piÅ¡echódca spasé, písň Bóhovi vospivájušča."), ("","","Na ťá Ďívo, nadéşdu vozloşích spasénija mojehó, hrichóvnyja skvérny vsehó mja omÃœj, i čísta soďílaj, Bóhu i SÃœnu tvojemú blahouhoÅŸdáti i ďíjati, i tohó vsesvjatómu ímeni."), ("","","Dvéri svíta, óči mojí prosvití, íşe pomračí mráčnyj zmíj Å¥móju prehrišénij, i dvéri mí otvérzi pokajánija Ďívo, i k ÅŸivotú nastávi mjá, ot plámene i Å¥mÃœ ischití."), ("","","Máti Bóşija, jáko derznovénije imúšči k róşdÅ¡emusja iz tebé, jedinoródnomu Slóvu, i Otcú sobeznačáğnomu, molí vseneporóčnaja, dúšu mojú izbáviti ot bisóvskaho ozloblénija, i ohňá, i vsjákaho mučénija."), ("","","Blahoslovén plód Bohonevísto tvojehó čréva, ímÅŸe zemníji vsí ot kğátvy izbávichomsja, blahoslovénnaja, prečístaja, neskazánnoje čúdo, nedorazumíjemoje víďinije, vsích vírnych spasénije."), ), ), "P3": ( "1": ( ("","","UtverÅŸdéj v načáği nebesá rázumom, i zémÄŸu na vodách osnovávyj, na kámeni mjá Christé zápovidej tvojích utverdí: jáko ňísÅ¥ svját, páče tebé jedíne čelovikoğúbče."), ("","","UtverÅŸdéj nebesá, i zémÄŸu osnovávyj, i móre slóvom svjazávyj, tÃœ svjázan bÃœl jesí mené rádi, i na kresťí prihvoÅŸdájem: jáko da ot úz hrichá razrišíši mjá čelovikoğúbče."), ("","","Krestnomu drévu vráh prirazívsja, umertvísja s bísy svojími zloďíjstvennymi: i vkušénijem lukávym osuÅŸdénnyj, pomílovan bÃœsÅ¥, i utverÅŸdénijem blahočéstija tvár utverdísja."), ("Múčeničen","","Mnohovídnym ránam, i mečém, i zvirém, i obnaşénijem Å¥ilésnym vdavájemi, lukávym honítelem, boşéstvenniji i dóbliji stradáğcy, i ne játy prebÜša manovénijem lúčšim."), ("Múčeničen","","Vzirájušče pomyÅ¡lénijem, i trézvennoju mÃœsliju k búduščym, i tekúščyja do koncá prenebrehóša Christóvy múčenicy slávniji: ťímÅŸe nesterpímyja boğízni preterpíša rádujuščesja."), ("Bohoródičen","","Mnohopítaja Áhnica, Áhnca zrjášči vozdvizájema na drévo neprávedňi, pláčušči vosklicáše, máterski slezjášči: i dolhoterpínije pojáše, tohó slávjašči."), ), "2": ( ("","","TÃœ jesí utverÅŸdénije pritekájuščich k tebí Hóspodi, tÃœ svít omračénnych, i pojét ťá dúch mój."), ("","","Vsé mojé ÅŸelánije k tebí dvişá, VladÜčice čístaja, plotskích mjá ÅŸelánij vskóri preminí."), ("","","Vozsijáj mí pokajánija čístyja zarí, VladÜčice dvére svíta, i hrichóv mojích mhlú potrebí."), ("","","Jedína vseneporóčnaja, poróka vsjákaho nás izbávi, i iskušénij nachoďáščich, i ohňá víčnujuščaho."), ("","","Uskorí positíti boğáščaho, prečístaja, i ot ğútyja rány izbávi mjá, i vsjákija skórbi."), ), ), "P4": ( "1": ( ("","","TÃœ mojá kríposÅ¥ Hóspodi, tÃœ mojá i síla, tÃœ mój Bóh, tÃœ mojé rádovanije, ne ostávÄŸ ňídra Ótča, i nášu niščetú positív. ŀím s prorókom Avvakúmom zovú ti: síği tvojéj sláva čelovikoğúbče."), ("","","Ród čelovíčeskij ot padénija prizvásja, jehóşe podját drévle pervozdánnyj: vsích bo soďíteÄŸ vozdvíşen bÃœsÅ¥ na drévo, pérsty okrovavğájem, i hvozďmí vóleju prihvoÅŸdájem v rúci, i v rébra kopijém probodájem."), ("","","Stá krest, i lésÅ¥ vsjá nizpadésja: tebí Spáse, obnaşénu bÃœvÅ¡u, obnaşísja čúşdij: i Adám boşéstvennaho netğínija rízoju oďíjan bÃœsÅ¥, tvár prosvitísja pomračájemu sólncu, na drévi Christé raspinájemu tí."), ("Múčeničen","","Nóvaho zakolénija, jákoÅŸe ovčáta múčenicy, poÅŸrénomu Slóvu prinesóstesja: króvnymi tečéniji, prélesti morjá izsušívÅ¡e boşéstvennoju blahodátiju , izlijánije strastéj odoÅŸdénijem čudés potrebğájete vsehdá slávniji."), ("Múčeničen","","Otsečénije udóv vsích podjáste múčenicy, i zubóv i nohtéj iskorenénije, rúk otrízanije neščádno, jazÃœka ÅŸe i nóh i sostávov Å¥ilésnych: ťímÅŸe prevelíkija spodóbistesja slávy, vsích Bóhu predstojášče."), ("Bohoródičen","","Svojehó si juncá neporóčnaja júnica víďivÅ¡i na drévo vozdvíşena, vopijáše so vosklicánijem: čádo, káko ťá zakonoprestúpnych sónm otňúd ne uščédri, uščédrivÅ¡aho í? No usmotrénijem ÄŸstívym smérti predáti neprávedno proizvóli."), ), "2": ( ("","","UslÜšach Hóspodi, smotrénija tvojehó tájinstvo: razumích ďilá tvojá, i proslávich tvojé BoÅŸestvó."), ("","","Dúšu mojú, omračénnuju prehrišéňmi, ozarí svítom prisnoďívo, jáşe sólnce róşdÅ¡aja právdy."), ("","","Iskušénij mjá ischití, i ÅŸitijá duÅ¡etğínnyja búri, i ohňá víčnaho svobodí mja Bohonevísto."), ("","","Ďívstva svjaščénnyj sosúde, i nevmistímaho jestestvóm vselénije. Dúšu mojú omračénnuju ot mnóhich strastéj, prosvití."), ("","","Vsesvjatája Bohonevísto, VladÜčice míra, tÃœ mja spasí, ot bíd izbavğájušči, i strastéj molvú othoňájušči."), ), ), "P5": ( "1": ( ("","","Vskúju mjá otrínul jesí ot licá tvojehó svíte nezachodímyj, i pokrÃœla mjá jésÅ¥ čuÅŸdája Å¥má okajánnaho? No obratí mja, i k svítu zápovidej tvojích putí mojá naprávi, moğúsja."), ("","","Da slástnaho vkušénija izbáviÅ¡i mjá, şélči dolhoterpilíve vkusíl jesí choťá: i jáko da mértvosti sovlečéši mjá Iisúse, strastéj, náh prihvozdítisja izvólil jesí na drévi: pojú tvojé blahoutróbnoje."), ("","","IstğívÅ¡uju strasÅ¥mí dúšu mojú, Slóve, nóvu tvorjá, dúšu prédal jesí Otcú, na drévi vísja, i ne terpít bezdúšnaja zemğá sijá porazumivájušči, no stráchom kolébletsja vospivájušči ťá."), ("Múčeničen","","Ukrasístesja múčenicy boşéstvennymi strásÅ¥mí udobrjájemi, i stopám posğídovavÅ¡e strasÅ¥mí vsím bezstrástije podávÅ¡emu, Slóvu jedinoródnomu, Otcá beznačáğnaho: sehó rádi s ním proslavğájetesja."), ("Múčeničen","","UstranívÅ¡esja dóğnich, nevídimyja nasğídovaste, v nebésnych vodvorjájuščesja boşéstvennych selénijich, i pričástijem boşéstvennym oboşájemi neveščéstvenno, spásovy nepobidímiji múčenicy."), ("Bohoródičen","","Stránno viďínije, víşu, vzyváše Prepítaja: káko íşe zrínijem vsjú zémÄŸu kolébÄŸaj, na drévi vozvyšájem usnúl jesí, spjáščyja ot víka choťá vozbudíti? Poklaňájusja SÃœne, tvojemú dolhoterpíniju."), ), "2": ( ("","","Útreňujušče vopijém tí, Hóspodi, spasí ny: tÃœ bo jesí Bóh náš, rázvi tebé inóho ne vímy."), ("","","Pojém ťá Ďívo vsepítaja, jáşe Slóvo Bóşije vmistívÅ¡aja vo čréve tvojém preneporóčnaja."), ("","","Ohňá nehasímaho, i čérvija izbávi mjá Máti Bóşija, jáko imúščaja jéşe mílovati cilébno."), ("","","SÅ¥iná tÃœ vírnych i derşáva vsesvjatája jesí, spasájušči ot iskušénij pojúščyja ťá."), ("","","Nedúhujuščuju dúšu mojú iscilí, róşdÅ¡aja vsích spasénije, i vzémÄŸuščaho nedúhi, prečístaja VladÜčice."), ), ), "P6": ( "1": ( ("","","Bézdna hrichóv i prehrišénij búrja mjá smuščájet, i vo hlubinú núşdnaho ríjet mjá otčájanija: no tvojú krípkuju rúku mňí prostrí jáko Petróvi, o UpráviteÄŸu, i spasí."), ("","","Vospíša nebésnyja síly vsjá i udivíšasja, na kresťí Å¥a Slóve vzirájušče vísjašča: i Adám ujázvlennyj Spáse, isciğí jázvoju tvojéju, i kğátva prohnána bÃœsÅ¥."), ("","","Razrišájetsja ot úz nerišímych čelovíčestvo, tebí Slóve plótiju svjázanu bÃœvÅ¡u: i svjazújetsja mučíteÄŸ jáko ptíca, i ot vsích vírnych naruhájem: sláva Christé blahoutróbiju tvojemú."), ("Múčeničen","","Javístesja Bohozráčniji strastotérpcy jákoÅŸe úhlije, vsjáku zločéstija véšč popağájušče blahodátiju , na úhlijach ÅŸe ohňá vsesoÅŸihájemi, i boşéstvennoje prochlaÅŸdénije prijémÄŸušče."), ("Múčeničen","","Ovčáta ístinnaho pástyrja strastonóscy javğájemi, posreďí dívijich volkóv nevreÅŸdéni prebÃœste, i skončávÅ¡e dóbre tečénije boşéstvenniji, ko ohrádu nebésnuju vselístesja."), ("Bohoródičen","","Hóspoda ťá ÅŸivotá porodích, i krásna dobrótoju páče synóv čelovíčeskich, Ďíva vzyváše: i káko nÜňi umirájeÅ¡i SÃœne, dobróty ne imíja v raspjátiji, udobrívyj vsjá manovénijem?"), ), "2": ( ("","","Očísti mjá Spáse, mnóha bo bezzakónija mojá, i iz hlubinÃœ zól vozvedí, moğúsja: k tebí bo vozopích, i uslÜši mjá, Bóşe spasénija mojehó."), ("","","Maríje, čístoje i vsečestnóje ÅŸilíšče vsích soďíteÄŸa, dúšu očiščájuščyja podáşď mí slézy, i búduščaho sudá i múki ischití mja."), ("","","Dvéri Bóşija, vchódy boşéstvennyja pokaşí smirénňij mojéj duší: v ňáşe všéd ispovídajasja, zlÃœch razrišénije Bohoródice vosprijimú."), ("","","Pučína hrichóv, i vólny otčájanija oburevájut mój úm: umilosérdisja VladÜčice, i rúku mí prostrí, i spasí mja, jáşe Spása róşdÅ¡aja."), ("","","ŀá predstáteÄŸnicu i sťínu vírniji vsí ímamy, íşe vo hlubiňí zlÃœch, i mjatéşej i skorbéj prísno bídstvujuščiji, Bohoródice, jedína vírnych pribíşišče."), ), ), "P7": ( "1": ( ("","","Bóşija snizchoÅŸdénija óhň ustyďísja v Vavilóňi inohdá. Sehó rádi ótrocy v peščí rádovannoju nohóju, jáko vo cvítnici likújušče, pojáchu: blahoslovén jesí Bóşe otéc nášich."), ("","","Uránen bÃœl jesí v rúci tvojí Christé, ímaÅŸe soďílal jesí čudesá: i rány preterpíl jesí, rány mojá vsjá isciğája. Pojú Å¥a jedíne dolhoterpilíve, zovÃœj: blahoslovén Bóh otéc nášich."), ("","","PrihvoÅŸdén bÃœl jesí v rúci tvojí i nózi hvozďmí Spáse, raspinájem, i v rébra probodén bÃœv, kápli istočája vsím ostavlénija pojúščym neprestánno, i hlahóğuščym: blahoslovén Bóh otéc nášich."), ("Múčeničen","","Lík sostávim pisnoslóvjašče Bóşija múčeniki, íşe likóm ánheÄŸskim sopričtényja, i zemnÃœja prosviščájuščyja, i vsehdá pojúščyja: blahoslovén Bóh otéc nášich."), ("Múčeničen","","Vo svjatÃœch svítlostech osvjatívÅ¡esja vselístesja, posylájušče vsím osvjaščénije ÅŸe i izbavlénije, voschvağájuščym vás boşéstvenniji múčenicy, i vospivájuščym Christá, otéc nášich Bóşe blahoslovén jesí."), ("Bohoródičen","","Nezachodímoje sólnce, káko zájde na drévi raspinájem? Ďíva vopijáše tí Slóve: i víďiv sólnce, ostávi tečénije, svitíti ne mohíj, tebí stráşdušču VladÃœko. PisnoslóvÄŸu tvojé SÃœne bezzlóbije."), ), "2": ( ("","","Ótrocy jevréjstiji v peščí popráša plámeň derznovénno, i na rósu óhň preloşíša, vopijúšče: blahoslovén jesí Hóspodi Bóşe vo víki."), ("","","Moğú Å¥a prečístaja, umertví ÅŸivúščij vo mňí hrích, i ÅŸivotá polučíti spodóbi mjá Ďívo: i části mjá izbávi támo múčimych."), ("","","Strásti razlíčnyja mjá oburevájut, róşdÅ¡aja čístaja, istóčnika bezstrástija, ťích oderşánija, i ohňá víčnaho izbávi mjá Bohoródice, molítvami tvojími."), ("","","Nrávom vóğnym sohrišáju, i poraboščájem jésm bezmístnym obÜčajem, nÜňi ko obÜčňij tvojéj mílosti pritekáju: otčájannaho spasí mja vsesvjatája Bohoródice."), ("","","Uhasí plámeň strastéj mojích, i utiší búrju sérdca mojehó, Bohomáti čístaja: i izbávi mjá prečístaja, ot bisóv mučíteÄŸstva, i ohňá víčnaho."), ), ), "P8": ( "1": ( ("","","Sedmeríceju péšč chaldéjskij mučíteÄŸ Bohočestívym neístovno razşşé, síloju ÅŸe lúčšeju spasény sijá víďiv, tvorcú i izbáviteÄŸu vopijáše: ótrocy blahoslovíte, svjaščénnicy vospójte, ğúdije prevoznosíte vo vsjá víki."), ("","","Iz kórene Christé, prozjábl jesí Jesséova voploščájem, i iskoreňájeÅ¡i izrástÅ¡eje térnije Adámova prestuplénija, vinéc nosjáj ternóv: na drévi ÅŸe prihvóşďsja, júşe ot dréva isciğájeÅ¡i izrástÅ¡uju kğátvu, i pojúščyja spasájeÅ¡i: svjaščénnicy vospójte, ğúdije prevoznosíte vo vsjá víki."), ("","","Da Bóha čelovíka soďílajeÅ¡i čelovikoğúbče, bÃœl jesí čelovík, i krestú priobščívsja v rébra probodájem, i óctom s şélčiju napojájem, otonúduÅŸe spásÅ¡ijisja tvojími strasÅ¥mí Slóve, vopijém blahodárstvenno: svjaščénnicy vospójte, ğúdije prevoznosíte Christá vo vsjá víki."), ("Múčeničen","","Svjázani bÃœvÅ¡e múčenicy, i jáko áhncy zakalájemi, i na ohní nemílostivno ispecájemi, zvirém ÅŸe otdavájemi, i v hlavÃœ usikájemi, rádovastesja rádostiju neizhlahólannoju, vopijúšče: ďíti blahoslovíte, svjaščénnicy vospójte, ğúdije prevoznosíte Christá vo víki."), ("Múčeničen","","Vincenóscy múčenicy, ánhelom sopričástnicy, íşe bezplótnyja vrahí poprávÅ¡e, molítvu sotvoríte o nás ko Hóspodu, jáko da v ÄŸubví i vo mnózi jedinomÃœsliji poÅŸivém, vopijúšče nesumňínnym sérdcem: ďíti blahoslovíte, svjaščénnicy vospójte, ğúdije prevoznosíte Christá vo víki."), ("Bohoródičen","","Boğíznenňi steňúšči, máterski vosklicáše, i utróbnaho smuščénija ne terpjášči na kresťí, vziráše k róşdÅ¡emusja iz tvojehó čréva, vopijúšči: čtó zrínije sijé čádo, káko stráşdeÅ¡i, íşe jestestvóm bezstrástnyj, vsjáko choťá ród čelovíčeskij ot strastéj svobodíti?"), ), "2": ( ("","","Carjá nebésnaho, jehóşe pojút vóji ánheÄŸstiji, chvalíte i prevoznosíte vo vsjá víki."), ("","","BohorodíteÄŸnice Ďívo, tÃœ mojá hrichí i brémja oblehčí ot prehrišénij, jáko da ťá veličáju."), ("","","Jáşe sudijú róşdÅ¡i i Bóha, moÄŸbámi blahopreminíteÄŸnymi tvojími mílostiva mňí tohó pokaşí, čístaja: jáko da spasét mjá ot víčnaho ohňá."), ("","","Prehrišénija mojá mnóha prevzydóša Bohoródice, dáşď mí nÜňi rúku pómošči, i ot plámene nehasímaho izbávi mjá nepotrébnaho."), ("","","Prosvití prečístaja, sérdca mojehó óči moğúsja, čérnostiju hrichóvnoju osÄŸiplényja, i prijátny boşéstvennaho sijánija pokaşí, jáko da javğúsja tebé rádi tvojemú SÃœnu číst."), ), ), "P9": ( "1": ( ("","","UÅŸasésja o sém nébo, i zemlí udivíšasja koncÃœ, jáko Bóh javísja čelovíkom plótski, i črévo tvojé bÃœsÅ¥ prostránňijÅ¡eje nebés. ŀím ťá Bohoródicu ánhelov i čelovík činonačálija veličájut."), ("","","Iscilíl jesí VladÃœko mojá jázvy, ujazvívsja i okrovavív rúci svojí, i k putém chodíti spasíteÄŸnym, jáko bláh naprávil mjá jesí Hóspodi, nózi iskopáv svojá na kresťí, íchÅŸe drévle rodonačáğnicy víďivÅ¡e choďášča ťá v rají, sokryváchusja."), ("","","IsprávivÅ¡usja tí na kresťí, isprávisja padÃœj padénijem vélijim pervozdánnyj. KríposÅ¥ ÅŸe vsjá padésja vráşija, vsjá ÅŸe zemğá osvjatísja króviju i vodóju, ot rébr tvojích izlijánnoju. ŀímÅŸe ťá vseščédre, neprestánno veličájem."), ("Múčeničen","","Vjáşemi svjatíji múčenicy, vjazánija lukávaho razrušíste, i úzami, jáşe preterpíste terpelívno, tohó svjazáste, i pokoríste pod nózi, studá ispólnena, i smích zrjáščym sotvoríste, blahodátiju boşéstvennoju."), ("Múčeničen","","Zemğá poloşénijem svjaščénnych múčenik moščéj osvjatísja: íbo istóčnik istočájušč iscilénij vsjáčeskich sijá boşéstvennaho sÅ¥aÅŸavájet, strásti Å¥ilésnyja i dušévnyja neprestánno isciğájušči, i vreÅŸdénije bisóvskoje otrivájušči boşéstvennoju blahodátiju ."), ("Bohoródičen","","IzbíhÅ¡i boğíznej máternich vo vrémja roÅŸdénija, dolhoterpilíve, jehdá ÅŸe tí nÜňi strásti vólňij pričastívÅ¡usja, i boğízni prijímÅ¡u, poboğích utróboju, i dušéju boğízni ispólnichsja, prečístaja vopijáše, júşe dostójno veličájem."), ), "2": ( ("","","Ustrašísja vsják slúch neizrečénna Bóşija snizchoÅŸdénija, jáko vÜšnij vóleju sníde dáşe i do plóti, ot ďivíčeskaho čréva bÃœv čelovík: ťímÅŸe prečístuju Bohoródicu vírniji veličájem."), ("","","Uščédri prečístaja, okajánnuju mojú dúšu, i umertví strásti hubíteÄŸnyja, i mučíteÄŸnoje nedoumínije otÅŸení: strují ÅŸe sléz svjatÃœja dáruj prisnoÅŸivótnyja, ímiÅŸe izbávÄŸusja ÅŸdúščaho mjá ğútaho osuÅŸdénija."), ("","","SÅ¥iná christijánom, i pribíşišče tvérdoje míru, v némÅŸe spasájemsja, tÃœ jesí Ďívo čístaja Bohonevísto: iz tebé bo Bóh voplotívsja, tebé vsím podadé pokróv spasíteÄŸnyj. ŀímÅŸe čístaja, spasí mja nedostójnaho."), ("","","Beznačáğne Slóve Ótčij, i SÃœne mój, i svjatómu Dúchu soprestóğnyj, káko svojí prečísÅ¥iji dláni na kresťí prostérl jesí? Čtó nÜňi tolíkaja tvojá niščetá, prebláhíj? Predstojášči tvojemú raspjátiju, vopijáše vseneporóčnaja."), ("","","Iskápajušči boşéstvennuju sládosÅ¥, jáşe vsích sládosÅ¥ róşdÅ¡aja, usladí dúšu mojú, ohorčénnuju jádom zmíja, otčuÅŸdájušči mjá hórkaho hrichá vsehdá chodátajstvom tvojím, predstáteÄŸnice vírnych nepostÃœdnaja."), ), ), ), "CH": ( ("","","Moiséjev şézl proobraşáše čéstnÃœj krest tvój Spáse náš: ťím bo spasájeÅ¡i jáko iz hlubinÃœ morskíja, ğúdi tvojá čelovikoğúbče."), ("","","Jéşe drévle vo Jedémi v rají, drévo sňídnoje prozjabló jésÅ¥ posreďí sadóv: cérkov ÅŸe tvojá Christé, krest tvój procvité, istočájušč vsemú míru şízň. No óno úbo umertví sňídiju jádÅ¡aho Adáma: sijé ÅŸe şíva sotvorí, víroju spásÅ¡asja razbójnika: jehóşe spasénija pričástniki i nás javí Christé Bóşe, íşe strástiju tvojéju razrušív, jáşe na nÃœ kózni vráşija, i spodóbi nás cárstvija tvojehó Hóspodi."), ("Múčeničen","","Múčenicy Christóvy nepobidímiji, pobidívÅ¡e lésÅ¥ síloju krestnoju, vosprijáste blahodáť víčnyja şízni, mučítelej preščénija ne ubojávÅ¡esja, múkami uraňájemi veselístesja: i nÜňi króvi váša bÜša iscilénija dušám nášym. Molíte spastísja dušám nášym."), ("Krestobohoródičen","","Na kresťí povíšena zrjášči čístaja tebé róşdÅ¡aja Hóspodi, i blíz bÃœvÅ¡i, pláčušči hlahólaÅ¡e: čádo, čtó sijá stráşdeÅ¡i plótiju, i tščíšisja bezčádstvovati mjá? Potščísja proslávitisja, jáko da vozvelíčusja strástiju tvojéju."), ), ) #let L = ( "B": ( ("","","Pomjaní nás, Christé Spáse míra, jákoÅŸe razbójnika pomjanúl jesí na drévi: i spodóbi vsích jedíne ščédre, nebésnomu cárstviju tvojemú."), ("","","Åœezlóm Moiséj krest voobraşája, razďiğáše hlubinú, ğúdi IzráiÄŸteskija prevoďá: mÃœ ÅŸe tohó voobraşájušče, mÃœslennyja vrahí pobiÅŸdájem."), ("","","Drévle Jákov blahoslovğája ótroki, sÃœny synóv svojích, rúci premiňája prostiráše, známenaja tvój krest Christé Spáse, ímÅŸe vsí ot kğátvy svobodíchomsja."), ("","","Strástém Christóvym revnújušče strastotérpcy, múki hórkija podjáste múşeski, i netğínnymi vincÃœ vinčávÅ¡esja, na nebesích ÅŸiveté."), ("","","Sláva Otcú jedínomu bezsmértnomu: sláva SÃœnu vo víki ÅŸivúščemu: sláva kúpno Dúchu vsesvjatómu, vsjú tvár osvjaščájuščemu."), ("","","Iz ďivíčeskaho čréva tvojehó čístaja, vozsijá SoďíteÄŸ sólnca i lunÃœ: jehóşe zrjášči povíšena na drévi, vsjá tvár kolebášesja."), ), )
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/06-features-2/features-2.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/heading.typ": chapter #import "/template/components.typ": note #import "/lib/glossary.typ": tr #show: web-page-template #chapter( label: <chapter:substitution-positioning> )[ // Substitution and Positioning Rules #tr[substitution]和#tr[positioning]规则 ] // As we have seen, OpenType Layout involves first *substituting* glyphs to rewrite the input stream, and then *positioning* glyphs to put them in the right place. We do this by writing collections of *rules* (called lookups). There are several different types of rule, which instruct the shaper to perform the substitution or positioning in subtly different ways. 从䞊䞀章我们胜知道OpenType的#tr[layout]过皋分䞺了䞀䞪阶段銖先是#tr[substitution]规则将蟓入的#tr[glyph]流重写然后是#tr[positioning]规则将#tr[glyph]们安排到正确的䜍眮䞊。我们通过猖写规则集也就是#tr[lookup]可以控制这䞀过皋。而规则具有䞍同的类型它们分别甚䞍同的方匏来执行具䜓的#tr[substitution]和#tr[positioning]操䜜。 // In this chapter, we'll examine each of these types of rule, by taking examples of how they can be used to layout global scripts. In the next chapter, we'll look at things the other way around - given something we want to do with a script, how can we get OpenType to do it? But to get to that stage, we need to be familiar with the possibilities that we have at our disposal. 圚本章䞭我们将䌚介绍所有类型的规则并䞟䟋诎明它们圚倄理#tr[global scripts]的#tr[layout]过皋䞭起到了什么䜜甚。䞋䞀章匀始则䌚换䞀䞪方向介绍圚给定某种#tr[script]的条件䞋OpenType是劂䜕倄理它的。䜆圚匀始灵掻运甚之前我们銖先芁足借了解工具箱䞭的各种工具。
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/bugs/raw-color-overwrite.typ
typst
Apache License 2.0
// Test that the color of a raw block is not overwritten --- #show raw: set text(fill: blue) `Hello, World!` ```rs fn main() { println!("Hello, World!"); } ```
https://github.com/Enter-tainer/typst-preview
https://raw.githubusercontent.com/Enter-tainer/typst-preview/main/docs/ebook.typ
typst
MIT License
#import "@preview/book:0.2.2": * #import "./templates/gh-ebook.typ" as ebook #show: ebook.project.with(title: "Typst Preview Book", spec: "book.typ") // set a resolver for inclusion #ebook.resolve-inclusion(it => include it)
https://github.com/kdog3682/2024-typst
https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/ham-components.typ
typst
#import "util.typ": * #let ham-title-1(s, tags: none) = { if exists(tags) { cr-flex-row( heading(s), cr-hash-tags(tags) ) line(length: 100%) } else if exists(tags) { } else { heading(s) line(length: 100%) } }
https://github.com/barddust/Kuafu
https://raw.githubusercontent.com/barddust/Kuafu/main/src/BeforeMathematics/build.typ
typst
#{ import "/config.typ": project import "/mathenv.typ": * show: mathenv-init project( "倞父数孊基础", "0.1", "BeforeMathematics", ( "intro.typ", "logic.typ", "proof.typ", "set.typ", ), bio: false ) }
https://github.com/FlyinPancake/bsc-thesis
https://raw.githubusercontent.com/FlyinPancake/bsc-thesis/main/thesis/preamble.typ
typst
#let student_surname = text[*Pálvölgyi*] #let student_names = text[*Domonkos*] #let student_name_hu = [#student_surname #student_names] #let student_name_en = [#student_names #student_surname] #let consultant = text[*Dr. <NAME>*, assosiate professor] #let second_consultant = text[*<NAME>*, PhD student] #let external_consultant = text[*<NAME>*, <NAME>] #let today = datetime.today() #let show_today = today.display("[day] [month repr:long] [year]") #let months_hu = ("január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december") #let show_today_hu = [#today.year(). #months_hu.at(today.month() - 1) #today.day().]
https://github.com/ngoetti/knowledge-key
https://raw.githubusercontent.com/ngoetti/knowledge-key/master/template/sections/03-terraform.typ
typst
MIT License
#import "../utils.typ": * = Terraform The idea of Terraform is to help provision infrastructure (Infrastructure as code). It has support for all common cloud provider. Terraform and Ansible are complementary. Terraform deals with the infrastructure stack, Ansible deals with the application stack. In Terraform you interact with Provider Plugins. A provider converts the terraform syntax to something that the SDK can consume. The SDK then sends API calls to the cloud provider (for example AWS). The different plugins are managed by the community (AWS, GCP, Azure, ...). #sourcecode[```yaml provider "aws" { access_key = "<AWS_ACCESS_KEY>" secret_key = "<AWS_SECRET_KEY>" region = "us-east-1" } ```] #sourcecode[```yaml resource "aws_instance" "excercise_0010" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" tags = { Name = "HelloWorld" Terraform = true } } ```] *Terraform workflow* - Write your Terraform stuff - Let Terraform plan the changes that must be applied - Let Terraform apply the changes *Common Terraform commands* - `terraform init` (Initialize Terraform, perform where the .tf files are located) - `terraform plan` (tells the operator what’s going to be changed) - `terraform apply` (applies the changes) - `terraform destroy` (This command figures out what has been done and undo all the changes / Folder Specific) *`terraform.tfstate` file*\ This file knows what has already been deployed. So, if you run terraform apply twice in a row, it will know that there is nothing to do. When you manually change something (e.g using the AWS web UI), terraform will revert your changes as the .tf files are the single source of truth. Terraform creates the terraform.tfstate file the first time you run the command terraform apply. Any other times it makes a 3-way diffs from the state’s NEW, EXISTING and PREVIOUS to get a full picture of the current situation. State files can get corrupted (not that often, but it can happen). *References*\ References in Terraform are like variables. You can reference references to get actual values defined in other places of your Terraform script. *Output*\ Output are return values of a function. You ultimately define references, which you want to display at the end of terraform apply. #sourcecode[```tf output "example-ip" { value = aws_instance.excercise_0010.public_ip description = "The public IP of the instance" } ```] *Data*\ The data is an input for the Terraform provider. It uses the cloud to look up data and feed this data into the terraform script. -> `data "aws_ami "latest_ubuntu" {...}` *Variables*\ If a variable is defined without a default value, it will prompt the operators to enter the value. #sourcecode[```tf variable "port" { description = "The port to expose on the server" type = number default = 8080 } ```] Variables can also be overwritten as an argument or environment variable. *Organization (Best practice):* - Create one folder for each environment - Every folder gets its own state file *Module (Code re-use)* - A module is just re-usable code - A module can be invoked and supplied with all variables
https://github.com/ntjess/toolbox
https://raw.githubusercontent.com/ntjess/toolbox/main/examples/main.typ
typst
#import "/toolbox.typ": git-graph #import git-graph: * #set page(width: auto, height: auto, fill: black) #cetz.canvas({ git-graph({ branch[main] commit[initial commit] branch[feature] branch[feature2] // Or pass branch instead of checking out commit(branch: "feature")[commit 1] commit(branch: "feature2")[commit 2] // git-graph remembers its branch if none is specified commit[commit 3] checkout("main") branch[hotfix] commit[bugfix] checkout("feature") merge("hotfix", message: [apply hotfix]) checkout("main") merge("feature", message: [merge feature]) tag[v1.0.0] checkout("feature2") merge("main") commit[commit 4] checkout("main") merge("feature2") tag[v2.0.0rc1] background-lanes() }) })
https://github.com/thanhdxuan/dacn-report
https://raw.githubusercontent.com/thanhdxuan/dacn-report/master/report-week-5/contents/02-introduce.typ
typst
= Tổng quan Báo cáo tuần 5 của nhóm tập trung vào giải quyết những vấn đề theo sá»± hướng dẫn của GVHD (Thầy Quang), bao gồm: - Tìm kiếm dữ liệu tin cậy về chủ đề *_Loan Approval Prediction_* và nghiên cứu, áp dụng những kỹ thuật khai phá dữ liệu lên đó. - Bước đầu phân tích các yêu cầu chức năng, phi chức năng, vẜ sÆ¡ đồ use-case cho website của bộ cÃŽng cụ.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/frac_08.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test precedence. $ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \ 1.2/3.7, 2.3^3.4 \ 🏳‍🌈[x]/2, f [x]/2, phi [x]/2, 🏳‍🌈 [x]/2 \ +[x]/2, 1(x)/2, 2[x]/2 \ (a)b/2, b(a)[b]/2 \ n!/2, 5!/2, n !/2, 1/n!, 1/5! $
https://github.com/pascalguttmann/typst-template-report-lab
https://raw.githubusercontent.com/pascalguttmann/typst-template-report-lab/main/template/chapter/summary.typ
typst
MIT License
= Summary and Discussion
https://github.com/hewliyang/fyp-typst
https://raw.githubusercontent.com/hewliyang/fyp-typst/main/conclusion.typ
typst
#set heading(numbering: "1.") = Conclusion To recap, in this work, we have achieved the following: 1. Establish the basics for understanding speech processing and TTS 2. Curated a large dataset for training NISQA & MOSNet style of supervised models 3. Published these datasets for use by the public on the HuggingFace Hub 4. Reproduced the results of NISQA including pre-training and transfer learning 5. Analysed the potential pitfalls of MOS predictors in out-of-distribution scenarios 6. Explored alternative metrics and the use of self-supervised features in existing architectures. Our work has demonstrated the inherent limitations of relying on Mean Opinion Score (MOS) as the sole metric for evaluating synthetic speech quality, particularly in light of the rapid advancements in modern speech synthesis technologies. While MOS has served as a convenient benchmark for many years, its relative nature and susceptibility to various biases, including the absence of well-defined anchors @chiang2023reportdetailssubjectiveevaluation, render it an unreliable measure of absolute quality. Our experiments highlight the significant influence of lower-quality systems acting as anchors, the impact of introducing higher-quality systems on historical ratings, and the potential saturation of the MOS scale in the face of increasingly natural-sounding synthetic speech. These findings underscore the urgent need for a paradigm shift in speech synthesis evaluation methodologies. Relying solely on MOS, especially in the context of training automatic MOS predictors, risks perpetuating the problem of reliably predicting an unreliable score. Future work should focus on developing more robust and nuanced evaluation protocols that address the limitations of ACR. This includes exploring the use of standardized anchors in ACR, investigating alternative protocols like MUSHRA with its hybrid rating/ranking approach @le_maguer_limits_2024, and incorporating public leaderboards testing such as the TTS Arena. By embracing a more holistic approach, we can better characterize the true advancements in speech synthesis technology and move beyond the limitations of MOS. The codebases used through this work can be accessed at: - Training & evaluation codebase - #link("https://github.com/hewliyang/nisqa") - Typesetting (Typst) and diagrams - #link("https://github.com/hewliyang/fyp-typst") - Blizzard Challenge datasets from 2008 to 2023 - #linebreak()#link("https://huggingface.co/datasets/hewliyang/nisqa-blizzard-challenge-mos") - VCC datasets - #link("https://huggingface.co/datasets/hewliyang/nisqa-vcc-mos")
https://github.com/0x1B05/english
https://raw.githubusercontent.com/0x1B05/english/main/cnn10/content/20240312.typ
typst
#import "../template.typ": * #pagebreak() = 20240312 Hello, Superstar! And welcome to CNN10, #strike[Well, I'll tell you what let you decide and what to think.]where I tell you the what, letting you decide what to think. I'm *Coy Wire*. == TikTok And we begin #strike[ at ] #underline()[_on_] nation's capital, #strike[ of ] where House *lawmakers* are quickly moving *ahead* on legislation that could possibly ban the popular social media app TikTok from the United States. TikTok is used by about 170 million of Americans#strike[. But], but this measure is looking to prohibit TikTok from #strike[the USA] U.S. app stores unless the app is no longer connected to ByteDance, its parent company, which is based in China. Some lawmakers are concerned that TikTok could possibly enable the Chinese government to have too much information about its users#strike[. A legend], alleging that #strike[is] it's a possible national security threat. On the other side, TikTok denies #strike[this] these claims and believes this legislation is #strike[in] an attack #strike[of] on #strike[the] First #strike[man] *Amendment* rights. #strike[ This propose to .. has part ... support, ]This *proposed bill* has bipartisan support and is scheduled to be voted by the house quickly. If the bill eventually does make its way to President Biden's desk, the White #strike[House's] House says Biden would sign it. Now if this proposed bill is put into the law, it will allow TikTok about 5 months to cut ties with ByteDance. If ties were not to be cut, this measure would prohibit TikTok to be downloaded on app stores in the U.S. Here's are *Manu Raju* with more. #strike[ The house ... plan to ... legislation, ... ]The House are *plowing ahead with* the plan to *take up legislation* to essentially ban TikTok if the Chinese firm, ByteDance doesn't sell it. *They are trying to* force that sale #strike[ . That's .. because ... ] because of concerns that Chinese government is too close to private information of Americans. They are alleging that Chinese government #strike[ are easy to .. ] *is interfering* with that information and could #strike[ exploded something ] *exploit it, something* that ByteDance has furious denied. But #strike[ remember this] nevertheless, this #strike[ is why the ... ] #underline[_has wide bipartisan_] support approved by *the House Energy and Commerce Committee* last week, 50 to nothing. #strike[ It's ] That is something that rarely seen on *Capital Hill*, #underline[_but that bipartisan support ultimately forcing the House Majority Leader to_] put this bill on the *floor* very quickly. *<NAME> said* he #strike[will] would take #underline[_up_] this measure #strike[the fully household, and] #underline[_ the full House in_] just a matter of days. That doesn't the mean though TikTok #underline[_isn't_] trying to kill it. #underline()[_In fact_], #strike[And ByteDance] that's ByteDance exactly #strike[_would_] #underline[_what they're_] trying to do #strike[that top]. #underline[_The top Republican who chairs the Energy and Commerce Committee told me that_] she is getting flooded with phone calls over people opposed to the efforts. Yes, we've been flooded with calls, #underline[_record amounts of calls_]. Any member of *the Energy and Commerce Committee* that voted yesterday has been flooded. #underline[_The co-sponsors have been flooded._] TikTok actually put up a notice #strike[ that ] #underline[_where_] they blocked an individual #underline[_to actually get on TikTok_] unless you called #underline[_your member_] of Congress and told them #underline[_not to vote for_] this legislation. But that's just a example of how they can manipulate data and influence on Americans #underline[_for their agenda_] But what #underline[_will happen in the Senate?_] That was a completely different question. #strike[ All together year ]Altogether here, #underline[_the senators_] has some #strike[ other ] of their own ideas #underline[_, but it could_] take some time to get through. But if it does become a #underline[_law_] , president Biden said, he will sign it. === hard They're trying to force that sale,.. === words and phrases ==== words - _lawmakers_ - _allege_ - _First Amendment_ - _proposed bill_ - _bipartisan_ - _plow_ - _exploit_ - _nevertheless_ - _Capital Hill_ - _House Energy and Commerce Committee_ - _House Majority Leader_ - _the top Republican_ ==== phrases - _look to_ - _move ahead on legislation_ - _put into_ - _cut ties with ..._ - _plow ahead with ...(plan..)_ - _interfere with_ - _put the bill on the floor_ - _take up this measure_ - _a matter of days_ - _for one's agenda_ === 回译 ==== 原文 Hello, Superstar! And welcome to CNN10, where I tell you the what, letting you decide what to think. I'm Coy Wire. And we begin on nation's capital, where House lawmakers are quickly moving ahead on legislation that could possibly ban the popular social media app TikTok from the United States. TikTok is used by about 170 million of Americans, but this measure is looking to prohibit TikTok from U.S. app stores unless the app is no longer connected to ByteDance, its parent company, which is based in China. Some lawmakers are concerned that TikTok could possibly enable the Chinese government to have too much information about its users, alleging that it's a possible national security threat. On the other side, TikTok denies these claims and believes this legislation is an attack on First Amendment rights. This proposed bill has bipartisan support and is scheduled to be voted by the house quickly. If the bill eventually does make its way to President Biden's desk, the White House says Biden would sign it. Now if this proposed bill is put into the law, it will allow TikTok about 5 months to cut ties with ByteDance. If ties were not to be cut, this measure would prohibit TikTok to be downloaded on app stores in the U.S. Here's are Manu Raju with more. The House are plowing ahead with the plan to take up legislation to essentially ban TikTok if the Chinese firm, ByteDance doesn't sell it. They are trying to force that sale because of concerns that Chinese government is too close to private information of Americans. They are alleging that Chinese government is interfering with that information and could exploit it, something that ByteDance has furious denied. But nevertheless, this has wide bipartisan support approved by the House Energy and Commerce Committee last week, 50 to nothing. That is something that rarely seen on Capital Hill, but that bipartisan support ultimately forcing the House Majority Leader to put this bill on the floor very quickly. <NAME> said he would take up this measure the full House in just a matter of days. That doesn't the mean though TikTok isn't trying to kill it. In fact, that's ByteDance exactly what they're trying to do. The top Republican who chairs the Energy and Commerce Committee told me that she is getting flooded with phone calls over people opposed to the efforts. Yes, we've been flooded with calls, record amounts of calls. Any member of the Energy and Commerce Committee that voted yesterday has been flooded. The co-sponsors have been flooded. TikTok actually put up a notice where they blocked an individual to actually get on TikTok unless you called your member of Congress and told them not to vote for this legislation. But that's just a example of how they can manipulate data and influence on Americans for their agenda But what will happen in the Senate? That was a completely different question. Altogether here, the senators has some of their own ideas , but it could take some time to get through. But if it does become a law , president Biden said, he will sign it. ==== 参考翻译 嗚倧明星欢迎收看CNN10我告诉䜠事情的真盞让䜠自己去思考。我是Coy Wire。我们从囜家銖郜匀始䌗议院议员们正圚迅速掚进䞀项立法可胜䌚犁止流行的瀟亀媒䜓应甚TikTok圚矎囜的䜿甚。 TikTok被倧纊1.7亿矎囜人䜿甚䜆这项措斜旚圚犁止TikTok圚矎囜应甚商店䞊架陀非该应甚䞍再䞎其总公叞字节跳劚有联系而字节跳劚总郚䜍于䞭囜。䞀些议员担心TikTok可胜䌚让䞭囜政府获埗过倚有关其甚户的信息声称这可胜构成囜家安党嚁胁。及䞀方面TikTok吊讀了这些诎法并讀䞺这项立法是对第䞀修正案权利的攻击。这项拟议的法案埗到了䞀党的支持并计划圚䌗议院迅速投祚衚决。劂果这项法案最终送到拜登总统的桌子䞊癜宫衚瀺拜登将筟眲。现圚劂果这项拟议的法案成䞺法埋它将允讞TikTok有倧纊5䞪月的时闎䞎字节跳劚解陀联系。劂果联系没有解陀这项措斜将犁止圚矎囜的应甚商店䞋蜜TikTok。接䞋来是Manu Raju的曎倚报道。 䌗议院正圚积极掚进计划准倇立法犁止TikTok劂果䞭囜公叞字节跳劚䞍出售它。他们试囟迫䜿出售因䞺他们担心䞭囜政府䞎矎囜人的私人信息过于接近。他们声称䞭囜政府干预这些信息并可胜加以利甚而字节跳劚已经区烈吊讀了这䞀点。䜆尜管劂歀这䞀立法埗到了广泛的䞀党支持䞊呚由䌗议院胜源和商䞚委员䌚以50祚对零祚通过。这圚囜䌚山䞊是眕见的事情䜆最终是䞀党的广泛支持迫䜿䌗议院倚数党领袖迅速将这项法案提䞊议皋。<NAME>衚瀺他将圚几倩内让䌗议院党䜓议员投祚。䜆这并䞍意味着TikTok没有反击。事实䞊这正是字节跳劚正圚做的。䞻持胜源和商䞚委员䌚的最高共和党人告诉我她收到了倧量反对这䞀努力的电话。 是的我们收到了倧量电话创纪圕的电话。昚倩投祚的任䜕䞀名胜源和商䞚委员䌚成员郜收到了倧量来电。联合发起人也收到了倧量来电。TikTok实际䞊发垃了䞀则通知阻止䞀䞪人进入TikTok陀非䜠给囜䌚议员打电话告诉他们䞍芁投祚支持这项立法。䜆这只是他们劂䜕操纵数据并圱响矎囜人以笊合他们的计划的䞀䞪䟋子。 䜆圚参议院䌚发生什么这是䞀䞪完党䞍同的问题。参议员们有䞀些自己的想法䜆可胜需芁䞀些时闎才胜通过。䜆劂果它成䞺法埋拜登总统衚瀺他将筟眲。 ==== 1st Hello, superstar! Welcome to CNN10, where I tell you the what, #strike[let] #underline[letting] you to think. I'm Coy Wire. Let's #strike[start with the capital of the country] #underline[begin on the nation's capital], #strike[senators are taking up a legislation rapidly, which may ban the usage of the popular app "TikTok" in U.S.] #underline[where the House lawmakers are quickly *moving ahead on legislation* that could possibly ban the popular media app TikTok from the United States.] TikTok #strike[was] is used by 170 million Americans, but this #strike[legislation will ban "TikTok"] #underline[measure is *looking to* prohibit TikTok] from U.S. app stores#strike[,] unless it #strike[cut ties with] #underline[is no longer connected to] #strike[its parent company, ByteDance] #underline[Bytedance, its parent company, which is based] in China. Some lawmakers #strike[concern] #underline[are concerned] that TikTok #strike[are likely to make] #underline[could possibly *enable*] Chinese government #strike[achieve] #underline[to have] too much information #strike[of] #underline[about] its users, #strike[and claimed which would be a safety threat to the U.S.] #underline[alleging that it's a possible *national security threat*.] On the other side, TikTok denies these #underline[claims] and #strike[consider] #underline[believes] the legislation #strike[as] #underline[is] an attack #strike[of] #underline[on] First Amendment #underline[rights.] The proposed bill has #strike[a wide] bipartisan support, and #strike[soon will be ... in] #underline[*is sheduled to* be voted by] the House quickly. If #strike[this legislation] #underline[the bill] #strike[is eventually sent] #underline[does *make its way*] to President Biden's desk, the White House said, Biden #strike[will] #underline[would] sign it. Now , if the proposed bill #strike[becomes] #underline[is put into] a #strike[legislation] #underline[law], it will allow TikTok #underline[about 5 months to] #strike[cut the tie] #underline[cut ties] with ByteDance#strike[ in 5 month]. If #strike[the tie isn't] #underline[ties *were not to be*] cut, #strike[the legislation] #underline[this measure] #strike[will ban downloading TikTok] #underline[would prohibit TikTok to be downloaded] from the app store in the U.S. Here are Manu Raju with more: The House are plowing ahead with #strike[taking up] #underline[the plan to take up] the legislation, being ready to ban TikTok #strike[from the U.S. app stores] if #underline[the Chinese firm, ]ByteDance refuses to sell it. #strike[They will force this sell,] #underline[They are trying to force that sell] #strike[for they concerned] #underline[because of concerns] that Chinese government is too close #strike[with the] #underline[to] private information of Americans. They are alleging Chinese government #strike[interfere] #underline[is interfering] with that information and #underline[could] exploit it#strike[. However, ByteDance has denied these claims.] #underline[*, something that ByteDance has furiously denied.*] But *nevertheless*, this legislation has wide bipartisan support #strike[that] #underline[approved by] the House Energy and Commerce Committee#strike[ voted for 50 to nothing last week] last week, 50 to nothing#strike[, which is] #underline[. That is something] rarely seen #strike[in the House Hill.] #underline[on Capital Hill,] but the #underline[wide] bipartisan support forced the majority leader to #strike[propose this legislation] #underline[put this bill on the floor very quickly]. <NAME> said, he will #strike[let all the senators vote] #underline[take up this measure the full House] in #underline[just] a matter of #strike[few] days. Yet it doesn't mean TikTok #strike[didn't ...] #underline[isn't trying to kill it.] In fact, that's exactly what TikTok is #strike[doing] #underline[trying to do]. The #strike[... of] #underline[Top Republican who chairs] the Energy and Commerce Committee told me that she #strike[was flooded by calls opposing these efforts] #underline[is *getting flooded with phone calls over people opposed to the efforts*]. Yes, we #strike[received enormous calls, a record of numbers] #underline[have been flooded with calls, *record amounts* of calls]. Each member of the Energy and Commerce Committee that voted yesterday has been flooded. The co-sponsors #strike[was] #underline[have been] flooded. TikTok put up a notice to block an individual #strike[from entering it] #underline[to get on TikTok] unless they call their #strike[senators] #underline[members of Congress] and told them not to #strike[support] #underline[vote for] this legislation. But this is just #strike[one case] #underline[a example of] how they manipulate data and influence #underline[on] Americans #strike[to ...] #underline[for] their agenda. But what will happen #strike[to senate] #underline[in the Senate]? This is a totally different question. Senators have their own ideas, but it #strike[takes] #underline[could take] some time to get through. But if it #underline[does] become a law, President Biden says, he will sign it. == Muslim #strike()[Next,] #underline()[_Next up_] in the Muslim calendar, one of the holist #strike()[secret months] #underline()[_most sacred months_] #strike()[, it's] #underline()[_is_] the ninth month, or *Ramadan*. Several Muslim countries announced the Monday as the first day of Ramadan, and the holy month #underline()[_of fasting,_] where Muslim may not consume food or drinks from sunrise and sunset. The exact start date of Ramadan changes because it's based on #underline()[_*clerics* seeing a *crescent*_] or new moon as the *Islamic* calendar follows the lunar cycle. There were #underline()[_hopes of a possible ceasefire in the Gaza Strip_] before the Ramadan, but both Hamas and *Israel* could not reach a deal. While the war goes on, there's *humanitarian* crisis that continues to *grapple the Gaza Strip* The U.S. #underline()[_is teaming up_] with several other nations by airdropping #underline()[_aid_] into Gaza , but #underline()[_aid_] agencies recommended it would be much more efficient if this supplies were transported on the ground. Our chief international *correspondent*, *Clarissa Ward*, is here to give us the why. From the #strike()[house] #underline()[_health_] ministry inside Gaza are now saying that 25 have died as a result of #underline()[_acute malnutrition and dehydration_]. #strike()[They] #underline()[_CNN_] cannot independently confirm that, because the international journalists are not allowed into Gaza to report on the ground. But it certainly #strike()[jails] #underline()[_gels_] with what we have #strike()[here] #underline()[_been hearing_] from the groups like the *U.N.*, who has warned that hundreds of thousands of #underline()[_of Gazans in the northern_] part of the *enclave* are one step away from *famine*, who has announced as you mentioned that four out of five(4/5) people -- or 4/5 household, I should say specifically, do not have access any longer to clean water. And #underline()[_while these_] airdrops show a certain level of intention and #strike()[good will] #underline()[_goodwill_] they#underline()[_,_] according to #underline()[_aid_] organizations#underline()[_,_] are not terribly efficient and effective in terms of #underline()[_mechanism for actually distributing aid._] We heard from one humanitarian worker who said #strike()[there was] #underline()[_they're_] a great *photo op* , but they are terrible in terms of trying to make sure that people on the ground get the aid they need. === words, phrases and phrases ==== words - _Muslim_ - _the Gaza Strip_ - _Islamic_ - _fast_ - _cleric_ - _crescent_ - _ceasefire_ - _humanitarian_ - _grapple_ - _correspondent_ - _acute malnutrition_ - _dehydration_ - _enclave_ - _famine_ ==== phrases - _team up with_ ==== short - op -> opportunity ==== sentences - There's humanitarian crisis that continues to grapple the Gaza Strip. - But it certainly gels with what we have here been hearing from the groups like the U.N. - ... are one step away famine === 回译 ==== 原文 Next up in the Muslim calendar, one of the holist, most sacred months is the ninth month, or Ramadan. Several Muslim countries announced the Monday as the first day of Ramadan, and the holy month of fasting, where Muslim may not consume food or drinks from sunrise and sunset. The exact start date of Ramadan changes because it's based on clerics seeing a crescent or new moon as the Islamic calendar follows the lunar cycle. There were hopes of a possible ceasefire in the Gaza Strip before the Ramadan, but both Hamas and Israel could not reach a deal. While the war goes on, there's humanitarian crisis that continues to grapple the Gaza Strip. The U.S. is teaming up with several other nations by airdropping aid into Gaza , but aid agencies recommended it would be much more efficient if this supplies were transported on the ground. Our chief international correspondent, <NAME>, is here to give us the why. From the health ministry inside Gaza are now saying that 25 have died as a result of acute malnutrition and dehydration. CNN cannot independently confirm that, because the international journalists are not allowed into Gaza to report on the ground. But it certainly gels with what we have been hearing from the groups like the U.N., who has warned that hundreds of thousands of of Gazans in the northern part of the enclave are one step away from famine, who has announced as you mentioned that four out of five(4/5) people -- or 4/5 household, I should say specifically, do not have access any longer to clean water. And while these airdrops show a certain level of intention and goodwill, according to aid organizations, they are not terribly efficient and effective in terms of mechanism for actually distributing aid. We heard from one humanitarian worker who said they're a great photo op , but they are terrible in terms of trying to make sure that people on the ground get the aid they need. ==== 参考翻译 圚穆斯林的日历䞭接䞋来的䞀䞪最神圣的月仜是第九䞪月也就是斋月。䞀些穆斯林囜家宣垃星期䞀䞺斋月的第䞀倩这是䞀䞪犁食的神圣月仜穆斯林圚日出和日萜之闎䞍埗进食或饮氎。斋月的确切匀始日期䌚因䞺基于䌊斯兰日历遵埪月亮呚期需芁神职人员观察新月或匯月而有所变化。 圚斋月匀始之前加沙地垊曟有可胜蟟成停火协议䜆哈马斯和以色列郜未胜蟟成协议。战争仍圚继续加沙地垊仍然面䞎人道危机。矎囜正圚䞎其他几䞪囜家合䜜通过空投方匏向加沙提䟛揎助䜆揎助机构建议劂果这些物资胜借通过陆路运蟓效率䌚曎高。我们的銖垭囜际记者<NAME>将䞺我们解释其䞭原因。 加沙卫生郚闚现圚衚瀺已经有25人因䞥重营养䞍良和脱氎而死亡。CNN无法独立证实这䞀消息因䞺囜际记者䞍被允讞进入加沙进行报道。䜆这䞎我们从联合囜等组织那里听到的信息盞笊他们譊告诎加沙北郚地区的数十䞇加沙人距犻饥荒只有䞀步之遥正劂䜠所提到的五分之四的人或五分之四的家庭再也无法获埗枅掁氎源。虜然这些空投衚明了䞀定的善意和意囟䜆根据揎助组织的诎法它们圚实际分发揎助方面并䞍是非垞高效和有效的机制。我们听到䞀䜍人道䞻义工䜜者诎这些空投是埈奜的拍照机䌚䜆圚确保地面䞊的人们获埗所需揎助方面华效果䞍䜳。 ==== 1st In Muslim calendar, #underline[one of] the #underline[holist], most sacred month is the ninth month also known as #strike[the fast month] #underline[Ramadan]. Some Muslim countries announced that Monday #strike[is] #underline[as] the first day of Ramadan #strike[which is a]#underline[, the] sacred month of fasting #strike[that] #underline[where] Muslim #strike[don't] #underline[may not] consume any food or #strike[water] #underline[drinks] from sunrise to sunset. The exact start date of Ramadan changes because it #strike[follows the cycle of moon based on Islamic calendar and needs ... to observe crescent moon or new moon to change] #underline[based on clerics seeing a crescent or new moon as the Islamic calendar follows the lunar cycle]. #strike[Before Ramadan, the Gaza Strip could once possibly reach a ceasefire deal, but Hamas and Israel didn't] #underline[_There are hopes of a possible ceasefire in the Gaza Strip before the Ramadan, _but both Hamas and Israel could not reach a deal]. #strike[The war is going on. The Gaza Strip was still confront the crisis of humanitarian.] #underline[While the war goes on, _there's humanitarian crisis that continues to grapple the Gaza Strip._] The United States is teaming up with #underline[serveral] other countries to #strike[serve aid] by airdropping #underline[aid into Gaza]. But the aid #strike[organizations] #underline[agencies] #strike[suggest] #underline[recommended] that it would be #underline[much] more efficient if #strike[this aid things] #underline[supplies] could be transported on the ground. Our chief international #strike[reporter] #underline[correspondent,] <NAME> #strike[will explain the reason for us] #underline[, is here to give us the why]: #strike[The health ministry says,]#underline[From the health ministry inside Gaza are now saying] 25 people have died #strike[for] #underline[as a result of] malnutrition and #underline[*dehydration*]. CNN can't #underline[independently] confirm these information for international #strike[reporters] #underline[journalists] are not allowed #strike[to go] into Gaza to report #underline[on the ground]. However, #strike[this is line with the information]#underline[it certainly *gels with* what] we #strike[heard] #underline[have been hearing] from #strike[UA organizations] #underline[the groups like U.N.]#strike[. They warn] #underline[, who has warned] that, millions of #strike[people in Gaza] #underline[Gazans in northern part of the enclave] are only one step away from *famine*. As you mentioned above, 4/5 people or families #strike[can't access to water anymore] #underline[do not *have access any longer to clean water*]. #strike[These airdrops expressed some kindness and intention, but according to the aid organization, they don't have a efficient mechanism on distribution of aid. We heard a humanitarian said, this airdrops are great for photos, but not efficient in making sure that people on the ground can get the aid they need.] #underline[While these airdrops *showed a certain level of intention and goodwill*, according to aid organizations, they are not terribly efficient and effective *in terms of* mechanism *for actually distributing aid*. We *heard from a humanitarian worker who said* they're a great photo op, but they are terrible in terms of trying to make sure that people on the ground get the aid they need.] == Rhino populations in Kenya Let's head to Kenya now, where the #strike[eastern] #underline[East] country is dealing with #strike[the] #underline[_a_] rise #underline[_in the *rhinoceros*_] of population. #underline[_Overcrowding_] in #underline[_*sanctuaries* has_] cause problem #strike[that] #underline[_such as rhinos attacking_] each other and competing for food. It's such a concern that Kenya #strike[of wide] #underline[_Wildlife Service_] is transporting 21 rhinos to a new location. It takes nearly a dozen people to get this #underline[_five-year-old black rhino up on its feet as the *tranquilizer* *wears off*._] With #underline[_tracker_] securely #underline[_*glued to* her horn,_] she is ready to move 100 hundred miles away. Kenya has an unusual problem. Rhino populations here are actually going up, so Safia and others #strike[have] #underline[at] this overcrowded #strike[century] #underline[_sanctuary in central_] Kenya #strike[, a] #underline[are] getting a new home. Decades ago, 20,000 eastern black rhinos like this one ran free in Africa. But in just under 20 years the numbers #underline[_*plummeted*_] to below 400 as #underline[_*poachers*_] hunted them for their precious #underline[_*horns*_]. Now Kenya rhinos #underline[_are making a comeback_] thanks to #underline[_anti-poaching efforts_] #strike[anchors]. But overcrowding in #strike[centuries] #underline[_sanctuaries_] has become a problem for a #underline[_*solitary*_] animal. To #strike[get them more living space] #underline[_give them more roaming space_], 21 rhinos were taken to a brand new sanctuary in #underline[Loisaba Conservancy]. They #strike[had] #underline[are] the first rhino#underline[s] to live on the land in #strike[15] #underline[50] years. === words and phrases ==== words - _rhinoceros_ - _sanctuary_ - _tranquilizer_ - _horn_ - _plummet_ - _poach_, _poacher_ - _solitary_ ==== phrases - _wear off_ - _be glued to_ === 回译 ==== 原文 Let's head to Kenya now, where the East country is dealing with a rise in the rhinoceros of population. Overcrowding in sanctuaries has cause problem such as rhinos attacking each other and competing for food. It's such a concern that Kenya Wildlife Service is transporting 21 rhinos to a new location. It takes nearly a dozen people to get this five-year-old black rhino up on its feet as the tranquilizer wears off. With tracker securely glued to her horn, she is ready to move 100 hundred miles away. Kenya has an unusual problem. Rhino populations here are actually going up, so Safia and others at this overcrowded sanctuary in central Kenya are getting a new home. Decades ago, 20,000 eastern black rhinos like this one ran free in Africa. But in just under 20 years, the numbers plummeted to below 400 as poachers hunted them for their precious horns. Now Kenya rhinos are making a comeback thanks to anti-poaching efforts . But overcrowding in sanctuaries has become a problem for a solitary animal. To give them more roaming space, 21 rhinos were taken to a brand new sanctuary in Loisaba Conservancy. They are the first rhinos to live on the land in 50 years. ==== 参考翻译 肯尌亚现圚面䞎着犀牛数量䞊升的问题。圚保技区过床拥挀富臎了䞀些问题䟋劂犀牛之闎的攻击和䞺食物而竞争。这匕起了人们的关泚肯尌亚野生劚怍物管理局正圚将21只犀牛蜬移到新的地点。 圓镇静剂䜜甚消退时需芁近十几人才胜让这只五岁的黑犀牛站起来。它的角䞊粘着定䜍噚准倇移劚100英里远的地方。肯尌亚面䞎着䞀䞪䞍寻垞的问题。这里的犀牛数量实际䞊圚增加因歀圚这䞪过床拥挀的䞭郚肯尌亚保技区里的Safia和其他犀牛马䞊就芁有新家了。几十幎前有2䞇只像这只䞀样的䞜郚黑犀牛圚非掲自由奔跑。䜆圚䞍到20幎的时闎里由于偷猎者䞺了它们珍莵的角而猎杀数量急剧䞋降至400只以䞋。现圚肯尌亚的犀牛埗以倍苏这芁園功于反偷猎的努力。䜆保技区的过床拥挀已经成䞺独居劚物的䞀䞪问题。 䞺了给它们曎倚的掻劚空闎21只犀牛被垊到了䜍于掛䌊萚巎保技区的党新保技区。它们是50幎来銖批圚这片土地䞊生掻的犀牛。 ==== 1st Kenya is now #strike[confronting a problem of the increasing number of rhinoceros] #underline[_is dealing with_ *a rise in the rhinoceros of population*]. #strike[The overcrowding] #underline[Overcrowding in *sanctuaries*] has #strike[led to some problems] #underline[*cause problems*] such as #strike[competitions for food and attack among rhinos] #underline[_rhinos attacking each other and competing for food_]#strike[, which has attracted human's attention.] #underline[. It's such a concern that] now the Kenya Wildlife #underline[Service] is transporting 21rhinos to a new #strike[place] #underline[location]. #strike[When the effect of tranquilizer fade away, it needs over 10 people making this 5-year-old rhino stand on its feet.] #underline[It takes nealy a dozen people to get this 5-year-old rhino *up on its feet* as *tranquilizer wears off*.] #strike[A tracker was attached to its ..., being ready to be sent 100 miles away.] #underline[With a tracker securely *glued to her horn*, she is ready to move 100 miles away.] Kenya are now facing an unusual problem: #strike[the number of rhinos] #underline[rhino populations] here are actually #strike[increasing] #underline[going up], so Safia and other rhinos #strike[consider this overcrowded protection region in the middle Kenya as their new home] #underline[so Safia and others at this overcrowded sanctuary in *central Kenya* _are getting a new home_]. Decades ago, about 20 thousand eastern black rhinos just like this one ran #strike[freely] #underline[free] in Africa. However, in #underline[just under] 20 year, the number #strike[dropped sharply] #underline[plummeted] to below 400 for the poachers poached their precious horns. Now rhinos in Kenya #strike[has been prosperous] #underline[are making a comeback]#strike[, which *is credited to*] #underline[*thanks to*] the anti-poaching efforts. But #strike[the overcrowded protection region] #underline[overcrowding in sanctuaries] has been a problem of a solitary animal. To offer them more #underline[roaming] space, the 21 rhinos #strike[was] #underline[were] taken to a #strike[totally] #underline[*brand*] new sanctuary in *Loisaba Conservancy*. The are the first #underline[rhinos] to live on this #strike[soil] #underline[land in 50 years]. == Bird For today's #underline[story's getting a] 10 out of 10, a video#underline[-bombing] bird doing its best to break up #strike[and] #underline[a] beat on broadcast TV. CNN's #underline[Jeanne Moos] has more. Look at this, reporters are supposed to be able to #underline[_*wing it*_], but this is something #strike[like] #underline[out of the] birds. OK, maybe not that #strike[stream] #underline[extreme]. But #underline[Australia reporter Ursula Heger] was #strike[fighting] #underline[_*filing*_] a #underline[report] for 10 News First#strike[. When] #underline[when] she got #underline[dive-bombed] over and over. #underline[dive-bombed] #strike[for] nine times. Her own station called it #underline[_*impeckable* *journalism*_] Instead doing this, #underline[Ursula did this.] #strike[We should] #underline[_At least she didn't_] get used #strike[to] a landing #underline[_strip_] by, say, a #underline[_*robin*_] or a #underline[_pet_] parrot. And Ursula didn't get #strike[his] #underline[_her_] earbud #underline[_*plucked*_] by this reporter in #underline[_*Chile*_] Ironically, he was reporting on the rising *robberies*. They did manage to get the earbud back from the parrot. #underline[_The way Ursula_] handle the attack #strike[as the ...] #underline[_was a feather in her cap._] #underline[_Could have been worse if she got_] #strike[She would be] pecked by a *woodpecker*. Talk about #underline[_*foul play* and a "hawkward"_] situation, but that reporter had no #underline[_*egrets*_] taking the #strike[bird] #underline[_"birden"_] in #underline[_*stride*_], #strike[delivery] #underline[_delivering_] #strike[a peckable] #underline[_an impeckable report that was like *poultry*_] report in motion. All right. Remember tomorrow's ... follow me . I'm Coy Wire. #underline[_Drop_] your unique vocabulary #underline[_in the comment section on my most recent post and_] we're suppose to choose a winner to work into tomorrow show. === words and phrases ==== words - _wing_ - _impeckable_ - _journalism_ - _a landing strip_ - _robin_ - _pluck_ - _robberies_ - _peck_ - _woodpecker_ - _foul play_ - _egret_ - _poultry_ ==== phrases - _a feather in one's cap_ - _in stride_
https://github.com/DaAlbrecht/lecture-notes
https://raw.githubusercontent.com/DaAlbrecht/lecture-notes/main/computer_networks/network_topology.typ
typst
MIT License
= Network topology A Network topology is the arrangement of the various elements (links, nodes, etc.) of a computer network. Essentially, it is the topological structure of a network and may be depicted physically or logically. == physical topology Physical topology refers to the placement of the network's various components, including device location and cable installation. == logical topology Logical topology shows how data flows within a network, regardless of its physical design. == Types of network topologies The most common network topologies include: - Bus topology - Ring topology - Star topology - Mesh topology - Tree topology - Cell topology === Bus topology In a bus topology, all devices are connected to a single cable, called the bus. Data is transmitted in both directions to all devices on the network. #figure( image("../resources/busnetwork.png", width: 20%), caption: [Bus topology], ) <busnetwork> *Advantages*: - Easy to install and expand - Requires less cable than other topologies *Disadvantages*: - Performance decreases as more devices are added - Difficult to troubleshoot - Single point of failure (if the bus fails, the entire network goes down) === Ring topology In a ring topology, each device is connected to two other devices, forming a ring. Data travels in one direction around the ring until it reaches its destination. #figure( image("../resources/ringnetwork.png", width: 20%), caption: [Ring topology], ) <ringnetwork> *Advantages*: - No collisions - Equal access to the network - Each node acts as a repeater allowing the signal to travel long distances *Disadvantages*: - Difficult to troubleshoot - Single point of failure (if one device fails, the entire network goes down) - Performance decreases as more devices are added === Star topology In a star topology, all devices are connected to a central hub or switch. Data is transmitted from one device to the hub, which then forwards it to the destination device. #figure( image("../resources/starnetwork.png", width: 20%), caption: [Star topology], ) <starnetwork> *Advantages*: - Easy to install and manage - Centralized control - Fault isolation (if one device fails, the rest of the network remains operational) *Disadvantages*: - If the central hub is not redundant, it becomes a single point of failure - Requires more cable than other topologies #pagebreak() === Mesh topology In a mesh topology, each device is connected to other devices in the network. Data can take multiple paths to reach its destination, increasing reliability and fault tolerance. In a full mesh topology, every device is connected to every other device in the network. #figure( image("../resources/meshnetwork.png", width: 20%), caption: [Mesh topology], ) <meshnetwork> *Advantages*: - High fault tolerance - Reliable data transmission - Scalable *Disadvantages*: - Expensive to install and maintain - Requires a large amount of cabling === Tree topology A tree topology combines characteristics of star and bus topologies. Devices are arranged in a hierarchy, with multiple star networks connected to a central bus. #figure( image("../resources/treenetwork.png", width: 20%), caption: [Tree topology], ) <treenetwork> *Advantages*: - High scalability - Centralized control - Fault isolation *Disadvantages*: - Difficult to configure and manage - Requires more cable than other topologies - Single point of failure (if the central bus fails, the entire network goes down) === Cell topology The cellular network topology is applicable only in wireless networks. It consists of multiple cells, each served by a base station. Cells are arranged in a pattern to provide coverage to a large area. = Access methods In wired networks like Thin Ethernet (10BASE2) or Token Ring all participants share a common transmission medium, referred to as Shared Media. An access control method is necessary to ensure that only one participant transmits data at any given time to avoid collisions and ensure error-free transmission. Shared Media access methods are categorized into deterministic and non-deterministic access methods. == Deterministic access methods Access to the transmission medium is coordinated among participants at specific times. An example is the Token-Passing method used in Token Ring and FDDI networks. In this method, a token grants the right to send data. The participant holding the token can send data for a limited time. Once done, or if they choose not to send data, the token is passed to the next participant. This ensures fairness, as every participant eventually receives the token, allowing them to send data after a predictable wait time. == Non-deterministic access methods In this scenario, all participants compete directly for access to the transmission medium. The wait time for access and the amount of data that can be transmitted are unpredictable, depending on the number of participants and their data transmissions. An example of this is Carrier Sense Multiple Access with Collision Detection (CSMA/CD) used in Thin Ethernet (10BASE2). When a participant wants to send data, it first checks if the medium is free. If it is, they proceed to send. However, if two or more participants attempt to send simultaneously, a collision occurs. CSMA/CD detects these collisions, causing the participants to stop transmitting. After a random delay, each participant attempts to send again, reducing the likelihood of another collision. = Collision domains A Collision Domain refers to a network scenario where all devices within the same domain must listen to a message sent by any one device, even if the message isn't intended for them. This can lead to a problem when two devices transmit simultaneously, causing a collision. After a collision, the devices must wait and re-transmit their messages one at a time. This issue occurs only in half-duplex mode.
https://github.com/v411e/optimal-ovgu-thesis
https://raw.githubusercontent.com/v411e/optimal-ovgu-thesis/main/titlepage.typ
typst
MIT License
#import "components.typ": sans-font, variable-pagebreak, author-fullname #let oot-titlepage( title: "", document-type: "", supervisor: "", second-supervisor: "", advisors: (), author: none, city: none, date: none, organisation: [], organisation-logo: none, header-logo: none, is-doublesided: none, lang: "en", ) = { set page( numbering: none ) set par( leading: 1em, first-line-indent: 0em, justify: false, ) align(center, header-logo) v(5mm) block( inset: 2cm )[ #text(font: sans-font, 2em, weight: 700, document-type) #par(leading: 0.6em)[ #text(font: sans-font, 1.6em, weight: 500, title) ] #v(1em) #text(font: sans-font, 1.2em, weight: 500, author-fullname(author)) #if (city != none and date != none) [ \ #text(font: sans-font, 1.2em, weight: 500, city + ", " + date) ] ] pad( top: 0em, right: 15%, left: 15%, grid( columns: 2, gutter: 1em, strong( if (lang == "de") [ Betreuer: ] else [ Advisors: ] ), advisors.join(", "), strong( if (lang == "de") [ Themensteller: ] else [ Supervisor: ] ), supervisor, strong( if (lang == "de") [ Zweitgutachter: ] else [ Second Supervisor: ] ), second-supervisor, ) ) align(bottom)[ #line(length: 100%) #grid( columns: 2, gutter: 1em, par(leading: 0.6em, organisation), align(right + top)[ #move(dx: 1.2cm, dy: 0cm)[ #organisation-logo ] ] ) ] variable-pagebreak(is-doublesided) }
https://github.com/Quaternijkon/notebook
https://raw.githubusercontent.com/Quaternijkon/notebook/main/content/数据结构䞎算法/.chapter-算法/æ•°å­Š/旋蜬囟像.typ
typst
#import "../../../../lib.typ":* === #Title( title: [旋蜬囟像], reflink: "https://leetcode.cn/problems/rotate-image/description/", level: 1, )<旋蜬囟像> #note( title: [ 旋蜬囟像 ], description: [ 给定䞀䞪 n × n 的二绎矩阵 matrix 衚瀺䞀䞪囟像。请䜠将囟像顺时针旋蜬 90 床。 䜠必须圚 原地 旋蜬囟像这意味着䜠需芁盎接修改蟓入的二绎矩阵。请䞍芁 䜿甚及䞀䞪矩阵来旋蜬囟像。 ], examples: ([ #figure( image("./img/mat1.jpg", width: 50%) ) 蟓入matrix = [[1,2,3],[4,5,6],[7,8,9]] 蟓出[[7,4,1],[8,5,2],[9,6,3]] ],[ #figure( image("./img/mat2.jpg", width: 50%) ) 蟓入matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]] 蟓出[[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] ] ), tips: [ - $n == "matrix.length" == "matrix"[i]."length"$ - $1 <= n <= 20$ - $-1000 <= "matrix"[i][j] <= 1000$ ], solutions: ( ( name:[甚翻蜬代替旋蜬], text:[ ],code:[ ```cpp class Solution { public: void rotate(vector<vector<int>>& matrix) { int n = matrix.size(); // 氎平翻蜬 for (int i = 0; i < n / 2; i++) { for (int j = 0; j < n; j++) { swap(matrix[i][j], matrix[n - i - 1][j]); } } // 䞻对角线翻蜬 for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { swap(matrix[i][j], matrix[j][i]); } } } }; ``` ]), ), gain:none, )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/delimited_07.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test predefined delimiter pairings. $floor(x/2), ceil(x/2), abs(x), norm(x)$
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/040%20-%20Zendikar%20Rising/007_Episode%204%3A%20Of%20Haunting%20Songs%20and%20Whispered%20Warnings.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 4: Of Haunting Songs and Whispered Warnings", set_name: "<NAME>", story_date: datetime(day: 23, month: 09, year: 2020), author: "<NAME>", doc ) #figure(image("007_Episode 4: Of Haunting Songs and Whispered Warnings/01.jpg", width: 100%), caption: [], supplement: none, numbering: none) Akiri knew the sensation of falling as intimately as the strength of her own hands. She didn't fear the rush of air on her face or the way her stomach leapt to her throat. She was the best line-slinger on Zendikar, and she learned long ago that sometimes, in order to climb, you had to fall. But she had never fallen so far and so long before. She had never fallen without hope. She could see the Murasa Skyclave shrinking above her as she plummeted. And if she closed her eyes, Akiri saw Nahiri's cool, indifferent expression and the Core in her hand, in that terrible moment before she was shoved off the floating ruin. In those first few desperate seconds, Akiri threw her ropes and hooks at every floating ledge or slanted hedron within reach. But instead of tearing itself apart, the pieces of the Murasa Skyclave were moving. It was stitching itself back together like an impossible puzzle, and her hooks lost their mooring or were smashed before Akiri could save herself. Soon the only thing around her was empty sky. #emph[These are the last moments of my life] , she realized. Grief and anger hit her like a punch. Akiri hadn't managed to save or protect anything she loved in those desperate minutes before Nahiri pushed her. #emph[Zendikar. Zareth. ] She closed her eyes and thought of her friend and love, pushing away the image of his frozen, screaming face in the moment of his death, remembering him instead laughing, line-slinging with her, his bright eyes full of mischief. Akiri held his memory close as she waited for the ground. She would see Zareth soon. The impact knocked the breath from her. Her neck and limbs jerked forward painfully. Then snapped back. Suddenly, Akiri wasn't falling anymore. #emph[Strange] , she thought. #emph[Death is gentler than I imagined.] She anticipated feeling the limbs of the harabaz trees break against her body, at least, if she felt anything at all. Opening her eyes, she expected only darkness, but around her there was bright blue sky. Turning her head, she saw Sunder Bay several hundred feet below her, its trees swaying and thrashing against the relentless waves. "What?" she whispered. She was suspended midair. Impossible. "Got you!" someone shouted from above. Akiri looked up again, squinting from the sun, and above her, she could just make out a slim figure leaning on a staff. They were standing on what looked like a ladder of branches. Though that seemed impossible, too. "What?" she whispered again. #figure(image("007_Episode 4: Of Haunting Songs and Whispered Warnings/02.jpg", width: 100%), caption: [Forest | Art by: Tianhua X], supplement: none, numbering: none) Akiri felt herself rising and realized that there was a bramble branch curled tightly around her chest. As she drew closer to the figure on the ladder, she saw that her rescuer was an elf woman with long dark hair, clothed in green. Farther down the ladder, a man with windswept hair and bright eyes was carefully climbing up. The bramble gently set Akiri down on the ladder, a foot or so away from the elf. "Thank you," said Akiri, after a moment. It was as much as she could manage. "Are you alright?" asked her rescuer. "Yes." Akiri glanced up at the Murasa Skyclave. It was nearly whole now, as if they had never sprung the trap. As if Akiri and her party didn't just fight for their lives. It was as if Zareth died for nothing. "No," she whispered as her knees buckled under her. "Easy"—the elf caught her around the shoulders, steadying her—"I have you." "Who are you?" Akiri asked. "I'm Nissa," she replied and, with a timid smile, added, "The slow climber is Jace." Jace groaned as he came up beside them. "I'm out of practice. We don't have sky dungeons in Ravnica." Akiri studied them for a moment. There was something about the pair that she wouldn't have recognized a few days ago, something she always disregarded as campfire myths. A sense of unspoken power, that they contained secrets as vast as the world. A feeling that they had one foot here~and the other somewhere else. Like Nahiri. "You can travel to other realms, can't you?" she asked, recoiling from Nissa's grasp. Nissa and Jace exchanged a look. "You know about planeswalkers?" Jace asked. #emph[The myths called you walkers. Planeswalker. My demon has a name] , Akiri thought as her chest constricted with grief. "I've met Nahiri. She's the one who pushed me." She pointed up to the Skyclave. She noted that neither planeswalker looked surprised. They both were staring at the Murasa Skyclave. "Does she have the Core?" Nissa asked, her hands balling into fists at her side. "Yes." An image of Nahiri's cruel face flashed again in Akiri's mind. And Zareth's dead one. "We can still catch her," Jace said, beginning to climb again. "Hurry." "No, Jace!" said Nissa. "Look!" Akiri followed to where Nissa's finger was pointing. In the distance, she could just make out a white-haired figure running through the air, as if sprinting down a flight of steps. Akiri recognized the stonecrafting. The sight of Nahiri made Akiri's stomach twist. Nissa thrust forward a hand and shot out dozens of thorn arrows at Nahiri. But the distance between them was too great. Nahiri had plenty of time to block the attack with a flick of her wrist and a well-aimed boulder. Akiri flinched, readied her ropes. #emph[Wait] , she thought. #emph[Not yet.] She heard Jace exhale behind her, and Akiri turned to see him staring at Nahiri in the distance. He extended three fingers out in the stonecrafter's direction, like an attack, and Akiri held her breath. Nothing happened. Then Nahiri stumbled, clutching the sides of her head. Jace's mouth twitched. Nahiri regained her balance within moments and slid to a stop on the stone stairs. She turned toward Jace. Even from this distance, the malice in Nahiri's glare made Akiri's skin crawl. "Look out!" Akiri shouted, pushing Jace out of the way before a boulder slammed into him. Then she was falling again. But this time with Jace in her grasp. Akiri was the best line-slinger in Zendikar for a reason, and she'd been expecting Nahiri's attack. Within seconds, she tossed the rope in her hand and secured the hook on the ladder of vines. She used her momentum to swing out of the way of another boulder and, with three quick hand-over-hand motions, hoisted herself and Jace back up onto the bramble ladder. When she looked across the sky again, Nahiri was gone. Akiri exhaled, both relieved to be out of Nahiri's sight and furious that she got away. "That was~" Jace said to Akiri, getting his bearings, "impressive." "Nahiri hired my party for a reason. We are~were~the best in the world," replied Akiri. With a pang of worry, she wondered where Kaza and Orah were. #emph[Please be alive] , she thought. "We need to follow her quickly!" Nissa said as she began climbing down the brambles. "Oh, if it's speed you want," Akiri said with cold certainty. She was Akiri, the Fearless Voyager, and she was the master of this domain. This was #emph[her] home. She began to whirl another rope. Between her line-slinging and Nissa's vines, they flew down, past Sunder Bay and the canopy of harabaz trees, toward Murasa's infamous imposing cliffs. Akiri swept like a bird through the air from those dizzying heights, despite needing to aid Jace. This time, her falling was practiced, controlled, though her heart was heavy with grief. She could not let Nahiri get away. But they were still too slow. By the time she, Nissa, and Jace reached the wide, forested plateau beyond the cliffs, Nahiri was gone. Nissa clenched her hands and leaned against a massive jurworrell tree. There, she stood still, closed her eyes, head cocked slightly to one side. "What is she doing?" Akiri whispered to Jace. Jace shrugged. "Listening," replied Nissa. After a moment, she opened her eyes. "She went north, but I can't tell exactly where. Did Nahiri tell you where she'd go next?" she asked Akiri. Akiri shook her head. Now that she was on the ground again, the memories of Zareth hounded her. She had spent too much time with mysterious planeswalkers. She understood now that they were as dangerous as the Eldrazi. "Thank you for saving me again," she said, gathering up her ropes. "Where are you going?" Jace asked, alarmed. "I need to find Orah and Kaza." "Who?" "My friends. Hopefully Nahiri didn't kill them, too." Akiri swallowed hard. She didn't know what she'd do if she lost her entire second adventuring party. Her second family#emph[.] "We could use your help," entreated Jace. "Well, you can't have it," replied Akiri. "Working for Nahiri was one of my greatest mistakes. She used the Core~Zareth"—Akiri took a deep breath—"I'm done helping people from other realms." She wasn't sure where Nahiri had come from, but it wasn't from the Zendikar she loved. "I'm not from another realm," said Nissa, quietly. "I was born here. In Bala Ged. My tribe~my tribe was almost wiped out by the Eldrazi. And I feel the devastation everywhere in this world." She straightened and looked directly at Akiri. "This is my home and always will be. And I refuse to let Nahiri change it into her dead stone vision." She spoke softly, but there was a fierce determination in her voice, in her position. For the first time, Akiri noticed how the entire forest seemed to bend itself around this diminutive elf. Like it was waiting for her to give a command. "You should know then," said Akiri, "the Core corrupts and kills. Beasts, trees~" #emph[People] , she couldn't bring herself to say. Nissa's expression was pained, but not surprised. "So, you don't have any ideas on where she might have gone?" she asked. "None," Akiri answered. "I might," said Jace, looking guilty. Both women looked at him with surprise. "I peered into her thoughts," he admitted. "She's going to the Singing City." Akiri knew the legends around the Singing City. It was said that those who wandered in its ruins went mad. "I think looking into her mind was the right call," said Nissa, gently. Her brow then furrowed. "But why does she want to go there?" "Because it was built by the ancient kor," Jace replied. "What?" Nissa and Akiri said in unison. "Well, it's a logical conclusion," Jace said. "They built the ancient cities of this world." But Nissa's eyes were closed again, listening. "I can get there faster on my own," she said. "Nissa, wait," Jace said, alarmed. But it was clear to Akiri that Nissa was not waiting for anyone. There was already a tangle of jurworrell roots rising up under her, lifting her into the air. "I will stop Nahiri and destroy the Core," she said, looking down at Akiri. "I promise." But this time, behind that quiet determination, Akiri heard anger. Akiri nodded. "Hurry." "Nissa," Jace said, but neither woman paid attention. Like a line thrown with purpose, the roots swelled and rushed forward into the forest. Then Nissa was gone. "Nissa!" Jace yelled after her. But there was nothing where she had stood, except the hum of the forest and the looming trees. He turned to Akiri. "Can you take me to the Singing City?" "Yes, but I won't." Akiri latched a rope to a thick jurworrell root above her. She needed to find the griffins she and her party had ridden to Murasa. She hoped Kaza and Orah would be at Sunder Bay, waiting for her. #emph[Please be safe] , she thought. "Please, Akiri," Jace said, coming up behind her. "You're not great at listening, are you?" Akiri said, lifting herself off the ground. "I've lost enough for one day." #emph[One lifetime. Zareth.] "My apologies," Jace said. "I'm usually a decent listener. It's been a trying~well, a trying few years, if I'm being honest." #emph[Yes, it has. ] Akiri pulled herself on the root and looked for the next anchor point. "Wait, your friends are Kaza and Orah, right?" Jace said. Akiri stopped, stared at the man in blue. "What about them?" Jace closed his eyes and pressed his fingers to the side of his temples for a moment. "I'm sensing two figures down at the bay. I'm assuming they're your missing party. Though I can't say for certain." Akiri grasped the rope and slid to the ground. "How are you doing that?" Jace shrugged. "I'm a mage. I'm good at illusions and thoughts." "That's how you could read Nahiri's mind?" she asked. Jace looked guilty, and Akiri recoiled at the idea of her thoughts being read by this otherworld stranger. #emph[My mind is my own] , she thought angrily, just in case Jace was listening. #emph[Stay out of it.] She began climbing up again. "What if I promised to take the Core somewhere else? Somewhere beyond Zendikar?" Jace called after her. #emph[What does that even mean? ] Akiri wanted to ask but stopped herself with a small shudder. The Eldrazi were from somewhere beyond Zendikar. It was better not to know. "Will the Core no longer be a danger, then?" she asked, instead. Jace nodded. That made Akiri pause. #emph[Zareth would have wanted you to save Zendikar.] The thought made her heart ache. Stealing the dangerous object and sending it to another world? Zareth would have loved that. And, Akiri had to admit, it was a good solution. With a sigh, she turned back to Jace. "I'll take you to the entrance of the City so you can help Nissa," she said, cautiously, "but no further." "Thank you, Akiri," Jace said with relief. If he was reading her thoughts, she found no sign of it as they made their way to the Singing City. It was only much later, after she reunited with Orah and Kaza at Sunder Bay, that Akiri realized she never told Jace her name. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Jace followed Akiri through the tangled, towering jurworrell trees until they gave way to a forest blighted by the Eldrazi. Here, the sickly, blackened landscape made Jace's stomach clench with guilt, though he noticed there was new, tender life struggling to grow in the mire. He pressed on. He followed her as the trees broke against towering cliffs, as tall as Murasa's Wall. He followed her as they scaled the cracked stones, where the low growls of unseen beasts hiding in the cliffs' caves sometimes made the rocks under his hands vibrate. Jace followed Akiri onto the Na Plateau and into the dense forest beyond. He was relieved he didn't have to make this journey alone, as the jaddi trees became denser and darker as they neared the city. Akiri was silent through the whole journey except to whisper, "Look out for wurms" or "There are goblins around here. Stay as silent as you can." Jace could tell she was holding her grief and worry close, trying not to show it, even though her pain was obvious to him. Perhaps because he had been holding close his own painful secrets. They came to a break in the forest. Before them was a graveyard of a city beyond age. It was as if one of the massive Skyclaves settled on the earth. Its stone towers were broken and toppled, and its walls were covered in flora and moss. The air smelled dank and dusty, and everything was eerily humming. The gate at the entrance was made of marble—dark and huge and twisted and beautiful, curling and entwining in a complex pattern like the jaddi roots. It loomed before Jace and Akiri. "Any advice?" he asked. "Don't go mad," she replied. "Right." Jace straightened his cloak. "Thank you for your help. And~I'm sorry about your friend. I know what it's like to lose someone close to you." Akiri nodded, her jaw clenching with suppressed emotion. She turned and began to walk away, but then paused. "I hope Nissa's luck holds better than mine," she said, over her shoulder. And then she was gone in the shadow of the trees. "Right," Jace said again, and made his way to the gate. It was unlocked. Inside was a maze of ruins. Moss covered rooms and corridors stretched out before him with no end in sight. Jace's heart sank. It was apparent that this was not going to be easy. As much as he adored a challenge, this wasn't the time to get lost. Everywhere, there was a low, slightly off-key humming Jace couldn't quite ignore. On his right, something moved. Jace immediately threw a magic ward up around him. He followed the sound around the corner and saw a white-haired figure facing away. "Hello, Jace," Nahiri said, without turning. "Of course you're here." "I've come on Nissa's behalf," he said. "Naturally." "She says that Core will destroy Zendikar." Nahiri turned and faced her, scowling. "This from the person who released the Eldrazi on this plane." Jace gritted his teeth. He was #emph[also] one of the planeswalkers that accidentally released the Eldrazi. "She thought she was doing what was best." "Like she is now?" Nahiri raised an eyebrow, and Jace had no answer. "Unlike that fumbling tree-dweller, I know I'm right." "Like you were when you trapped the Eldrazi here?" Jace replied. Nahiri's expression clouded over with anger. "How dare you." "We don't understand the Lithoform Core," he said, evenly, though he kept a tight hold on his magical ward. "Give me the Core, Nahiri, and we can unravel its mysteries together. On Ravnica." Nahiri paused, and, for a moment, Jace hoped. Then she widened her stance. "Never," she snarled. And with a thrust of her hand, she brought the stones on either side of him together. The stones smashed through Jace's barrier but were slowed just enough so that he could dodge out of the way. He rolled to his feet, bracing again for the next attack, creating a dozen illusionary Jaces around him. But Nahiri was sprinting down the corridor. Swearing, Jace dropped the illusions and raced after her. Down he ran through ancient corridors, catching glimpses of spiraling arches and broken courtyards. Down he ran, following the footprints Nahiri left in the dust as she rushed through narrow passageways and winding halls. Down he ran on twisted, broken stairs. Into the belly of this ancient kor city. It was here that the strange humming of the city became an unsettling song. It sang a requiem for something Jace could not name, its lilting harmonies and deep vibrations filling him with such sadness and longing that he considered stopping his pursuit. #emph[No, I have to stop Nahiri] , he thought, hearing her footfalls ahead of him. They were slowing. He pressed on. Deep in the city, the melody became louder, more complex and distorted, more insistent. Jace gritted his teeth. He could see the outline of Nahiri in the distance. The haunting song made his joints ache. #emph[I have to reach Nahiri. ] Jace stumbled forward through the curling corridor. But each step was worse than the last. The music swelled, the haunted singing rising, demanding his full attention. Jace stumbled, groaned. #emph[I have to find] #emph[] #emph[. . .] He saw there were now blue arcs of magic around him, flashing in time to the music. The song drowned out all sound, all thought. Jace fell to his knees, hand clamped around his ears. #emph[I have to] #emph[] #emph[. . .] #emph[ I have to] #emph[] #emph[. . .] He struggled to focus, grabbed onto the thought. #emph[Not. Go. Mad.] It was risky, untried, but Jace was desperate. He let go of his ears and attempted a spell, one that he'd been meaning to test out, but hadn't yet. A spell that was delicate and dangerous. A spell that blocked out any sound entering his ears. #figure(image("007_Episode 4: Of Haunting Songs and Whispered Warnings/03.jpg", width: 100%), caption: [Maddening Cacophony | Art by: <NAME>], supplement: none, numbering: none) The singing reached an impossible crescendo. Every fiber of his body spasmed, his mind screamed for relief, beginning to slip away. Then, mid-note, the song stopped. Jace exhaled. His spell worked. Within seconds, his mind cleared and his joints unlocked. He could see Nahiri crumpled on the ground before him, hands over her ears. He got to his feet and rushed over to her, sweeping out his hands, enlarging the radius of his spell to encompass Nahiri. She groaned and covered her eyes. Jace held back, unsure of what the lithomancer's next reaction would be, wary of an attack. He reached out telepathically. #emph[Are you okay, Nahiri?] She stumbled to her feet, rolled back her shoulders, and glared at Jace. #emph[Are you expecting a thank you?] #emph[Naturally not] , Jace smiled inwardly. She scowled and stared at her feet. #emph[I didn't hear it before. The singing. Then, when I did, I thought I was too powerful for it to affect me.] Jace nodded. #emph[This plane has always been full of surprises.] #emph[The Core and I are not leaving Zendikar, Jace.] Her stance straightened with a sharp, defiant look on her face. #emph[Okay. ] Jace realized he needed to change tactics if he was going to get through to Nahiri. #emph[Where are you going then?] #emph[To the center of the city] . #emph[To activate it.] Jace waited, crossing his arms. Nahiri rolled her eyes. #emph[Runes said there's a magical focal point there that can channel the Core's energy all over Zendikar through the leylines.] This caught Jace's interest. #emph[Making the transformation universal?] Nahiri nodded, wariness in her expression. Jace saw then how Nahiri imagined her healed plane. It was Zendikar transformed. Vast, beautiful cities with thousands of people crafting, selling, thriving. Intricately carved archways and complex, breathtaking architecture was everywhere. And, most of all, the plane was stable. Safe. It reminded Jace of Ravnica. #emph[I won't hinder you, Nahiri, if you promise not to use the Core until we study this mechanism in more detail.] Nahiri paused, considering, then nodded. #emph[I have no desire to harm my home.] But Jace could see her thoughts and knew that Nahiri's definition of harm was not the same as his or Nissa's. That she would raze cities and armies to achieve her goals. He also knew that if he was ever going to unlock the mysteries of the Core, he was going to have to understand how it was activated. That if it was going to be a useful weapon in the battles to come, its mysterious power had to be quantified first. And he knew they would need every weapon the planes could offer when they faced <NAME> again. So, with a placating smile, he turned to Nahiri and thought, #emph[Lead the way.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Nahiri and Jace traveled through the maze that was the Singing City, their uneasy truce hanging heavy in the space between them. Nahiri stayed close to Jace, making sure to keep within his spell range. She never wanted to hear those mad, haunted voices again. As they walked, she kept one hand trailing the mossy stone walls, asking them for the way to the city center, and the other on the satchel on her hip. The Core under her hand felt warm, and she felt its thrumming power. It made her smile. But it also still whispered, something just low enough that she couldn't make it out. Perhaps when she had a moment, after she restored Zendikar to its former beauty, she would try to decipher the whispers' meaning. Fortunately, Jace stayed silent, perhaps seeing in her fuming thoughts, as she repeated the mantra #emph[never again, never again.] The vibrations of the stones led them down seemingly endless corridors, through empty courtyards, and back up again on cracked and twisting stairs. She was so close now. So close to finding the focal point in the center of the Singing City. So close to finally fixing all the damage she helped create so long ago. When they emerged from the last staircase, they found themselves in the middle of an ancient garden, now overgrown and overtaken with jaddi roots, ferns, moss, and bright purple flowers. There were still stone trellises and dried fountains and the ghosts of paths between them. Jace raised his hands and lowered them slowly, dropping the silencing spell. The eerie hum of the city returned but grew no louder. "What now?" Jace asked. She pulled out the Lithoform Core from her satchel. It shone in her hand with the promise of power. Its whispers became frantic, furious. "Can you hear that?" Nahiri asked, holding up the Core. "Hear what?" Jace asked, frowning. "Nothing," said Nahiri, quickly. "Let's move." "Where?" Nahiri pointed to a large stone gazebo-like structure before them. Even from where they stood, she could see that it was collapsed and ruined. But wasn't everything in Zendikar? She tucked the Core back in the satchel and strode forward. Something was wrong. The feeling grew the closer they came to the ruined building, and Nahiri realized the gazebo had completely fallen in on itself, crushing whatever was inside. "No," said Nahiri, and she ran forward, putting her hands on the collapsed entrance. The stone vibrations told her the damage was fresh. "What are you doing?" asked Jace. "Fixing this!" said Nahiri as the rocks around her began to shift and move. She could undo this damage. She had to. "Don't bother," said a voice from behind them. Nahiri spun and saw Nissa standing in the ruins of an ancient garden, staff in one hand and the other curled into a fist at her side. She stood tall and firm, and there was a calm, yet dangerous, look in her eyes. "The focal point," Nahiri said, through gritted teeth, "was here." "It was," Nissa replied, coldly, "until the elementals destroyed it." "You made your creatures do this?" shouted Nahiri. It would take her days, if not weeks, to undo the damage to the magical channels here. "I don't #emph[make ] them do anything," Nissa replied. "I help them, and they help me. I'm Zendikar's guardian, and they are the living embodiments of this plane." Behind her, a giant elemental appeared. Its limbs were formed of roots and leaves, and its head had massive antlers that looked like swept-back wings. "Isn't that right, Ashaya?" #figure(image("007_Episode 4: Of Haunting Songs and Whispered Warnings/04.jpg", width: 100%), caption: [Ashaya, Soul of the Wild | Art by: Chase Stone], supplement: none, numbering: none) Nahiri scowled, but the appearance of such a formidable elemental made her pause. Both she and Jace stepped back. "Nissa." Jace raised his hands in a pacifying gesture. "I promise I won't use the Core or let anyone else use it," he said looking at Nahiri, "until we understand it." "And what does your word mean when the other party won't respect it?" replied Nissa. She was staring right at Nahiri. "If she doesn't," Jace said with infuriating calm, "she'll find herself in an impressively believable illusion of the Singing City. Except this time, I won't hold back the song." "Meddler," Nahiri hissed. She silently swore never to trust anyone ever again. "I don't want to fight you. I really don't," Nissa said to Jace and Nahiri. "We've all fought enough. We deserve some peace." "I agree completely, but~" Jace said, "I think Nahiri has a point. The ancient Zendikar was beautiful. I saw her memories." "See, even the meddler agrees with me," Nahiri said with satisfaction. Finally, someone was seeing reason. "Jace, we talked about this. The elementals—" "Will grow back. Everything grows back." "Not everything," Nissa said, quietly. "The Zendikar I know is strong, unbreakable," Nahiri said. "Think of the stability," reasoned Jace. "How people on this plane will be able to prosper without fear of the next Roil." Nissa took a step back. Then another. "I trusted you," she said to Jace. The horror and hurt on her face were plain. "Nissa," Jace pleaded. "You don't want to fight me," Nahiri said, putting a hand over the Core in her satchel. Nissa stared straight at her. "Don't try." But Nahiri was done listening. She had faced elder dragons and immortal vampires. She would not be stopped. Not now. Not by someone so small and tender and unsure. Not when she was so close. With a flick of her wrists, Nahiri created dozens and dozens of glowing swords. One for every instance of her rage in the last thousand years. With a second flick, she hurled the swords directly at Nissa. But before any of her weapons could make contact, a blur knocked all the swords from the air. Something collided with Nahiri and knocked the breath from her body, smashing her to the ground. She rolled and got to her feet, preparing to strike back. But what she saw made her pause. Beside her, she heard Jace suck in his breath. Nissa was floating several feet in the air, her hair streaming out behind her, green energy coursing through her. Even from a distance, Nahiri could feel Nissa's anger, her intent to protect this broken Zendikar at all costs. Because before Nissa was Ashaya in their full power. The Soul of the Wild seemed to swell with strength, with the drive to protect. Its gaze was fixed on Nahiri, its eyes glowing green with energy, and it raised four of its twisted branch-like limbs, bringing them down on Nahiri with a fierce #emph[crack] . Nahiri rolled out of the way just in time. With a sweep of her arm, she raised stones around her and smashed them against the elemental. But the rocks broke upon the branches like glass, and the creature didn't even flinch. It turned its massive head toward her. The elemental raised its vast arms again. "Run!" Jace yelled behind her. Nahiri always thought retreating was for cowards. But Ashaya was unrelenting. #emph[I need to protect the Core. Above all.] So, she ran. Together, she and Jace dodged and leapt and sprinted through the ancient garden, using every illusion and counterattack they knew. But it still wasn't enough. Ashaya was too vast, too quick. Jace and Nahiri were knocked back and tripped by roots at every opportunity, until all they could do was skid toward the stairs, back into the belly of the Singing City. The haunting singing flooded their ears. Jace immediately cast his sound blocking spell again, and together they ran back through the moss-covered corridors. Occasionally, moss elementals would stand in their path, but they were smaller and weaker and easily deflected by Jace's counterspells or a well-aimed fist of rocks. Nahiri's fury fueled her escape. But for the first time in a long while, she also felt a thread of real fear. She had underestimated the elf. When they reached the entrance of the city and saw the old marble gates, Nahiri exhaled, picked up speed. She was almost there. But then she spotted a small, familiar figure standing at the entrance. And this time, Nissa and Ashaya were surrounded by dozens and dozens of other elementals. Nahiri and Jace both skidded to a stop. "How," Nahiri panted. "How are you traveling~so fast?" "Zendikar is where I belong. It's the heart of my power and strength," Nissa replied. "I know all the paths and how to use them. But you two"—her face filled with fury, and behind her elementals born from the flora of Murasa began to rise—"you will never understand. Leave my home." "Nissa, wait!" shouted Jace. "This is #emph[my] home, tree-dweller." Nahiri braced, called the stones around her, and she felt the Singing City behind her tremble in reply. "This has been my home for #emph[thousands] of years. And I will not let you win." Nahiri spread her fingers and raised the stones, calling on all her power for the attack. But the elementals were faster, surging forward like a furious horde, toward Jace and Nahiri. And in that moment, Nahiri understood. The battle for Zendikar's soul had begun, and it would be a ruthless fight.
https://github.com/university-makino/Microcomputer-control-and-exercises
https://raw.githubusercontent.com/university-makino/Microcomputer-control-and-exercises/master/report/本レポヌト2/report.typ
typst
// ラむブラリの実装 // #import "@preview/codelst:2.0.1": sourcecode //フォント蚭定// #let gothic = "YuMincho" //本文フォント// #set text(11pt, font: gothic, lang: "ja") //タむトル・芋出しフォント// #set heading(numbering: "1.1") #let heading_font(body) = { show regex("[\p{scx: Han}\p{scx: Hira}\p{scx: Kana}]"): set text(font: gothic) body } #show heading: heading_font // ペヌゞ蚭定 // #set page( paper: "a4", margin: (x: 25mm, y: 25mm), columns: 1, //fill: 背景色, numbering: "1", number-align: center, header: [ #set text(8pt) ] ) // 数匏の衚瀺の仕方を衚瀺 // #set math.equation(numbering: "(1)") //本文ここから// = 挔習の目的 実隓を通しお、距離センサ GP2Y0A21YK0Fの䜿い方ず仕組みを習埗するこずを目的ずする。 = 挔習の䜿甚郚品 == @DistanceSensor の電子郚品 ( 距離センサ GP2Y0A21YK0F) を次のような点から調べなさい。 #figure( image("./img/距離センサ.png",width: 50%), caption: "距離センサ" )<DistanceSensor> === どのような郚品か シャヌプの赀倖線を䜿甚した枬距モゞュヌルである。赀倖線LEDずPSD(position sensitive detector)を䜿甚しお、非接觊で距離を怜出するこずができる@distance_sensor_akituki 。 === どのような仕組みか 発光偎の赀倖光が物䜓に反射しお受光するず距離に応じお出力電圧が倉化する。この出力電圧で距離を怜出するこずができる。枬定距離を枬る方法はPDS方匏を採甚しおいる。PSD方匏は䞉角枬量の芁領で距離を怜出するもので @PSD のように発光玠子から出た光が察象物に圓たっお戻っおきた反射光を怜出する。察象物が近いずPSDぞの光の入射角床は倧きく、逆に遠いず入射角床は小さくなる。この角床の違いで出力電圧が倉化するため、距離の情報を埗るこずができる@national_university_infrared_sensor 。 #figure( image("./img/PSD.png",width: 50%), caption: "PSD方匏" )<PSD> === どのような入力を取り扱うのか 距離センサヌから出力された光を受光し、その出力電圧を取り扱う。 出力電圧は距離に応じお倉化する。 === 入力に応じお出力がどう倉化するのか (デヌタシヌトや仕様曞を参考に) SHARPによるず、以䞋のような特性がある@distance_sensor_datasheet 。 @distance_sensor_chart をみるず、38.3ms±9.6ms毎に出力電圧を出力する。 最初のタむミングは枬定をされおいないため、䞍安定な倀を出力されるが、2回目以降は安定した倀を出力する。 #figure( image("./img/距離センサタむミングチャヌト.png",width: 75%), caption: "距離センサタむミングチャヌト" )<distance_sensor_chart> 出力電圧は距離に応じお倉化する。距離が近いほど出力電圧は倧きくなり、遠いほど小さくなる。距離ず出力電圧の関係は @distance_sensor_output に瀺す。 グラフは比䟋関係ではなく、反比䟋な関係がある。 しかし、距離が近すぎるずうたく枬定ができないため泚意が必芁である。 #figure( image("./img/距離センサヌ距離枬定特性.png",width: 75%), caption: "距離センサ距離枬定特性" )<distance_sensor_output> #pagebreak() // ペヌゞを分ける === どのようなピンアサむン (各ピンの圹割) か SHARPによるず、以䞋のものを扱う@distance_sensor_datasheet 。 @distance_sensor_pin をみるず、以䞋のようなピンアサむンがある。 + 出力電圧 + GND + Vcc (5V 電源電圧) #figure( grid( columns: 2, image("./img/距離センサヌピンアサむン1.png",width: 75%), image("./img/距離センサヌピンアサむン2.png",width: 75%) ), caption: "距離センサヌのピンアサむン" )<distance_sensor_pin> === 正しい動䜜の条件範囲は䜕か 秋月電子によるず、以䞋のような仕様がある @distance_sensor_akituki 。 - 電源電圧min. : 4.5V - 電源電圧max. : 5.5V - 枬定距離min. : 0.1m - 枬定距離max. : 0.8m - 枬定方匏 : 赀倖線PSD - 枬定項目 : 距離 - むンタヌフェむス : アナログ - 動䜜枩床min. : -10℃ - 動䜜枩床max. : 60℃ - 長蟺 : 44.5mm - 短蟺 : 13.5mm - 高さ : 18.9mm #pagebreak() // ペヌゞを分ける = 課題内容 == 物䜓ずセンサずの距離をはかる === 実隓その1 (郚品動䜜の理解) 距離センサからの距離が以䞋のような堎合、アナログ入力はどのような倀をずるか調べなさい。 - 卓䞊に䞊向きに眮き倩井たでに物䜓がないずき - センサから 50cm のずころに手をかざしたずき - センサから 20cm のずころに手をかざしたずき - センサから 10cm のずころに手をかざしたずき *回路図* @実隓1回路図 は、実隓1の回路図を瀺す。 距離センサをアナログ入力に接続しお、距離センサず察象物ずの距離を枬定する装眮を䜜成する。 #figure( image("./img/実隓1回路図.png",width: 70%), caption: "実隓1回路図" )<実隓1回路図> #pagebreak() // ペヌゞを分ける *プログラム* @倀の取埗をする゜ヌスコヌド は、実隓1で䜿甚したアナログ入力倀を取埗する゜ヌスコヌドを瀺しおいる。 #figure( sourcecode[```c //プログラムに必芁な倉数の宣蚀及び定矩 import processing.serial.*; import cc.arduino.*; Arduino arduino; PFont myFont; int usePin0 = 0; //Arduino A0ピン //Arduino 及びプログラムの初期蚭定 void setup(){ size(600, 250); arduino = new Arduino( this, "/dev/cu.usbserial-14P54810" ); myFont = loadFont("CourierNewPSMT-48.vlw"); textFont(myFont, 30); frameRate(30); } // 入力倀の栌玍甚倉数 int input0; //プログラム本䜓 (以䞋を繰り返し実行) void draw(){ background(120); input0 = arduino.analogRead(usePin0); //入力倀を衚瀺 text("A0: " + input0, 50, 100); } ```], caption: "倀の取埗をする゜ヌスコヌド" )<倀の取埗をする゜ヌスコヌド> - プログラムの抂芁 センサから ArduinoA0 ピンぞの入力倀をアナログ入力ずしお読み蟌む。読み蟌んだ倀を数倀ずしお衚瀺する。 - プログラムの説明 - 17 行目: プログラムに必芁な倉数の宣蚀および定矩たたはラむブラリのむンポヌトを行う。 - 8 行目で ArduinoA0 ピンの䜿甚を usePin0 = 0 ずしお定矩しおいる。 - 11–20 行目: Arduino およびプログラムの初期蚭定 - 10 行目で画面衚瀺に甚いるりィンドりサむズを暪 600px,瞊 250px ず定矩しおいる。 - 11 行目で"/dev/cu.usbserial-14P54810"のポヌトず 57600 の速床で通信する arduino むンスタンスを生成する - 14 行目でフレヌムレヌトを 30 ずしおいる - 23–32 行目プログラムの動䜜 - 23 行目で入力甚の倉数 input0 を宣蚀しおいる。 - 27 行目で背景色を灰色に蚭定する。 - 28 行目で ArduinoA0 ピンのアナログ入力を input0 に入れる。 - 31 行目で input0 を数倀ずしお衚瀺する *結果* @距離センサヌの距離ずマむコンぞのアナログ入力倀の関係倀 は、実隓1の結果における、距離センサヌの距離ずマむコンぞのアナログ入力倀の関係を瀺しおいる。 グラフによるず、距離センサに物䜓を近づければ、マむコンのアナログ入力倀が高くなる。 #figure( image("./img/距離センサヌの距離ずマむコンぞのアナログ入力倀の関係倀.png",width: 75%), caption: "距離センサ距離枬定特性" )<距離センサヌの距離ずマむコンぞのアナログ入力倀の関係倀> *考察* 出力される倀は距離ず反比䟋の関係にある。 距離センサヌは反比䟋の関係にあるため、アナログ入力倀を甚いお距離の枬定ができる。距離が10~20cmの間が䞀番感床が高く、他の郚分に比べお现かい距離の倉化を感知できる。 #pagebreak() // ペヌゞを分ける === 実隓その2 (動䜜可胜範囲の確認) プレレポヌトから距離センサには動䜜可胜範囲があり、ある䞀定条件䞋では正しいアナログ倀が埗られないこずが分かる。そこで動䜜䞍可胜範囲に぀いおもアナログ入力倀を調べ、動䜜可胜範囲、䞍可胜範囲の䞡方を含むグラフを䜜成しなさい。 *回路図・プログラム* 装眮、プログラムは実隓その1ず同じものを䜿甚する。 *結果* @距離ずマむコンぞのアナログ入力倀の察数グラフ_動䜜可胜範囲の確認 をみるず、距離センサは近くなる皋、倀が増えおいくはずだが、10cmより近づくず枛っおいく。 たた、80cmより遠くなるず倀は同じになっおしたう。 プレレポヌトで怜玢した情報ず䞀臎しおいる。 #figure( image("./img/距離ずマむコンぞのアナログ入力倀の察数グラフ.png",width: 80%), caption: "距離センサ距離枬定特性" )<距離ずマむコンぞのアナログ入力倀の察数グラフ_動䜜可胜範囲の確認> *考察* 距離センサは、枬定可胜範囲が50mm~800mm皋床である。この範囲倖では正確な倀が埗られない。 理由ずしおは、遠すぎるず反射光が匱くなり、受講郚に届かなくなるため、近すぎるず発酵郚ず反射郚の間で乱反射しおしたい、正確な倀が埗られないためだず考えられる。 枬定可胜範囲は50mm~800mm皋床だず考えられる。 デヌタシヌトずも比范しおも、ほが䞀臎しおいるため、正確な倀が埗られるず考えられる。 === 発展その1 (距離センサを甚いた状態識別) 距離センサぞの入力倀により、ある2぀の状態を「distant」もしくは「close」ず識別しお衚瀺させなさい。たた、ある2぀の状態 (䟋えばパ゜コンの党高より高いか䜎いか)」は自分で決め、これを実珟する境界倀ず䞍感垯を導き出しお䜿甚しなさい。 #pagebreak() // ペヌゞを分ける *回路図・プログラム* 装眮は実隓その1ず同じものを䜿甚する。 @距離センサを甚いた状態識別する゜ヌスコヌド は、発展その1で䜿甚した距離センサを甚いた状態識別する゜ヌスコヌドを瀺しおいる。 #figure( sourcecode[```c //プログラムに必芁な倉数の宣蚀及び定矩 import processing.serial.*; import cc.arduino.*; Arduino arduino; PFont myFont; int usePin0 = 0; //Arduino A0ピン int usePin1 = 3; //Arduino A1ピン //Arduino 及びプログラムの初期蚭定 void setup(){ size(600, 250); arduino = new Arduino( this, "/dev/cu.usbserial-14P54810" ); myFont = loadFont("CourierNewPSMT-48.vlw"); textFont(myFont, 30); frameRate(30); } // 入力倀の栌玍甚倉数 int input0; // 䞍感垯の閟倀 int closeDiv = 330; int distantDiv = 270; // 状態の栌玍甚倉数 String status = ""; //プログラム本䜓 (以䞋を繰り返し実行) void draw(){ background(120); input0 = arduino.analogRead(usePin0); //入力倀を衚瀺 text("A0: " + input0, 50, 100); // 䞍感垯の蚭定 if(input0 > closeDiv){ status = "close"; } if(input0 < distantDiv){ status = "distant"; } // 状態の衚瀺 text("Status: " + status, 50, 150); } ```], caption: "距離センサを甚いた状態識別する゜ヌスコヌド" )<距離センサを甚いた状態識別する゜ヌスコヌド> - プログラムの抂芁 センサから ArduinoA0 ピンぞの入力倀をアナログ入力ずしお読み蟌む。読み蟌んだ倀を数倀ずしお衚瀺し、その倀によっお状態を識別する。 - プログラムの説明 - 1–9 行目: プログラムに必芁な倉数の宣蚀および定矩たたはラむブラリのむンポヌトを行う。 - 8,9行目で Arduino A0, D3 ピンの䜿甚を usePin0 = 0 , usePin1 = 3 ずしお定矩しおいる。 - 12–21 行目: Arduino およびプログラムの初期蚭定 - 10 行目で画面衚瀺に甚いるりィンドりサむズを暪 600px,瞊 250px ず定矩しおいる。 - 11 行目で"/dev/cu.usbserial-14P54810"のポヌトず通信する arduino むンスタンスを生成する - 14 行目でフレヌムレヌトを 30 ずしおいる - 23–52 行目プログラムの動䜜 - 24 行目で入力甚の倉数 input0 を宣蚀しおいる。 - 27,28 行目で閟倀を蚭定しおいる。 - 30 行目で状態を栌玍する倉数 status を宣蚀しおいる。 - 35 行目で背景色を灰色に蚭定する。 - 36 行目で ArduinoA0 ピンのアナログ入力を input0 に入れる。 - 39 行目で input0 を数倀ずしお衚瀺する - 42–48 行目で入力倀によっお状態を識別する。䞍感垯を䜜成し、その範囲内で状態を識別する。 - 51 行目で状態を衚瀺する。 *結果* 今回、MacBookAirのディスプレむの高さを閟倀ずし、閟倀より高いか䜎いかで状態を識別する。 MacBookAirのディスプレむの高さより䜎いか高いかで掚定を行う。ずしおは、マむコンぞのアナログ入力倀300を目凊ずしおいる。 たた、ディスプレむの高さギリギリでだず掚定が䞍安定になるため䞍感垯を儲ける。䞍感垯は270–330ずする。 *考察* 䞍感垯をこれより狭めた状態で、センサず物䜓の距離を20cm前埌を保぀ず、状態が安定しない。 逆に䞍感垯を倧きくするず刀定される距離が広くなり、枬りたい距離を正確に枬れなくなる。 そのため、今回䞍感垯の蚭定を270-330ずし、距離センサず物䜓の距離を20cm前埌を保っおも、状態の安定を確認できた。 #pagebreak() // ペヌゞを分ける === 発展その2 (状態識別を甚いた LED 点灯制埡) 第3章で甚いたLEDを䜿い、䞀定距離以䞊近づくず、LED が点灯するようにしなさい. たた、「䞀定距離」が䜕を指すかを自分で決め、これを実珟する境界倀ず䞍感垯を導き出しお䜿甚しなさい。 *回路図・プログラム* @実隓2回路図 は、発展その2の回路図を瀺す。 装眮は実隓その1にLEDを远加しお䜿甚する。 #figure( image("./img/実隓2回路図.png",width: 75%), caption: "実隓2回路図" )<実隓2回路図> @距離センサを甚いた状態識別しおLED衚瀺する゜ヌスコヌド は、発展その2で䜿甚した距離センサを甚いた状態識別しおLED衚瀺する゜ヌスコヌドを瀺しおいる。 発展その1で䜜成した゜ヌスコヌドの51ず52行目の間に挿入する。 #figure( sourcecode[```c // 状態に応じた凊理 if(status.equals("close")){ //close の時の凊理 arduino.analogWrite(usePin1, 255); }else if(status.equals("distant")){ //distant の時の凊理 arduino.analogWrite(usePin1, 0); } ```], caption: "距離センサを甚いた状態識別しおLED衚瀺する゜ヌスコヌド" )<距離センサを甚いた状態識別しおLED衚瀺する゜ヌスコヌド> - プログラムの抂芁 センサから ArduinoA0 ピンぞの入力倀をアナログ入力ずしお読み蟌む。読み蟌んだ倀を数倀ずしお衚瀺し、その倀によっお状態を識別する。 - プログラムの説明 - 2行目でstatusがcloseか刀定をする。 - 4行目でusePin1に5Vを出力する。 - 6行目でstatusがdistantか刀定をする。 - 8行目でusePin1に0Vを出力する。 *結果* 今回、MacBookAirのディスプレむの高さを閟倀ずし、閟倀より高いか䜎いかで状態を識別する。 MacBookAirのディスプレむの高さより䜎いか高いかで掚定を行う。ずしおは、マむコンぞのアナログ入力倀300を目凊ずしおいる。 たた、ディスプレむの高さギリギリだず掚定が䞍安定になるため䞍感垯を儲ける。䞍感垯は270–330ずする。 *考察* 䞍感垯をこれより狭めた状態で、センサず物䜓の距離を20cm前埌を保぀ず、状態が安定しない。 逆に䞍感垯を倧きくするず枬りたい距離を正確に枬れなくなる。 LEDを远加したので、センサず物䜓の距離が䞀定以䞊近づくずLEDが点灯するようになった。それにより、ハヌドりェアのみで入力から出力たでの凊理を行えるようになった。 === たずめ 今回の実隓を通しお、距離センサ GP2Y0A21YK0Fの䜿い方ず仕組みを習埗できた。 距離センサは、反比䟋の関係にあるため、アナログ入力倀を甚いお距離の枬定ができる。距離が10~20cmの間が䞀番感床が高く、他の郚分に比べお现かい距離の倉化を感知できる。 たた、枬定可胜範囲が50mm~800mm皋床であるず分かった。 距離センサを甚いた状態識別を行うず、センサず物䜓の距離を20cm前埌を保぀時、状態が安定しないこずが分かった。 そのため、䞍感垯を甚いお、センサず物䜓の距離を20cm前埌を保っおも、状態の安定を確認できた。 #pagebreak() // ペヌゞを分ける // bibファむルの指定 // #bibliography("./bibliography.bib")
https://github.com/jrihon/cv
https://raw.githubusercontent.com/jrihon/cv/main/sections/education.typ
typst
// import template here as well, to get all the functions #import "../brilliant-template/template.typ": * #v(-1.5em) // comment out when using profile picture #boxEnvironment( "About me", right, [ Currently a PhD candidate on the topic of modified nucleic acids by means of _in silico_ research. I use computational chemistry to characterise nucleosides and perform simulations to understand their structural dynamics. I program to optimise research methodologies. Coming from a pharmaceutical background, I bring the best of both worlds.\ \ I am interested in writing performant libraries for chem- and bioinformatics tools, targetting developers as my audience.\ Open to academic and industry positions. ] ) #cvSection("Professional and Education") #cvEntry( title: [PhD in Pharmaceutical Sciences], society: [Rega Institute for Medical Resarch, Catholic University of Leuven, Leuven], date: [2020 - Present], location: [BE], logo: "../src/logos/Kuleuven_logo.png", description: list( [Thesis: _Molecular modeling tools to improve and expand computational research on synthetic nucleic acids_ (Supervisors : prof.dr. <NAME>, prof.dr. <NAME>)], [Researching the fundamentals of (xenobiotic) nucleic acids through computational chemistry and molecular modeling], [Software development to facilitate computational research on nucleic acids], [Teaching assistant in the Biopharmaceutical Analysis practical courses], ), keywords : [Molecular Dynamics, Computational Chemistry, Python, Rust, Linux, Shell, Linear Algebra], ) #cvEntry( title: [Master of Drug Design and Development (_cum laude_)], society: [Catholic University of Leuven, Leuven], date: [2018 - 2020], location: [BE], logo: "../src/logos/Kuleuven_logo.png", description: list( [Thesis: _Development of an allergophore to predict and analyse cross-reactivity in corticosteroid-mediated drug allergy_ (Supervisor : prof.dr. <NAME>)] ), keywords : [Molecular Dynamics, Linux, Shell, Molecular Docking], ) #cvEntry( title: [Bachelors of Pharmaceutical Sciences], society: [Catholic University of Leuven, Leuven], date: [2013 - 2018], location: [BE], logo: "../src/logos/Kuleuven_logo.png", ) #v(-9pt)
https://github.com/flechonn/typst
https://raw.githubusercontent.com/flechonn/typst/main/data/doc1.typ
typst
= 1. Exercice : Appliquer la loi d'Ohm. Solution : $V = I * R$ Niveau d'indice : Débutant = 2. Exercice : Résoudre un problÚme de mouvement rectiligne uniformément accéléré. Solution : $x(t) = x₀ + v₀t + (1/2)at²$ Niveau d'indice : Intermédiaire
https://github.com/ns-shop/ns-shop-typst
https://raw.githubusercontent.com/ns-shop/ns-shop-typst/main/chapter3.typ
typst
#import "template.typ": * #h1("Xây dá»±ng sản phẩm") #h2("Chuẩn bị mÃŽi trường phát triển") #tabl( columns: (auto, 1fr), [OS], [Linux], [Web hosting control panel], [cPanel], [Webserver], [Apache], [Version control system], [Git, Github], [Web framework], [Laravel], [Database], [MySQL], [IDE], [Visual Studio Code], cap: "MÃŽi trường phát triển website TMĐT", ) Việc chuẩn bị mÃŽi trường phát triển là rất quan trọng trong quá trình phát triển của một dá»± án web. Có nhiều yếu tố ảnh hưởng đến việc lá»±a chọn cÃŽng nghệ: chi phí, chất lượng nhân lá»±c, tính mở rộng, sá»± phổ biến và hỗ trợ từ cộng đồng của cÃŽng nghệ đó,... Việc lá»±a chọn cÃŽng nghệ phù hợp với dá»± án giúp cho việc phát triển dá»± án nhanh chóng, hiệu quả và ít rủi ro hÆ¡n. Sau nhiều lần tìm hiểu và cân nhắc, tác giả quyết định sá»­ dụng Laravel là một web framework hỗ trợ rất mạnh mẜ trong việc xây dá»±ng website. Laravel được sá»­ dụng rất phổ biến trong cộng đồng lập trình viên web vì sá»± mạnh mẜ cÅ©ng nhÆ° hỗ trợ và cập nhật rất tốt từ tác giả và cộng đồng. Vể IDE thì lá»±a chọn phổ biến nhất cho lập trình viên web đó là VS Code do đây là IDE được sá»­ dụng phổ biến và được hỗ trợ rất tốt từ cộng đồng với khả năng tùy biến cao và nhiều plugin kÚm theo. Ngoài ra còn do cá nhân tác giả đã có nhiều kinh nghiệm sá»­ dụng VS Code. Đây là lá»±a chọn thuộc về chất lượng nhân lá»±c. Về phần hạ tầng tác giả chủ trÆ°Æ¡ng sá»­ dụng web hosting để tiết kiệm chi phí và dễ dàng bảo trì, do đó đi kÚm theo là sá»­ dụng hệ điều hành Linux, cPanel control panel, MySQL database và Apache web server do đây là 4 service kÚm theo phổ biến của shared web hosting và cÅ©ng phù hợp với nhu cầu dá»± án. #h2("Xây dá»±ng cÆ¡ sở dữ liệu") Mã SQL trên định nghÄ©a các bảng trong cÆ¡ sở dữ liệu MySQL. Dưới đây là danh sách các bảng và chức năng của chúng: Bảng `addresses`: - Chức năng: LÆ°u trữ thÃŽng tin địa chỉ. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `country`: `varchar(255)`, khÃŽng được để trống. - `city`: `varchar(255)`, khÃŽng được để trống. - `state`: `varchar(255)`, khÃŽng được để trống. - `street`: `varchar(255)`, khÃŽng được để trống. - `zip_code`: `varchar(255)`, khÃŽng được để trống. Bảng `cart_items`: - Chức năng: LÆ°u trữ thÃŽng tin về các mục trong giỏ hàng. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `product_id`: Khóa ngoại đến bảng `products` (id). - `user_id`: Khóa ngoại đến bảng `users` (id). - `quantity`: Số nguyên khÃŽng dấu, khÃŽng được để trống. - `created_at`: Thời điểm tạo, kiểu timestamp, khÃŽng được để trống. - `updated_at`: Thời điểm cập nhật, kiểu timestamp, khÃŽng được để trống. - `deleted_at`: Thời điểm xóa, kiểu timestamp, có thể là null. Bảng `fulfilled_orders`: - Chức năng: LÆ°u trữ thÃŽng tin về các đơn hàng đã hoàn tất. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `phone`: `varchar(255)`, khÃŽng được để trống. - `email`: `varchar(255)`, khÃŽng được để trống. - `total`: Số thá»±c khÃŽng dấu, khÃŽng được để trống. - `status`: Số nguyên khÃŽng dấu, khÃŽng được để trống. - `created_at`: Thời điểm tạo, kiểu timestamp, có thể là null. - `updated_at`: Thời điểm cập nhật, kiểu timestamp, có thể là null. - `shipping_provider_id`: Khóa ngoại đến bảng "shipping_providers" (id). - `tracking_id`: `varchar(255)`, khÃŽng được để trống. - `note`: `varchar(255)`, có thể là null. - `shipping_cost`: Số thá»±c khÃŽng dấu, khÃŽng được để trống. - `address_id`: Khóa ngoại đến bảng "addresses" (id). Bảng `orders`: - Chức năng: LÆ°u trữ thÃŽng tin về các đơn hàng. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `payment_method_id`: Khóa ngoại đến bảng `payment_methods` (id). - `name`: `varchar(255)`, khÃŽng được để trống. - `email`: `varchar(255)`, khÃŽng được để trống. - `phone`: `varchar(255)`, khÃŽng được để trống. - `total`: Số thá»±c khÃŽng dấu, khÃŽng được để trống. - `note`: Kiểu văn bản, có thể là null. - `status`: ENUM('unpaid', 'processing', 'paid', 'cancelled', 'cod'), khÃŽng được để trống. - `user_id`: Khóa ngoại đến bảng `users` (id). - `address_id`: Khóa ngoại đến bảng `addresses` (id). - `fulfilled_order_id`: Khóa ngoại đến bảng `fulfilled_orders` (id), có thể là null. - `created_at`: Thời điểm tạo, kiểu timestamp, khÃŽng được để trống. - `updated_at`: Thời điểm cập nhật, kiểu timestamp, khÃŽng được để trống. - `deleted_at`: Thời điểm xóa, kiểu timestamp, có thể là null. Bảng `order_items`: - Chức năng: LÆ°u trữ thÃŽng tin về các mục hàng trong đơn hàng. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `product_id`: Khóa ngoại đến bảng `products` (id). - `quantity`: Số nguyên khÃŽng dấu, khÃŽng được để trống. - `price`: Số thá»±c khÃŽng dấu, khÃŽng được để trống. - `order_id`: Khóa ngoại đến bảng `orders` (id). Bảng `payment_methods`: - Chức năng: LÆ°u trữ thÃŽng tin về các phÆ°Æ¡ng thức thanh toán. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `name`: `varchar(255)`, khÃŽng được để trống. - `code`: `varchar(255)`, khÃŽng được để trống. - `enable`: Số nguyên nhỏ (1 hoặc 0), khÃŽng được để trống. Bảng `products`: - Chức năng: LÆ°u trữ thÃŽng tin về các sản phẩm. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `name`: `varchar(255)`, khÃŽng được để trống. - `description`: Kiểu văn bản, có thể là null. - `price`: Số thá»±c khÃŽng dấu, khÃŽng được để trống. - `sku`: `varchar(255)`, khÃŽng được để trống. - `availability`: Số nguyên nhỏ (1 hoặc 0), khÃŽng được để trống. - `quantity`: Số nguyên, có thể là null. - `discount_price`: Số thá»±c khÃŽng dấu, có thể là null. - `slug`: `varchar(255)`, khÃŽng được để trống. - `created_at`: Thời điểm tạo, kiểu timestamp, khÃŽng được để trống. - `updated_at`: Thời điểm cập nhật, kiểu timestamp, khÃŽng được để trống. - `deleted_at`: Thời điểm xóa, kiểu timestamp, có thể là null. Bảng `shipping_providers`: - Chức năng: LÆ°u trữ thÃŽng tin về nhà cung cấp vận chuyển. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `name`: `varchar(255)`, khÃŽng được để trống. - `code`: `varchar(255)`, khÃŽng được để trống. - `enable`: Số nguyên nhỏ (1 hoặc 0), khÃŽng được để trống. Bảng `users`: - Chức năng: LÆ°u trữ thÃŽng tin về người dùng. - Các cột: - `id`: Khóa chính, số nguyên khÃŽng dấu, tá»± động tăng. - `name`: `varchar(255)`, khÃŽng được để trống. - `email`: `varchar(255)`, khÃŽng được để trống, duy nhất. - `email_verified_at`: Thời điểm xác minh email, kiểu timestamp, có thể là null. - `password`: `varchar(255)`, khÃŽng được để trống. - `remember_token`: `varchar(100)`, có thể là null. - `created_at`: Thời điểm tạo, kiểu timestamp, khÃŽng được để trống. - `updated_at`: Thời điểm cập nhật, kiểu timestamp, khÃŽng được để trống. Những bảng có cột `deleted_at` cho thấy có sá»­ dụng cÆ¡ chế "soft delete" (soft delete là phÆ°Æ¡ng pháp đánh dấu thời gian thá»±c hiện xóa bản ghi ở cột `deleted_at` nhÆ°ng khÃŽng xóa bản ghi trong cÆ¡ sở dữ liệu, website sẜ dá»±a vào đó để truy vấn và chỉ trả về những bản ghi chÆ°a có giá trị `deleted_at`). // @startuml // !define Table(name,desc) class name as "desc" << (T,#FFAAAA) >> // !define primary_key(x) <b>x</b> // !define foreign_key(x) <u>x</u> // !define unique(x) <i>x</i> // !define index(x) <i>x</i> // hide methods // hide stereotypes // Table(addresses, "addresses") { // primary_key(id) bigint unsigned // country varchar(255) // city varchar(255) // state varchar(255) // street varchar(255) // zip_code varchar(255) // } // Table(cart_items, "cart_items") { // primary_key(id) bigint unsigned // foreign_key(product_id) bigint unsigned // foreign_key(user_id) bigint unsigned // quantity int unsigned // created_at timestamp // updated_at timestamp // deleted_at timestamp // } // Table(fulfilled_orders, "fulfilled_orders") { // primary_key(id) bigint unsigned // phone varchar(255) // email varchar(255) // total double unsigned // status int unsigned // created_at timestamp // updated_at timestamp // foreign_key(shipping_provider_id) bigint unsigned // tracking_id varchar(255) // note varchar(255) // shipping_cost double unsigned // foreign_key(address_id) bigint unsigned // } // Table(orders, "orders") { // primary_key(id) bigint unsigned // foreign_key(payment_method_id) bigint unsigned // name varchar(255) // email varchar(255) // phone varchar(255) // total double unsigned // note text // status enum // foreign_key(user_id) bigint unsigned // foreign_key(address_id) bigint unsigned // foreign_key(fulfilled_order_id) bigint unsigned // created_at timestamp // updated_at timestamp // deleted_at timestamp // } // Table(order_items, "order_items") { // primary_key(id) bigint unsigned // foreign_key(product_id) bigint unsigned // quantity int unsigned // price double unsigned // foreign_key(order_id) bigint unsigned // } // Table(payment_methods, "payment_methods") { // primary_key(id) bigint unsigned // name varchar(255) // code varchar(255) // enable tinyint(1) // } // Table(products, "products") { // primary_key(id) bigint unsigned // name varchar(255) // description text // price double unsigned // sku varchar(255) // availability tinyint(1) // quantity int // discount_price double unsigned // slug varchar(255) // created_at timestamp // updated_at timestamp // deleted_at timestamp // } // Table(shipping_providers, "shipping_providers") { // primary_key(id) bigint unsigned // name varchar(255) // code varchar(255) // enable tinyint(1) // } // Table(users, "users") { // primary_key(id) bigint unsigned // name varchar(255) // email varchar(255) // email_verified_at timestamp // password varchar(255) // remember_token varchar(100) // created_at timestamp // updated_at timestamp // } // addresses "1" -- "1..*" orders // fulfilled_orders "1" -- "1..*" orders // payment_methods "1" -- "1..*" orders // shipping_providers "1" -- "1..*" fulfilled_orders // products "1" -- "1..*" order_items // users "1" -- "1..*" orders // users "*" -- "1..*" cart_items // addresses "*" -- "1" fulfilled_orders // orders "1" -- "0..1" fulfilled_orders // orders "*" -- "1..*" order_items // products "*" -- "1..*" cart_items // @enduml #img("55image.png", cap: "Biểu đồ quan hệ mÃŽ tả cấu trúc các bảng và quan hệ giữa chúng trong cÆ¡ sở dữ liệu của website TMĐT") #h2("Xây dá»±ng giao diện và trải nghiệm người dùng") #h3("Cài đặt và sá»­ dụng thÆ° viện Tailwind") Tác giả sá»­ dụng hệ thống thiết kế cÆ¡ bản của Tailwind làm hệ thống thiết kế chính cho dá»± án. Tailwind là một thÆ° viện design component phổ biến trong cộng đồng do đó có đa dạng thiết kế và Ãœ tưởng được hỗ trợ từ cộng đồng. KÚm theo đó là sá»­ dụng cÃŽng cụ Vite để biên dịch và đóng gói code @vite. Để cài đặt Tailwind cho website ta thá»±c hiện các bước sau: Cài đặt thÆ° viện Tailwind bằng câu lệnh: ```sh npm install -D tailwindcss ``` Khởi tạo file cấu hình Tailwind bằng câu lệnh: ```sh npx tailwindcss init ``` Sau khi chạy câu lệnh hệ thống sẜ tạo ra file `tailwind.config.js` với nội dung bên dưới, trong file này ta có thể cài đặt thêm các plugin, theme và khai báo vào thuộc tính tÆ°Æ¡ng ứng, ngoài ra ta còn có thể cấu hình cho Tailwind tá»± động đọc và hot-reload những file được khai báo trong thuộc tính `content`: ```js export default { content: [], corePlugins: {}, plugins: [], }; ``` Sau khi tác giả cài đặt các thÆ° viện cần thiết và khai báo đường dẫn những file giao diện web thì file có nội dung nhÆ° sau: ```js import forms from '@tailwindcss/forms'; /** @type {import('tailwindcss').Config} */ export default { content: [ './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', './storage/framework/views/*.php', './resources/views/**/*.blade.php', ], corePlugins: { aspectRatio: false, }, plugins: [forms, require('@tailwindcss/typography'), require('@tailwindcss/aspect-ratio'), require('@tailwindcss/forms')], }; ``` Tiếp đến ta tạo file `app.css` vói nội dung nhÆ° bên dưới, file CSS này import các thÆ° viện CSS cùa Tailwind: ```css @tailwind base; @tailwind components; @tailwind utilities; ``` Trong file `vite.config.js` ta cấu hình Tailwind cho Laravel nhÆ° sau: ```js import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ laravel({ input: ['path/to/app.css'], // replace your app.css path refresh: true, }), ], }); ``` Sau khi đã cài đặt và cấu hình, ta chạy câu lệnh bên dưới để Tailwind tiến hành đọc và biên dịch những file được khai báo: ```sh npm run dev ``` Cuối cùng mở Visual Studio Code và truy cập mã nguồn giao diện của website để lập trình. Ví dụ một đoạn mã giao diện sá»­ dụng các class của thÆ° viện Tailwind trong Laravel Blade: ```html <div {{ $attributes->merge(['class' => 'rounded-md bg-green-50 dark:bg-green-900 p-4']) }}> <div class="flex"> <div class="flex-shrink-0"> <!-- Heroicon name: solid/check-circle --> <svg class="h-5 w-5 text-green-400 dark:text-green-200" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /> </svg> </div> <div class="ml-3"> <p class="text-sm font-medium text-green-800 dark:text-green-200"> {{ $slot }} </p> </div> </div> </div> ``` Kết quả hiển thị: #img("Screenshot 2023-06-07 013927.png", cap: "Giao diện thÃŽng báo thành cÃŽng của website") #h3("Xây dá»±ng thành phần giao diện website") Thành phần giao diện của website được xây dá»±ng trong thÆ° mục `views` của website bao gồm các thÆ° mục chính bên trong sau: - `components`: Chứa các thành phần giao diện có thể tái sá»­ dụng nhiều lần trong website nhÆ° giao diện thÃŽng báo, bảng, ÃŽ nhập, menu,... - `layouts`: Chứa các khung giao diện có thể tái sá»­ dụng nhiều lần ở các trang trong website. Ví dụ nhÆ° khung giao diện quản trị nội dung và khung giao diện website dành cho khách hàng. - `livewire`: Chứa những thành phần giao diện website có thể tÆ°Æ¡ng tác trong thời gian thá»±c với server nhÆ° trang quản lÃœ giỏ hàng, nút thêm sản phẩm vào giỏ hàng. - `admin`: Chứa các giao diện của các trang quản trị website. Việc phân tách các giao diện có chức năng tÆ°Æ¡ng tá»± nhau vào các thÆ° mục cụ thể giúp cho việc quản lÃœ mã nguồn giao diện dễ dàng hÆ¡n và tối Æ°u hiệu suất khi lập trình. #h3("Trải nghiệm người dùng") Tác giả đã dành nhiều thời gian tham gia trải nghiệm các sản phẩm tÆ°Æ¡ng tá»± khác, trong số đó có nhiều sản phẩm phổ biến để đánh giá Æ°u nhược điểm của trải nghiệm người dùng từ đó cải thiện trải nghiệm cho sản phẩm này. Trong quá trình xây dá»±ng giao diện và trải nghiệm người dùng cho website TMĐT, tác giả đã đặt trọng điểm vào việc mang lại trải nghiệm tuyệt vời và thuận tiện cho người dùng. Đây là một phần quan trọng để thu hút và giữ chân khách hàng. Đảm bảo người dùng dễ dàng tìm thấy và khám phá các sản phẩm một cách nhanh chóng. Giao diện được thiết kế đơn giản, với bố cục rõ ràng và các thành phần giao diện được sắp xếp hợp lÃœ, tạo ra một trải nghiệm trá»±c quan và dễ sá»­ dụng. Việc đăng kÃœ tài khoản cÅ©ng được đơn giản hóa để người dùng có thể nhanh chóng trở thành thành viên của trang web. Website đã tích hợp các tùy chọn đăng kÃœ thÃŽng qua email và mật khẩu, cùng với việc đăng kÃœ bằng tài khoản Google, giúp người dùng tiết kiệm thời gian hÆ¡n. Tính năng giỏ hàng được thiết kế để giúp người dùng quản lÃœ và kiểm soát quá trình mua hàng một cách thuận tiện. Người dùng có thể dễ dàng thêm và xóa sản phẩm trong giỏ hàng, cập nhật số lượng sản phẩm và xem tổng giá trị đơn hàng. Điều này giúp người dùng có trải nghiệm mua sắm trá»±c tuyến mượt mà và tiết kiệm thời gian. Website cÅ©ng đã tích hợp nhiều phÆ°Æ¡ng thức thanh toán đa dạng để đáp ứng nhu cầu và sá»± thuận tiện của người dùng. Các tùy chọn thanh toán nhÆ° Zalopay, Paypal và nhiều hÆ¡n nữa được tích hợp vào website, cho phép người dùng lá»±a chọn phÆ°Æ¡ng thức phù hợp và hoàn tất quá trình thanh toán một cách dễ dàng. #img("18image.png", cap: "Giao diện trang xem giỏ hàng của website") #img("19image.png", cap: "Giao diện trang đăng kÃœ của website") Website cÅ©ng đã được tối Æ°u hóa cho trải nghiệm di động, giúp người dùng truy cập và duyệt sản phẩm trên các thiết bị di động một cách thuận tiện. Thiết kế đáp ứng (RWD) đã được áp dụng để đảm bảo giao diện hiển thị tốt trên các kích thước màn hình khác nhau, từ điện thoại thÃŽng minh đến máy tính bảng và máy tính để bàn. #img("Screenshot 2023-06-07 015605.png", cap: "Giao diện website khi responsive ở màn hình máy tính (1280px)", width: 90%) #img("20image.png", cap: "Giao diện website khi responsive ở màn hình Iphone 11 Pro (375px)", width: 38%) #h2("Lập trình các chức năng và tính năng") #h3("Tính năng đăng nhập và đăng kÃœ với email/password") Mặc định website sẜ sá»­ dụng email/password để tiến hành đăng nhập, website sẜ lÆ°u thÃŽng tin tên, email của người dùng. Ngoài ra còn hỗ trợ tính năng "Remember me" giúp người dùng dễ dàng quản lÃœ phiên đăng nhập cho mình. @breeze Code xá»­ lÃœ tính năng đăng nhập với email/password: ```php if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.failed'), ]); } ``` Code xá»­ lÃœ tính năng đăng kÃœ với email/password: ```php public function store(Request $request): RedirectResponse { $request->validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:' . User::class], 'password' => ['required', 'confirmed', 'min:8', Rules\Password::defaults()], ]); $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'password' => <PASSWORD>::<PASSWORD>($request->password), ]); event(new Registered($user)); Auth::login($user); return redirect(RouteServiceProvider::HOME); } ``` #h3("Tính năng đăng nhập và đăng kÃœ với tài khoản Google") Tính năng đăng nhập và đăng kÃœ với tài khoản Google sá»­ dụng chuẩn OAuth 2.0 để triển khai trong website. Các bước triển khai được trình bày bên dưới. @oauth20google Tạo Google OAuth Credentials: - Vào trang https://console.developers.google.com và tạo project mới. - Bật tính năng Google+ API bằng cách vào mục "Library" và tìm "Google+ API". Chọn và kích hoạt. - Vào mục "Credentials" và chọn "Create Credentials". Chọn "OAuth client ID" ở menu xổ xuống. - Cấu hình "name" và "authorized domains" của mục OAuth consent screen. - Chọn "Web application". - Thêm authorized redirect URIs. Ví dụ ở đây là `http://localhost/auth/google/callback` cho mÃŽi trường phát triển. - Chọn "Create" để tạo OAuth client. LÆ°u giá trị mục "Client ID" và "Client Secret" vừa tạo. Cấu hình Laravel: Mở file `.env` và thêm Google OAuth client credentials: ``` GOOGLE_CLIENT_ID=your-client-id GOOGLE_CLIENT_SECRET=your-client-secret GOOGLE_REDIRECT_URI=http://localhost/auth/google/callback ``` Tạo routes cho việc xác thá»±c Google ở file `routes/web.php`: ```php Route::get('/auth/google', [LoginController::class, 'redirectToGoogle']); Route::get('/auth/google/callback', [LoginController::class, 'handleGoogleCallback']); ``` Tạo mới controller tên `LoginController` sá»­ dụng câu lệnh sau: ```bash php artisan make:controller Auth/LoginController ``` Mở file `LoginController.php` và triển khai hàm `redirectToGoogle` có chức năng chuyển hướng người dùng đến trang xác thá»±c của Google và hàm `handleGoogleCallback` có chức năng nhận dữ liệu đã xác thá»±c phía Google gá»­i về: ```php public function redirectToGoogle() { $params = [ 'client_id' => config('app.google_client_id'), 'redirect_uri' => config('app.google_redirect_uri'), 'response_type' => 'code', 'scope' => 'openid email profile', 'state' => csrf_token(), ]; $url = 'https://accounts.google.com/o/oauth2/auth?' . http_build_query($params); return redirect($url); } public function handleGoogleCallback(Request $request) { $state = $request->query('state'); $code = $request->query('code'); if ($state !== csrf_token()) return redirect('/login')->withErrors('Invalid state parameter'); $response = Http::asForm()->post('https://oauth2.googleapis.com/token', [ 'code' => $code, 'client_id' => config('app.google_client_id'), 'client_secret' => config('app.google_client_secret'), 'redirect_uri' => config('app.google_redirect_uri'), 'grant_type' => 'authorization_code', ]); if ($response->failed()) return redirect('/login')->withErrors('Failed to retrieve access token'); $access_token = $response->json('access_token'); $response = Http::withHeaders([ 'Authorization' => 'Bearer ' . $access_token, ])->get('https://www.googleapis.com/oauth2/v3/userinfo'); if ($response->failed()) return redirect('/login')->withErrors('Failed to retrieve user information'); $user = $response->json(); Auth::loginUsingId($userId); return redirect('/home'); } ``` Đoạn code bên trên cÅ©ng là code triển khai OAuth 2.0 của Google vào website Laravel. Cuối cùng thêm đoạn code hiển thị nút đăng nhập với Google vào trang đăng nhập của website: ```html <div {{ $attributes }}> <a href="{{ route('auth.google.redirect') }}" class="flex items-center justify-center bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold py-2 px-4 border border-gray-300 dark:border-gray-700 rounded-lg shadow-md transition duration-300 ease-in-out hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-800"> <img class="w-6 h-6 mr-2" src="{{ asset('assets/images/google.svg') }}" alt="Login with Google" /> Sign in with Google </a> </div> ``` Sá»­ dụng tính năng: - Khởi động Docker, sau đó khởi Laravel bằng câu lệnh: ```bash sail up -d ``` - Vào link trang đăng nhập của website sau đó nhấn chọn "Login with Google". - Ta sẜ được chuyển hướng đến trang đăng nhập của Google. Tiến hành đăng nhập và xác thá»±c tài khoản. - Sau khi xác thá»±c thành cÃŽng ta sẜ được chuyển hướng về trang `/home`. #h3("Tính năng giỏ hàng") Tính năng giỏ hàng của website yêu cầu khách hàng phải đăng nhập để sá»­ dụng. Dá»±a vào mÃŽ hình dữ liệu được thiết kế ở mục 2.2.2 thì mỗi khách hàng sẜ có một giỏ hàng duy nhất. Sau khi đăng nhập, khi khách hàng nhấn nút "Add to cart" thì sản phẩm sẜ được thêm vào giỏ hàng của khách hàng và được cập nhật ngay lập tức mà khÃŽng cần load lại trang. Việc khÃŽng load lại trang giúp cho trải nghiệm mua sắm của khách hàng được mượt mà trÆ¡n tru hÆ¡n. #img("21image.png", cap: "Giao diện của nút thêm sản phẩm vào giỏ hàng") Code giao diện của tính năng thêm sản phẩm vào giỏ hàng: ```html <button wire:loading.attr="disabled" wire:target="addToCart" wire:click="addToCart" class="mt-8 w-full bg-indigo-600 border border-transparent rounded-md py-3 px-8 flex items-center justify-center text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"> <x-loading-spin class="mt-2" wire:loading wire:target="addToCart" /> Add to cart </button> ``` Code xá»­ lÃœ của tính năng thêm sản phẩm vào giỏ hàng: ```php public function addToCart($quantity = 1) { try { $user = Auth::user(); if (!$user->id) throw new Exception('You must be logged in to add to cart.', 1); // check quantity if ($quantity < 1) throw new Exception('Quantity must be greater than 0.', 1); // check product exists $product = Product::find($this->productId); if (is_null($product)) throw new Exception('Product not found.', 1); // add to cart $cartItem = CartItem::where('user_id', $user->id) ->where('product_id', $product->id)->first(); if (is_null($cartItem)) { CartItem::create([ 'product_id' => $product->id, 'quantity' => $quantity, 'user_id' => $user->id, ]); } else { $cartItem->quantity = $cartItem->quantity + $quantity; $cartItem->save(); } // response $this->alert('success', 'Product added successfully'); $this->emit("cart-update"); } catch (Exception $e) { $this->alert( 'error', $e->getCode() ? $e->getMessage() : "Error updating quantity." ); } } ``` #h3("Tính năng thanh toán") Website có 3 phÆ°Æ¡ng thức thanh toán chính: Thanh toán qua Zalopay, Paypal và thanh toán Cash On Delivery (COD). #img("22image.png", cap: "Giao diện chọn phÆ°Æ¡ng thức thanh toán trong website", width: 80%) ThÃŽng tin người dùng cần nhập khi thanh toán bao gồm: email người nhận, tên người nhận, số điện thoại người nhận và địa chỉ. Code kiểm tra thÃŽng tin người dùng nhập vào đơn hàng, nếu thÃŽng tin đúng format và chính xác thì sẜ tạo đơn hàng: ```php protected $rules = [ 'name' => 'required', 'email' => 'required|email', 'country' => 'required', 'city' => 'required', 'state' => 'required', 'street' => 'required', 'postalCode' => 'required|postal_code', 'phone' => 'required|vn_phone_number', 'paymentMethodId' => 'required', 'cart' => 'required|array|min:1', ]; // ... public function createOrder() { $this->validate(); try { $user = $this->getUser(); // custom validate if (is_null(PaymentMethod::where('id', $this->paymentMethodId) ->where('enable', true)->first())) throw new Exception('Payment method does not exist.', 1); $count = $user->cartItems() ->whereIn('id', array_map(fn ($item) => $item['id'], $this->cart))->count(); if ($count != count($this->cart)) throw new Exception('Cart items are wrong.', 1); $productIds = array_map(fn ($item) => $item['product_id'], $this->cart); $count = Product::whereIn('id', $productIds)->count(); if ($count != count($productIds)) throw new Exception('Cart items are wrong.', 1); foreach ($this->cart as &$item) if ($item['user_id'] != $user->id || $item['quantity'] < 1) throw new Exception('Cart items are wrong.', 1); DB::beginTransaction(); $addressId = Address::insertGetId([ 'country' => $this->country, 'city' => $this->city, 'state' => $this->state, 'street' => $this->street, 'zip_code' => $this->postalCode, ]); $orderId = Order::insertGetId([ 'user_id' => $user->id, 'address_id' => $addressId, 'name' => $this->name, 'email' => $this->email, 'phone' => $this->phone, 'total' => $this->total(), 'payment_method_id' => $this->paymentMethodId, 'status' => OrderStatus::UNPAID, ]); OrderItem::insert( array_map(function ($v) use ($orderId) { return [ 'order_id' => $orderId, 'product_id' => $v['product']['id'], 'quantity' => $v['quantity'], 'price' => $v['product']['price'], ]; }, $this->cart) ); $user->cartItems()->delete(); DB::commit(); return redirect()->route('order.pay', ['order' => $orderId]); } catch (Exception $e) { DB::rollBack(); return $this->handleException($e); } } ``` Code xá»­ lÃœ thanh toán: ```php public function pay(Request $request, Order $order) { $order->with('paymentMethod'); // cod if ($order->paymentMethod->code === 'cod') return redirect()->route('order.show', $order->id); // process payment $paymentGateway = null; switch ($order->paymentMethod->code) { case 'zalopay': $paymentGateway = new Zalopay(); break; case 'paypal': $paymentGateway = new Paypal(); break; } return $paymentGateway->pay($order); } ``` #h3("Tính năng quản lÃœ đơn hàng") Mỗi người dùng chỉ quản lÃœ đơn hàng của mình. Quản trị viên có thể xem tất cả đơn hàng. Code xá»­ lÃœ lấy dữ liệu đơn hàng của người dùng: ```php public function show(Order $order) { $order->with('paymentMethod', 'address', 'orderItems.product'); return view('orders.show', ['order' => $order]); } ``` // #h3("Đảm bảo an toàn và bảo mật cho website") // #h3("Triển khai website TMĐT") // #h2("Kiểm thá»­ và nâng cao chất lượng sản phẩm") // #h3("Kiểm thá»­ chức năng") // #h3("Kiểm thá»­ hiệu suất và tải trang") // #h3("Kiểm thá»­ bảo mật") // #h3("Nâng cao chất lượng sản phẩm") // #h2("Quản lÃœ và vận hành website") // #h3("Quản lÃœ nội dung website") // #h3("Quản lÃœ danh mục sản phẩm và kho hàng") // #h3("Quản lÃœ đơn hàng và thanh toán") // #h3("Quản lÃœ khách hàng và dịch vụ hỗ trợ") // #h2("Đảm bảo an toàn và bảo mật cho website") // #h3("Sá»­ dụng HTTPS để bảo mật kết nối") // #h3("Xác thá»±c người dùng và quản lÃœ phiên làm việc") // #h3("Kiểm tra dữ liệu đầu vào và đầu ra") // #h3("Áp dụng các giải pháp bảo mật nhÆ° CAPTCHA, ReCaptcha") // #h3("Theo dõi và giám sát hệ thống thường xuyên") #h2("Kết chÆ°Æ¡ng") Qua chÆ°Æ¡ng 3 tác giả đã trình bày các bước triển khai xây dá»±ng các tính năng chính trong một website TMĐT dá»±a vào các khảo sát phân tích và những thiết kế mÃŽ hình được thá»±c hiện ở ChÆ°Æ¡ng 1 và ChÆ°Æ¡ng 2. #h1("Kết luận chung", numbering: false) ThÆ°Æ¡ng mại điện tá»­ mở ra cÆ¡ hội kinh doanh trá»±c tuyến trên toàn cầu. Khách hàng có thể truy cập và mua hàng từ bất kỳ đâu và bất kỳ khi nào, giúp mở rộng phạm vi tiếp cận khách hàng và tăng doanh thu. Doanh nghiệp ngày nay cần cạnh tranh trên khÃŽng gian trá»±c tuyến để tồn tại và phát triển. Website thÆ°Æ¡ng mại điện tá»­ cho phép doanh nghiệp tiếp cận được khách hàng tiềm năng và cung cấp thÃŽng tin sản phẩm, dịch vụ, đánh giá, và khuyến mãi để thu hút và giữ chân khách hàng cÅ©ng nhÆ° mở rộng khả năng tiếp cận thị trường, giúp doanh nghiệp tăng doanh số bán hàng và khách hàng. Do đó việc xây dá»±ng website thÆ°Æ¡ng mại điện tá»­ là một cÃŽng việc có tính cấp thiết cao trong thời đại số hóa ngày nay. Đề tài này đã giúp tác giả nhận thức rõ hÆ¡n về tính cấp thiết đó và tạo động lá»±c để tiếp tục nghiên cứu và phát triển trong lÄ©nh vá»±c này. Qua quá trình thá»±c hiện đề tài nghiên cứu này, đồ án đã đạt được một số mục tiêu mong muốn. Tác giả đã tiến hành phân tích, khảo sát và xây dá»±ng và hoàn thiện phần lớn đề tài, bao gồm xác định các yêu cầu chức năng và yêu cầu an toàn, thá»±c hiện việc phân tích thiết kế các yêu cầu bằng các biểu đồ phân rã chức năng, biểu đồ use-case, mÃŽ hình quan hệ và lÆ°u trữ dữ liệu,... cho đến việc triển khai các chức năng quan trọng của website TMĐT nhÆ° tính năng đăng nhập/đăng kÃœ, giỏ hàng và thanh toán. Tạo nền tảng cho việc phát triển website TMĐT trong thá»±c tế. Tuy nhiên, do thời gian nghiên cứu, kiến thức và tìm hiểu còn hạn chế do đó đồ án còn một số thiếu sót. Tác giả nhận thức được rằng đề tài này đòi hỏi sá»± hiểu biết và kỹ năng rộng hÆ¡n để đạt được một hệ thống hoàn thiện. Trong tÆ°Æ¡ng lai, tác giả sẜ tiếp tục nghiên cứu, tìm hiểu và nâng cấp hệ thống để hoàn thiện và đáp ứng được yêu cầu sá»­ dụng trong thá»±c tế. Tác giả rất mong nhận được Ãœ kiến đóng góp quÃœ báu từ thầy cÃŽ để đồ án có thể phát triển và hoàn thiện hÆ¡n nữa. Để phát triển và nâng cao chất lượng hệ thống, tác giả sẜ tiếp tục nghiên cứu, tìm hiểu và áp dụng các cÃŽng nghệ mới, cÅ©ng nhÆ° thá»±c hiện các bước nâng cấp và tối Æ°u hóa hệ thống hiện tại.
https://github.com/dead-summer/math-notes
https://raw.githubusercontent.com/dead-summer/math-notes/main/notes/ScientificComputing/ch1-intro-to-scicomp/intro-to-scicomp.typ
typst
#import "/book.typ": book-page #show: book-page.with(title: "Introduction to Scientific Computing") Scientific computing uses computers to solve scientific problems. It is the third tool with which the human understands the world. The first two are physical experiments and theoretical analysis. The fourth one is artificial intelligence (AI).
https://github.com/saYmd-moe/note-for-statistical-mechanics
https://raw.githubusercontent.com/saYmd-moe/note-for-statistical-mechanics/main/contents/PartI/Chp03.typ
typst
#import "../../template.typ": * == 单元系的盞变 === 热劚平衡 ==== 热劚平衡刀据 + *熵刀据* $dif S = 1\/T dif U + p\/T dif V quad (U,V)$ 等胜等容䞋对于各种可胜的变劚来诎平衡态的熵䞺极倧。有数孊衚述$ cases( display(delta S = 0 quad #[平衡的必芁条件]), display(delta^2 S < 0 quad #[平衡皳定条件]), display(delta U =0\, delta V = 0\, delta N = 0 quad #[限制条件]) ) $ + *自由胜刀据* $dif F = -S dif T - p dif V quad (T,V)$ 等枩等容䞋系统蟟到平衡态时自由胜取极小倌$ cases( display(delta F = 0), display(delta^2 F > 0), display(delta T =0\, delta V = 0\, delta N = 0) ) $ + *吉垃斯凜数刀据* $dif G = - S dif T + V dif p quad(S,p)$ 等枩等压䞋系统蟟到平衡态时吉垃斯凜数取极小倌$ cases( display(delta G = 0), display(delta^2 G > 0), display(delta T =0\, delta p = 0\, delta N = 0) ) $ + *内胜刀据* $dif U = T dif S - p dif V (S,V)$ 等熵等容䞋系统蟟到平衡态时内胜取极小倌$ cases( display(delta U = 0), display(delta^2 U > 0), display(delta S =0\, delta V = 0\, delta N = 0) ) $ + *焓刀据* $dif H = T dif S + V dif p (S,p)$ 等熵等压䞋系统蟟到平衡态时焓取极小倌$ cases( display(delta H = 0), display(delta^2 H > 0), display(delta S =0\, delta p = 0\, delta N = 0) ) $ ==== 匀系粒子数可变系统 匀系是指*可以䞎倖界发生胜量和物莚亀换的系统*考虑只有䞀种粒子单元系有热力孊基本埮分方皋$ dif U = T dif S - p dif V + mu dif N $其䞭 $mu$ 䞺*化孊势*定义䞺 $1 op("mol")$ 的吉垃斯凜数$ mu = G/N = u - T s + p v $其䞭$ cases( display(U &= N u), display(S &= N s), display(V &= N v) ) $类䌌的可以写出其他热力孊基本方皋(其䞭有巚势 $Psi equiv U - T S - mu N$)$ cases( display(dif U &= T dif S - p dif V + mu dif N\, quad &(S,V,N)), display(dif H &= T dif S + V dif p + mu dif N\, quad &(S,p,N)), display(dif F &= -S dif T- p dif V + mu dif N\, quad &(T,V,N)), display(dif G &= -S dif T+ V dif p + mu dif N\, quad &(T,p,N)), display(dif Psi&=-S dif T- p dif V - N dif mu\, quad &(T,V,mu)) ) $ ==== 热劚平衡条件 热劚平衡分䞺四种 - *热平衡条件* 䞍发生热量亀换 $(T,S)$ - *力孊平衡条件* 䞍发生宏观䜍移 $(p,V)$ - *盞变平衡条件* 各盞之闎䞍发生物莚蜬移䞍发生盞变 $(mu,N)$ - *化孊平衡条件* 化孊反应䞍再进行 以吉垃斯凜数刀据䞺䟋考虑䞀䞪拥有 $A,B$ 䞀䞪子系统的系统对系统斜加䞀䞪埮扰根据吉垃斯凜数刀据的限制条件有$ delta T = delta T_A + delta T_B = 0 &arrow.double.long delta T_A = -delta T_B \ delta p = delta p_A + delta p_B = 0 &arrow.double.long delta p_A = -delta p_B \ delta N = delta N_A + delta N_B = 0 &arrow.double.long delta N_A = -delta N_B \ $再根据吉垃斯凜数刀据的必芁条件有$ delta G &= delta G_A + delta G_B \ &= (- S_A delta T_A + V_A delta p_A + mu_A delta N_A) + (- S_B delta T_B + V_B delta p_B + mu_B delta N_B)\ &= (S_A - S_B) delta T_B - (V_A - V_B) delta p_B - (mu_A - mu_B) delta N_B \ &= 0 $由于虚变劚 $delta T_B, delta p_B$ 可以独立变劚所以有平衡条件$ S_A = S_B, quad V_A = V_B, quad mu_A = mu_B $䞊述䞉䞪条件分别䞺热平衡、力平衡和盞平衡条件其他刀据掚富过皋同理。 及倖劂果是粒子数䞍守恒的系统则有$ delta G = (S_A - S_B) delta T_B - (V_A - V_B) delta p_B + mu_A delta N_A + mu_B delta N_B = 0 \ S_A = S_B, quad V_A = V_B, quad mu_A = mu_B = 0 $ #note[ #h(2em)系统的平衡由区床量 (䞎莚量无关的密床量即 $V\/N, S\/N$ 等) 决定䞎广延量无关。 ] ==== 热劚平衡皳定条件 以吉垃斯凜数䞺䟋$ Delta G &= delta G + 1/2 delta^2 G + dots.c \ &= [(diff/(diff T))_p delta T + (diff/(diff p))_T delta p] G \ &+ 1/2 [(diff/(diff T))_p delta T + (diff/(diff p))_T delta p]^2 G + dots.c $考虑有倚䞪子系统$ G = sum_s G_s $有吉垃斯刀据平衡皳定条件 $delta^2 G > 0$$ delta^2 G &= sum_s [(diff/(diff T_s))_p_s delta T_s + (diff/(diff p_s))_T_s delta p_s]^2 G_s \ &= sum_s [(diff^2/(diff T_s^2))_p_s delta T_s^2 + #text(rgb(150, 90, 170))[$2 (diff^2)/(diff T_s diff p_s) delta T_s delta p_s$] + (diff^2/(diff p_s^2))_T_s delta p_s^2] G_s \ &= sum_s [(- (diff S_s)/(diff T_s) delta T_s^2 #text(rgb(150, 90, 170))[$- (diff S_s)/(diff p_s) delta T_s delta p_s$]) + (#text(rgb(150, 90, 170))[$(diff V)/(diff T_s) delta T_s delta p_s$] + (diff V)/(diff p_s) delta p_s^2)] $这里我们有$ cases( display(delta S_s = (diff S_s)/(diff T_s)delta T_s + #text(rgb(0, 180, 255))[$(diff S_s)/(diff p_s)$]delta p_s = (diff S_s)/(diff T_s)delta T_s #text(rgb(0, 180, 255))[$- (diff V_s)/(diff T_s)$] delta p_s), display(delta V_s = #text(rgb(150, 90, 170))[$(diff V_s)/(diff T_s)$]delta T_s + (diff V_s)/(diff p_s)delta p_s = #text(rgb(150, 90, 170))[$-(diff S_s)/(diff p_s)$]delta T_s + (diff V_s)/(diff p_s)delta p_s) ) arrow.double.long cases( display((diff S_s)/(diff T_s)delta T_s = delta S_s + (diff V_s)/(diff T_s)delta p_s), display((diff V_s)/(diff p_s)delta p_s = delta V_s + (diff S_s)/(diff p_s)delta T_s) ) $代回䞊匏埗$ delta^2 G &= sum_s [- (#text(rgb(150, 90, 170))[$(diff S_s)/(diff T_s) delta T_s^2$] + (diff S_s)/(diff p_s) delta T_s delta p_s) + ( (diff V)/(diff T_s) delta T_s delta p_s + #text(rgb(0, 180, 255))[$(diff V)/(diff p_s) delta p_s^2$])]\ &= sum_s [-(#text(rgb(150, 90, 170))[$delta S_s delta T_s + (delta V_s)/(delta T_s) delta T_s delta p_s$] + (diff S_s)/(diff p_s) delta T_s delta p_s) \ &+ ((diff V)/(diff T_s) delta T_s delta p_s + #text(rgb(0, 180, 255))[$(diff S_s)/(diff p_s) delta T_s delta p_s + delta V_s delta p_s$])] \ &= sum_s (- delta T_s delta S_s + delta p_s delta V_s) $泚意到 $S_s = n_s s_s, V_s = n_s v_s$$ delta^2 G = sum_s n_s (-delta T_s delta s_s + delta p_s delta v_s) > 0 \ arrow.double.long - delta T delta s + delta p_s delta v_s > 0 $其他刀据同理。 === 单元倍盞系平衡 ==== _Le Chatelier_ 原理 #highlight[*圓倄于平衡态的系统受到倖界扰劚后系统䌚向抵消这䞀扰劚的方向蜬移。*]䞋列掚富过皋䜿甚熵刀据有基本埮分方皋$ dif S = 1/T dif U + 1/T p dif V - 1/T mu dif n\ dif U_A = - dif U_B, quad dif V_A = - dif V_B, quad dif n_A = - dif n_B $ + *热平衡被打砎 $T_A eq.not T_B$*假讟有 $dif V_A = 0, dif n_A = 0$ 则有$ dif S = (1/T_A - 1/T_B) dif U_A $由熵增原理 $dif S > 0$则$ T_A > T_B arrow.double.long dif U_A < 0 $*胜量从高枩物䜓蜬向䜎枩物䜓*。 + *力平衡被打砎 $p_A eq.not p_B$*假讟有 $T_A = T_B = T, dif N_A = 0$ 则有$ dif S = 1/T (p_A - p_B) dif V_A $同样由熵增原理 $dif S > 0$$ p_A > p_B arrow.double.long dif V_A > 0 $*压区高的郚分䜓积膚胀*。 + *盞平衡被打砎 $mu_A eq.not mu_B$*假讟有 $T_A = T_B = T, p_A = p_B = p$ 则有$ dif S = - 1/T (mu_A - mu_B) dif n_A $熵增原理 $dif S > 0$$ mu_A > mu_B arrow.double.long dif n_A < 0 $*化孊势高的盞向化孊势䜎的盞蜬变*。 ==== 单元倍盞系盞囟 假讟单元系有䞀䞪盞同时存圚并蟟到平衡则可以确定䞀条*盞变曲线*$ mu^alpha (T,p) = mu^beta (T,p) $劂果有䞉盞存圚并蟟到平衡则可以确定䞀䞪*䞉盞点*$ mu^alpha (T,p) = mu^beta (T,p) = mu^gamma (T,p) $ #grid( columns: 2, gutter: 5pt, box(width: 100%)[ 发生䞀级盞变时䜓积和熵䌚发生突变根据突变来定义盞变朜热$ L equiv T(s_beta - s_alpha) = h_beta - h_alpha $可以埗到描述盞变曲线斜率的_Clausius–Clapeyron_方皋$ (dif p)/(dif T) = (s_beta - s_alpha)/(v_beta - v_alpha) = L/(T(v_beta - v_alpha)) $_Clausius–Clapeyron_方皋只适甚于䞀级盞变䜓积、熵均发生突变。 ], figure( caption: [䞉盞囟], image("../../assets/figures/p-T-states-image.png") ) ) #h(2em)䞎凝聚盞固盞和液盞蟟到平衡的蒞汜称䞺*饱和蒞汜*。饱和蒞汜的压区和枩床之闎的关系被称䞺*蒞汜压方皋*$ (dif p)/(dif T) = L/(T (v-v')) $现圚做䞀点假讟 + 凝聚盞䜓积盞比于蒞汜盞可応略 $v' lt.double v$ + 蒞汜盞可看䜜理想气䜓 于是有$ dif p = (L)/(T v) dif T \ ln p = -L_0/(R T) + integral (dif T)/(R T^2) integral (c_p - c'_p) dif T + A \ ln p = A - B/T + C ln T $计算过皋是将盞变朜热 $L = L(T)$ 看䜜 $T$ 的凜数省略过皋及倖给出盞变朜热 $L$ 看䜜垞数时的蒞汜压方皋$ ln p = - L/(R T) + A $ ==== _Maxwell_ 等面积法则 #text(red)[\#TODO]范執瓊尔斯气䜓等枩线理论圚 $T lt.eq T_c$ 时出现偏差_Maxwell_通过_Maxwell_等面积法则进行了修正参考第䞉章䜜䞚 二、5. ==== 盞变的分类䞎_Ehrenfest_方皋 - *䞀级盞变圚盞变点䞀盞的化孊势盞等䜆化孊势的䞀级偏埮商存圚突变䟋劂䞀般物莚的气-液-固盞变倖磁场䞭的超富盞变等*$ Delta mu = 0, quad Delta s = (diff mu)/(diff T) eq.not 0, quad Delta v = (diff mu)/(diff p) eq.not 0 $ - *二级盞变圚盞变点䞀盞的化孊势和化孊势的䞀级偏埮商均盞等䜆化孊匏的二级偏埮商发生突变䟋劂没有倖磁场的超富盞变倧郚分磁盞变等*$ Delta mu = 0, quad Delta s eq 0, quad Delta v eq 0 \ Delta c_p = (diff^2 mu)/(diff T^2) eq.not 0, quad Delta alpha = (diff^2 mu)/(diff T diff p) eq.not 0, quad Delta kappa_T = (diff^2 mu)/(diff p^2) eq.not 0 $ - *普遍的$n$ 级盞变是指圚盞变点 $mu$ 到 $mu$ 的 $(n-1)$ 级偏埮商连续䜆 $n$ 级偏埮商发生突变。* - 习惯䞊把*二级以䞊的高级盞变*称䜜*连续盞变*或*䞎界盞变*。实际䞊发生这类盞变时因䞺没有朜热发生和䜓积的变化所以系统的宏观状态䞍发生任䜕突变而是连续变化的。因歀才称䞺连续盞变。 - 连续盞变的特埁是没有䞀盞共存也䞍存圚过冷和过热等亚皳态。系统发生歀类盞变时系统的对称性发生突变称之䞺*对称砎猺*。 #h(2em)对_Clausius–Clapeyron_方皋䜿甚掛必蟟法则埗到二级盞变䞭的_Ehrenfest_方皋$ (dif p)/(dif T) = (Delta s)/(Delta v) = (diff Delta s \/ diff T)/(diff Delta v \/ diff T) = (Delta c_p \/ T)/(v Delta alpha) = (Delta c_p)/(T v Delta alpha) = (Delta alpha)/(Delta kappa_T) $其䞭有关系匏$ (Delta alpha)/(Delta kappa_T) = (Delta c_p)/(T v Delta alpha) $
https://github.com/Ngan-Ngoc-Dang-Nguyen/thesis
https://raw.githubusercontent.com/Ngan-Ngoc-Dang-Nguyen/thesis/main/theorems.typ
typst
// Store theorem environment numbering #let thmcounters = state("thm", ( "counters": ("heading": ()), "latest": () ) ) #let thmenv(identifier, base, base_level, fmt) = { let global_numbering = numbering return ( body, name: none, numbering: "1.1", base: base, base_level: base_level ) => { let number = none if not numbering == none { locate(loc => { thmcounters.update(thmpair => { let counters = thmpair.at("counters") // Manually update heading counter counters.at("heading") = counter(heading).at(loc) if not identifier in counters.keys() { counters.insert(identifier, (0, )) } let tc = counters.at(identifier) if base != none { let bc = counters.at(base) // Pad or chop the base count if base_level != none { if bc.len() < base_level { bc = bc + (0,) * (base_level - bc.len()) } else if bc.len() > base_level{ bc = bc.slice(0, base_level) } } // Reset counter if the base counter has updated if tc.slice(0, -1) == bc { counters.at(identifier) = (..bc, tc.last() + 1) } else { counters.at(identifier) = (..bc, 1) } } else { // If we have no base counter, just count one level counters.at(identifier) = (tc.last() + 1,) let latest = counters.at(identifier) } let latest = counters.at(identifier) return ( "counters": counters, "latest": latest ) }) }) number = thmcounters.display(x => { return global_numbering(numbering, ..x.at("latest")) }) } fmt(name, number, body) } } #let thmref( label, fmt: auto, makelink: true, ..body ) = { if fmt == auto { fmt = (nums, body) => { if body.pos().len() > 0 { body = body.pos().join(" ") return [#body #numbering("1.1", ..nums)] } return numbering("1.1", ..nums) } } locate(loc => { let elements = query(label, loc) let locationreps = elements.map(x => repr(x.location().position())).join(", ") assert(elements.len() > 0, message: "label <" + str(label) + "> does not exist in the document: referenced at " + repr(loc.position())) assert(elements.len() == 1, message: "label <" + str(label) + "> occurs multiple times in the document: found at " + locationreps) let target = elements.first().location() let number = thmcounters.at(target).at("latest") if makelink { return link(target, fmt(number, body)) } return fmt(number, body) }) } #let thmbox( identifier, head, fill: none, stroke: none, inset: 1.2em, radius: 0.3em, breakable: false, padding: (top: 0.5em, bottom: 0.5em), namefmt: x => [(#x)], titlefmt: strong, bodyfmt: x => x, separator: [#h(0.1em):#h(0.2em)], base: "heading", base_level: none, ) = { let boxfmt(name, number, body) = { if not name == none { name = [ #namefmt(name)] } else { name = [] } let title = head if not number == none { title += " " + number } title = titlefmt(title) body = bodyfmt(body) pad( ..padding, block( fill: fill, stroke: stroke, inset: inset, width: 100%, radius: radius, breakable: breakable, [#title#name#separator#body] ) ) } return thmenv(identifier, base, base_level, boxfmt) } #let thmplain = thmbox.with( padding: (top: 0em, bottom: 0em), breakable: true, inset: (top: 0em, left: 1.2em, right: 1.2em), namefmt: name => emph([(#name)]), titlefmt: emph, )
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Differential.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Differential", authors: ( "<NAME>", ), date: "10 Août, 2024", ) #set heading(numbering: "1.1.") = Differential Equations <differential-equations> == Definition <definition> #link("SimpleOrdinaryDE.pdf")[Simple $dot(x) = lambda x$] == Links <links> - #link("https://tutorial.math.lamar.edu/Classes/DE/DE.aspx")[Paul’s Online Notes] - #link("https://www.youtube.com/playlist?list=PLMrJAkhIeNNTYaOnVI3QpH7jgULnAmvPA")[Steve Brunton’s Playlist] - #link("https://www.youtube.com/playlist?list=PLZHQObOWTQDNPOjrT6KVlfJuKtYTftqH6")[3Blue1Brown’s Playlist]
https://github.com/magic3007/cv-typst
https://raw.githubusercontent.com/magic3007/cv-typst/master/doc/bio.typ
typst
I am a third-year Ph.D. student in the Department of Computer Science at Peking University associated with the Center for Energy-Efficient Computing and Applications (CECA). I am a member of the #emph[PKU-IDEA Lab], advised by #emph[Prof. <NAME>]. Previously, I received the B.S. degree in Computer Science and Technology from Peking University in 2021. My focuses are machine learning-assisted EDA; my broader interests include MLSys, concurrency and probabilistic modeling. I have authored nine scientific publications in the leading international journals and conferences, such as TCAD, DAC, ASP-DAC, etc.
https://github.com/ivaquero/book-control
https://raw.githubusercontent.com/ivaquero/book-control/main/images/intro-closed.typ
typst
#import "@local/cetz-control:0.1.0": * // 闭环控制噚 #figure( diagram( spacing: (1.5em, 1.5em), node-stroke: 1pt, mark-scale: 80%, let (R, T) = ((1, 0.5), (4, 0.5)), let (O, H) = ((2, 2), (4, 2)), let A = (5.5, 1.25), rnode(R, $V(s)$), onode(O, ""), label((2, 2.65), ctext("误差衚")), rnode(T, ctext("控制噚")), rnode(H, ctext("䌠感噚")), rnode(A, ctext("讟倇")), arredge(R, O, "", 0, left, 0pt), arredge(O, T, ctext("蟓入"), .7, right, 0pt), arredge(T, A, ctext("蟓出"), .25, right, 0pt), arredge(A, H, "", 0, right, 0pt), arredge(H, O, "", 0, none, 0pt), ), caption: "闭环控制噚", supplement: "\n囟", )
https://github.com/tingerrr/hydra
https://raw.githubusercontent.com/tingerrr/hydra/main/doc/chapters/1-intro.typ
typst
MIT License
Hydra is a package which aims to query and display section elements, such as headings, legal paragraphs, documentation sections, and whatever else may semantically declare the start of a document's section. == Terminology & Semantics The following terms are frequently used in the remainider of this document. / primary: The element which is primarily looked for and meant to be displayed. / ancestor: An element which is the immediate or transitive ancestor to the primary element. A level 3 heading is ancestor to both level 2 (directly) and level 1 headings (transitively). / scope: The scope of a primary element refers to the section of a document which is between the closest ancestors. / active: The active element refers to whatever element is considered for display. While this is usually the previous primary element, it may sometimes be the next primary element. / leading page: A leading page in a book is that, which is further along the content of the two visible pages at any time, this is the `end` alignement with respect to the document readin direction. / trailing page: A trailing page is that, which is not the leading page in a book. The search for a primary element is always bounded to it's scope. For the following simplified document: ```typst = Chapter 1 == Section 1.1 = Chapter 2 === Subsection 2.0.1 #hydra(2) ``` ```txt Chapter 1 └ Section 1.1 Chapter 2 └ <none> └ Subsection 2.0.1 ``` hydra will only search within it's current chapter as it is looking for active sections. In this case hydra would not find a suitable candidate. For this the ancestors of an element must be known. For headings this is simple: #align(center, ( `<none>`, `level: 1`, `level: 2`, `level: 3`, `...`, ).join([ #sym.arrow ])) If hydra is used to query for level 2 headings it will only do so within the bounds of the closest level 1 headings. In principle, elements other than headings can be used (see @custom), as long as their semantic relationships are established.
https://github.com/tweaselORG/ReportHAR
https://raw.githubusercontent.com/tweaselORG/ReportHAR/main/templates/en/report.typ
typst
MIT License
#import "style.typ": tweaselStyle #show: tweaselStyle #text(weight: 700, 1.75em)[Technical report: Analysis of {{ analysis.app.platform }} app "{{ analysis.app.name }}" ({{ analysis.app.version }})] = Introduction This report details the findings and methodology of an automated analysis concerning tracking and similar data transmissions performed on the {{ analysis.app.platform }} app "{{ analysis.app.name }}"{% if analysis.app.url %}#footnote[{{ analysis.app.url | safe }}]{% endif %} (app ID: {{ analysis.app.id | code }}, hereinafter: "the app") through the Tweasel project, operated by Datenanfragen.de e.~V. = Findings During the analysis, the network traffic initiated by the app was recorded. In total, {{ harEntries.length }} requests were recorded between {{ harEntries[0].startTime | dateFormat }} and {{ harEntries[harEntries.length - 1].startTime | dateFormat }}. The recorded traffic is attached as a HAR file{% if analysis.harMd5 %} (MD5 checksum of the HAR file: {{ analysis.harMd5 | code }}){% endif %}, a standard format used by HTTP(S) monitoring tools to export collected data.#footnote[#link("http://www.softwareishard.com/blog/har-12-spec/")] HAR files can be viewed using Firefox or Chrome, for example.#footnote[https://docs.tweasel.org/background/har-tutorial/] The contents of the recorded traffic are also reproduced in @har2pdf[Appendix] == Network traffic without any interaction The requests described in this section happened *without any interaction* with the app or any potential consent dialogs. In total, there were {{ trackHarResult.length }} requests detected that transmitted data to {{ findings | length }} tracker(s) without any interaction. {% for adapterSlug, adapterResult in findings %} === {{ adapterResult.adapter.name }} The app sent the following {{ adapterResult.requests.length }} request(s) to the tracker "{{ adapterResult.adapter.name }}", operated by "{{ adapterResult.adapter.tracker.name }}". For details on how the requests to this tracker were decoded and the reasoning for how the transmitted information was determined, see the documentation in the Tweasel Tracker Wiki#footnote[The documentation for "{{ adapterResult.adapter.name }}" is available at: #link("https://trackers.tweasel.org/t/{{ adapterSlug | safe }}")]. {% for request in adapterResult.requests %} {% set harEntry = harEntries[request.harIndex] %} ==== {{ harEntry.request.method | code }} request to {{ harEntry.request.host | code }} ({{ harEntry.startTime | timeFormat }}) On {{ harEntry.startTime | dateFormat }}, the app sent a {{ harEntry.request.method | code }} request to {{ harEntry.request.host | code }}. This request is reproduced in @har2pdf-e{{ request.harIndex | safe }}[Appendix]. The following information was detected as being transmitted through this request: {% for transmission in request.transmissions -%} + {{ t("properties", transmission.property) }} (transmitted as {{ transmission.path | code }} with the value {{ transmission.value | code }}) {% endfor %} {% endfor %} {% endfor %} = Method The analysis was performed on {{ analysis.date | dateFormat }} on version {{ analysis.app.version }} of the app{% if analysis.app.store %}, downloaded from the {{ analysis.app.store }}{% endif %}. == Analysis environment The traffic was collected on the following {% if analysis.deviceType === 'emulator' %}emulator{% else %}device{% endif %}: #table( columns: (auto, auto), [*Operating system*], [{{ analysis.app.platform }} {{ analysis.platformVersion }}], {% if analysis.platformBuildString %}[*Build string*], [{{ analysis.platformBuildString }}],{% endif %} {% if analysis.deviceManufacturer %}[*Manufacturer*], [{{ analysis.deviceManufacturer }}],{% endif %} {% if analysis.deviceModel %}[*Model*], [{{ analysis.deviceModel }}],{% endif %} ) The analysis was performed using the following versions of the tools and libraries: #table( columns: (auto, auto), [*Tool*], [*Version*], {% for tool, version in analysis.dependencies -%} [{{ tool | code }}], [{{ version }}], {% endfor %} ) == Analysis steps To collect record and analyze the data, the Tweasel toolchain#footnote[An overview of the tools can be found here: #link("https://docs.tweasel.org")] was used. The `appstraction`#footnote[#link("https://github.com/tweaselORG/appstraction")] library was used to control the device and set up the environment the app is running in. It allows to change and read out app settings, and install, remove and start apps. {% if analysis.app.platform === 'Android' -%} It uses the Android Debug Bridge (`adb`)#footnote[#link("https://developer.android.com/tools/adb")] to control the device and read out information via the USB Debugging API built into Android. The device was rooted before the analysis was started and `adb` was used to open an elevated shell to manipulate system functions. Where Android does not provide an accessible API, `appstraction` uses the instrumentation toolkit Frida#footnote[#link("https://frida.re/")], which can hook into an app's functions while the process is running and access its execution context. `appstraction` contains scripts to hook into system functions, e.g. to set the content of the clipboard. {% elif analysis.app.platform === 'iOS' -%} To do so, it accesses iOS's `lockdownd` service via a USB connection and using the `pymobiledevice3`#footnote[#link("https://github.com/doronz88/pymobiledevice3/")] library. This is used i.a. to install apps and read out system information. The device was jailbroken and a SSH server was installed on the device to access more advanced functionality via a remote shell which also allows for root access to the device. Internal system and app APIs are used via the instrumentation toolkit Frida#footnote[#link("https://frida.re/")], which hooks into an app's functions while the process is running and accesses its execution context. {%- endif %} For the analysis, the app was started on the device and left running for 60 seconds. During this time, no input at all was provided to the device or app, meaning that no controls, buttons, inputs, etc. could have been clicked or otherwise interacted with. The app's traffic was recorded by the `cyanoacrylate`#footnote[#link("https://github.com/tweaselORG/cyanoacrylate")] library using the machine-in-the-middle (MITM) proxy `mitmproxy`#footnote[#link("https://mitmproxy.org/")]. {% if analysis.app.platform === 'Android' -%} On the device, the traffic was routed to `mitmproxy` using a WireGuard#footnote[#link("https://www.wireguard.com/")] VPN tunnel, which was configured to only tunnel the traffic of the app under test. To decrypt TLS-encrypted traffic, the certificate authority generated by `mitmproxy` was placed and trusted on the device. Certificate pinning was bypassed using the HTTP Toolkit certificate unpinning script for Frida#footnote[#link("https://httptoolkit.com/blog/frida-certificate-pinning/")]. {% elif analysis.app.platform === 'iOS' -%} On the device, traffic was routed to `mitmproxy` using the HTTP proxy built into iOS, set via the system settings. The proxy does not allow to discriminate traffic according to the originating app. To decrypt TLS-encrypted traffic, the certificate authority generated by `mitmproxy` was placed and trusted on the device. Certificate pinning was bypassed using SSL Kill Switch 2#footnote[#link("https://julioverne.github.io/description.html?id=com.julioverne.sslkillswitch2")]. {%- endif %} The transmitted tracking data was identified using TrackHAR#footnote[#link("https://github.com/tweaselORG/TrackHAR")], which in principle supports both a traditional indicator matching and an adapter-based matching approach. Indicator matching identifies transmitted data by checking the recorded traffic for known character sequences. For this analysis however, only the adapters were used, which are schemas of how to decode and interpret specific requests for each contacted endpoint. These adapters are the result of previous research and the reasoing for why a data type is assigned to a value is documented with the adapter and given in this report. Adapter-based matching can only find data transmissions which have gone to already known endpoints and cannot find unexpected transmissions. More technical details on the methods of the Tweasel toolchain and instructions on how to independently reproduce the results are available in the Tweasel documentation.#footnote(link("https://docs.tweasel.org/background/architechture")) // Appendix #pagebreak() #counter(heading).update(0) #set heading(numbering: (..nums) => "A" + nums.pos().map(str).join(".") + ".") #text(weight: 700, 1.75em)[Appendix] = Recorded traffic <har2pdf> Below is a reproduction of the recorded network requests that are mentioned in the report as documented in the attached HAR file. Only requests are shown, all responses are omitted. Binary request content is represented as a hexdump. Request content longer than 4,096 bytes is truncated. The full recorded traffic with all requests and including responses and full request content can be seen the in attached HAR file. #include "har.typ"
https://github.com/kiwiyou/algorithm-lecture
https://raw.githubusercontent.com/kiwiyou/algorithm-lecture/main/advanced/06-advanced-number-theory.typ
typst
#import "@preview/cetz:0.1.2" #import "@preview/algorithmic:0.1.0" #import "../slide.typ" #show: slide.style #show link: slide.link #show footnote.entry: slide.footnote #let algorithm(..args) = text( font: ("linux libertine", "Pretendard"), size: 17pt, )[#algorithmic.algorithm(..args)] #let func(body) = text(font: ("linux libertine", "Pretendard"))[#smallcaps[#body]] #align(horizon + center)[ = 알고늬슘 쀑꞉ 섞믞나 06: 고꞉ 정수론 #text(size: 0.8em)[ 연섞대학교 전우제#super[kiwiyou] \ 2023.01.22.r1 ] ] #slide.slide[분할 정복을 읎용한 거듭제곱][ - $a^b$륌 계산하Ʞ - $b = x_(1)2^0 + x_(2)2^1 + x_(3)2^2 + x_(4)2^3 + dots.c$ - $a^b = a^(x_(1)) times a^(2x_(2)) times a^(4x_(3)) times a^(8x_(4)) times dots.c$ - $cal(O)(log b)$번의 곱셈윌로 충분 - 덧셈에도 응용 가능 #pagebreak() - 비튞 연산을 읎용 #algorithm({ import algorithmic: * Function("Power", args: ($a$, $b$), { Assign[$r$][$1$] While(cond: $b > 0$, { If(cond: $b "bitand" 1 = 1$, { Assign[$r$][$r times a$] }) Assign[$a$][$a times a$] Assign[$b$][$"rshift"(b, 1)$] }) Return[$r$] }) }) #pagebreak() - 행렬곱을 읎용한 선형 점화식의 계산 $ a_(n+2) = 3a_(n+1) + 2a_(n) + 1 $ $ mat(3, 2, 1; 1, 0, 0; 0, 0, 1) mat(a_(n+1); a_(n); 1) = mat(a_(n+2); a_(n+1); 1) $ $ mat(3, 2, 1; 1, 0, 0; 0, 0, 1)^n mat(a_(2); a_(1); 1) = mat(a_(n+2); a_(n+1); 1) $ #pagebreak() - 행렬곱에 $cal(O)(k^3)$ 시간읎 걞늬므로 $cal(O)(k^3 log n)$ - 슈튞띌섌 알고늬슘: 행렬곱은 $cal(O)(k^2.8)$ 정도에 계산 가능 - 킀타마사법: $cal(O)(k log k log n)$ #pagebreak() - Functional Graph: 진출찚수가 1읞 귞래프 - ì–Žë–€ 정점 $v$에서 귞래프륌 따띌 $k$번 읎동한 위치륌 구하시였. - $cal(O)(N log k)$ ] #slide.slide[몚듈러 곱셈 역원][ - 연산 $circle.tiny$의 항등원 $e$: $a circle.tiny e = e circle.tiny a = a$ - $a$의 역원 $a^(-1)$: $a circle.tiny a^(-1) = a^(-1) circle.tiny a = e$ - $a$의 법 $N$에 대한 곱셈 역원 $a^(-1)$: $a times a^(-1) equiv 1 space (mod N)$ - $exists x in bb(Z): a times a^(-1) + N times x = 1$ #pagebreak() - 페륎마의 소정늬: $a^(p-1) equiv a space (mod p)$ - $a^(p-2) times a = a^(p-1) equiv 1 space (mod p)$ - $a^(-1) equiv a^(p-2) space (mod p)$ #pagebreak() - 확장 유큎늬드 혞제법 - $a x + b y = gcd(a, b)$륌 만족하는 두 정수 $x$, $y$ $ a times 1 + b times 0 = a space.en& a times 0 + b times 1 = b \ a times 0 + b times 1 = b space.en& a times 1 + b times (-q) = c && space dots.c space (a = b q + c) \ a times 1 + b times (-q) = c space.en& a times (-1) + b times (1 + q') = d && space dots.c space (b = c q' + d) \ dots.v \ a x + b y = gcd(a, b) space.en& a x' + b y' = 0 $ - 유큎늬드 혞제법곌 같은 $cal(O)(log max(a, b))$ ]
https://github.com/Wiper-R/resume
https://raw.githubusercontent.com/Wiper-R/resume/main/resume.typ
typst
#import "@preview/modern-cv:0.3.0": * #let format-role(role) = [#emph([#strong(role)])] #show: resume.with( author: ( firstname: "Shivang", lastname: "Rathore", email: "<EMAIL>", phone: "(+91) 9830794364", github: "Wiper-R", linkedin: "wiperr", address: "Lalitpur, India (284403)", positions: ( "Software Developer", "Web Developer", ), ), date: datetime.today().display(), language: "en", colored-headers: true, ) = About Me I am a passionate programmer with over 5 years of experience in Python and JavaScript development. Throughout my career, I have worked on numerous projects, a selection of which can be found on my #link("https://github.com/Wiper-R")[#text("GitHub profile", weight: "medium")]. Apart from software development, I also indulge in hobbyist game development. = Experience #resume-entry( title: "Pokemon Discord Bot", location: [#link("pokemonbot.com")], description: [#format-role[Creator, Lead Developer]], date: "2019-2022" ) #resume-item[ - Developed a Discord bot using Python serving #strong[400k users] and #strong[130k servers]. - Initially utilized #strong([PostgreSQL]) for data storage, later migrated to #strong([MongoDB]) due to evolving data structures. - Implemented #strong[clustering/sharding] for scalability. - Utilized #strong[Redis] for efficient #strong[caching/queuing]. - Maintained the codebase in adherence to industry standards (proprietary). ] #linebreak() = Projects #resume-entry( title: "Shortcut", location: [#github-link("Wiper-R/shortcut")], date: "2023", description: [#format-role[Designer, Developer]], ) #resume-item[ - Hosted live on #link("https://shortcut-theta.vercel.app/")["Vercel" #text("(click here)", size: 8pt, weight: "regular")]. - Implemented features such as: #list( [#strong("Custom Backhalf")], [#strong("QR Codes")], [#strong("Overview")], [#strong("Account Management") and #strong("Link Management")], ) - Ensured #strong("maintainability") through proper project structuring using #strong[git]. - Utilized #strong("MongoDB") for data storage. - Employed #strong("Zod") for input validation on both the #strong("Server") and #strong("Client") sides. ] #resume-entry( title: "My Voice Discord", location: [#github-link("Wiper-R/my-voice-discord")], date: "2021", description: [#format-role("Developer")], ) #resume-item[ - Developed a Discord bot for voice management. - Employed #strong("PostgreSQL") with proper #strong("Migration") tables. - Organized logic, files, and classes based on their respective functions and purposes. ] #linebreak() = Skills #let experience(text, rough: false) = [#if not rough [#strong(text)] else [#(text)]] #resume-skill-item( "Languages", (experience("Python"), experience("JavaScript"), experience("TypeScript"), experience("C#", rough: true), experience("Rust", rough: true) )) #resume-skill-item("Databases", (experience("PostgreSQL"), experience("MongoDB"), experience("MySQL", rough: true))) #resume-skill-item("Frontend", (experience("HTML"), experience("CSS"), experience("JavaScript"), experience("ReactJS"), experience("NextJS"), experience("TailwindCSS")) ) #resume-skill-item("DevOps", (experience("Git"), experience("Docker"), experience("AWS", rough: true))) #resume-skill-item("Backend", (experience("Node.js"), experience("Next.js"), experience("Express.js"), experience("Flask", rough: true), experience("Django", rough: true))) #resume-skill-item("Spoken Languages", (experience("English"), experience("Hindi"))) #linebreak() = Education #resume-entry( title: "LNCT University", location: "Bhopal, Madhya Pradesh", date: "July 2021 - July 2024", description: "Bachelor of Computer Applications (BCA)", )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cheda-seu-thesis/0.2.0/seu-thesis/pages/title-page-degree-en-fn.typ
typst
Apache License 2.0
#import "../utils/fonts.typ": 字䜓, 字号 #let title-en-conf( author: (CN: "王䞜南", EN: "<NAME>", ID: "012345"), thesisname: ( CN: "硕士孊䜍论文", EN: [ A Thesis submitted to \ Southeast University \ For the Academic Degree of Master of Touching Fish ], heading: "䞜南倧孊硕士孊䜍论文" ), title: ( CN: "摞鱌背景䞋的Typst暡板䜿甚研究", EN: "A Study of the Use of the Typst Template During Touching Fish" ), advisors: ( (CN: "湖牌桥", EN:"HU Pai-qiao", CNTitle: "教授", ENTitle: "Prof."), (CN: "苏锡浊", EN:"<NAME>", CNTitle: "副教授", ENTitle: "Associate Prof.") ), school: ( CN: "摞鱌孊院", EN: "School of Touchingfish" ), date: ( CN: ( defenddate: "2099幎01月02日", authorizedate: "2099幎01月03日", finishdate: "2024幎01月15日" ), EN: ( finishdate: "Jan 15, 2024" ) ), anonymous: false, ) = page(margin: (top: 3cm, bottom: 2cm, left:2cm, right: 2cm), numbering: none, header: none, footer: none, { set par(first-line-indent: 0pt) set align(center) block(text(font: 字䜓.宋䜓, size: 24pt, weight: "bold", upper(title.EN))) v(1cm) set text(font: 字䜓.宋䜓, size: 16pt, weight: "regular") set par(leading: 1.5em) set block(spacing: 1.8cm) block( height: 100% - 160pt, grid( rows: (auto, 1fr, auto, 1fr, auto, 1fr, auto), thesisname.EN, [], "BY" + "\n" + author.EN, [], "Supervised by" + "\n" + advisors.map(it => it.ENTitle + " " + it.EN).join("\n and \n"), [], school.EN + "\n" + "Southeast University" + "\n" + date.EN.finishdate ) ) }) #title-en-conf( author: (CN: "王䞜南", EN: "<NAME>", ID: "012345"), thesisname: ( CN: "硕士孊䜍论文", EN: [ A Thesis submitted to \ Southeast University \ For the Academic Degree of Master of Touching Fish ], heading: "䞜南倧孊硕士孊䜍论文" ), title: ( CN: "摞鱌背景䞋的Typst暡板䜿甚研究", EN: "A Study of the Use of the Typst Template During Touching Fish" ), advisors: ( (CN: "湖牌桥", EN:"HU Pai-qiao", CNTitle: "教授", ENTitle: "Prof."), (CN: "苏锡浊", EN:"SU Xi-pu", CNTitle: "副教授", ENTitle: "Associate Prof.") ), school: ( CN: "摞鱌孊院", EN: "School of Touchingfish" ), date: ( CN: ( defenddate: "2099幎01月02日", authorizedate: "2099幎01月03日", finishdate: "2024幎01月15日" ), EN: ( finishdate: "Jan 15, 2024" ) ), anonymous: false, )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-104B0.typ
typst
Apache License 2.0
#let data = ( ("OSAGE CAPITAL LETTER A", "Lu", 0), ("OSAGE CAPITAL LETTER AI", "Lu", 0), ("OSAGE CAPITAL LETTER AIN", "Lu", 0), ("OSAGE CAPITAL LETTER AH", "Lu", 0), ("OSAGE CAPITAL LETTER BRA", "Lu", 0), ("OSAGE CAPITAL LETTER CHA", "Lu", 0), ("OSAGE CAPITAL LETTER EHCHA", "Lu", 0), ("OSAGE CAPITAL LETTER E", "Lu", 0), ("OSAGE CAPITAL LETTER EIN", "Lu", 0), ("OSAGE CAPITAL LETTER HA", "Lu", 0), ("OSAGE CAPITAL LETTER HYA", "Lu", 0), ("OSAGE CAPITAL LETTER I", "Lu", 0), ("OSAGE CAPITAL LETTER KA", "Lu", 0), ("OSAGE CAPITAL LETTER EHKA", "Lu", 0), ("OSAGE CAPITAL LETTER KYA", "Lu", 0), ("OSAGE CAPITAL LETTER LA", "Lu", 0), ("OSAGE CAPITAL LETTER MA", "Lu", 0), ("OSAGE CAPITAL LETTER NA", "Lu", 0), ("OSAGE CAPITAL LETTER O", "Lu", 0), ("OSAGE CAPITAL LETTER OIN", "Lu", 0), ("OSAGE CAPITAL LETTER PA", "Lu", 0), ("OSAGE CAPITAL LETTER EHPA", "Lu", 0), ("OSAGE CAPITAL LETTER SA", "Lu", 0), ("OSAGE CAPITAL LETTER SHA", "Lu", 0), ("OSAGE CAPITAL LETTER TA", "Lu", 0), ("OSAGE CAPITAL LETTER EHTA", "Lu", 0), ("OSAGE CAPITAL LETTER TSA", "Lu", 0), ("OSAGE CAPITAL LETTER EHTSA", "Lu", 0), ("OSAGE CAPITAL LETTER TSHA", "Lu", 0), ("OSAGE CAPITAL LETTER DHA", "Lu", 0), ("OSAGE CAPITAL LETTER U", "Lu", 0), ("OSAGE CAPITAL LETTER WA", "Lu", 0), ("OSAGE CAPITAL LETTER KHA", "Lu", 0), ("OSAGE CAPITAL LETTER GHA", "Lu", 0), ("OSAGE CAPITAL LETTER ZA", "Lu", 0), ("OSAGE CAPITAL LETTER ZHA", "Lu", 0), (), (), (), (), ("OSAGE SMALL LETTER A", "Ll", 0), ("OSAGE SMALL LETTER AI", "Ll", 0), ("OSAGE SMALL LETTER AIN", "Ll", 0), ("OSAGE SMALL LETTER AH", "Ll", 0), ("OSAGE SMALL LETTER BRA", "Ll", 0), ("OSAGE SMALL LETTER CHA", "Ll", 0), ("OSAGE SMALL LETTER EHCHA", "Ll", 0), ("OSAGE SMALL LETTER E", "Ll", 0), ("OSAGE SMALL LETTER EIN", "Ll", 0), ("OSAGE SMALL LETTER HA", "Ll", 0), ("OSAGE SMALL LETTER HYA", "Ll", 0), ("OSAGE SMALL LETTER I", "Ll", 0), ("OSAGE SMALL LETTER KA", "Ll", 0), ("OSAGE SMALL LETTER EHKA", "Ll", 0), ("OSAGE SMALL LETTER KYA", "Ll", 0), ("OSAGE SMALL LETTER LA", "Ll", 0), ("OSAGE SMALL LETTER MA", "Ll", 0), ("OSAGE SMALL LETTER NA", "Ll", 0), ("OSAGE SMALL LETTER O", "Ll", 0), ("OSAGE SMALL LETTER OIN", "Ll", 0), ("OSAGE SMALL LETTER PA", "Ll", 0), ("OSAGE SMALL LETTER EHPA", "Ll", 0), ("OSAGE SMALL LETTER SA", "Ll", 0), ("OSAGE SMALL LETTER SHA", "Ll", 0), ("OSAGE SMALL LETTER TA", "Ll", 0), ("OSAGE SMALL LETTER EHTA", "Ll", 0), ("OSAGE SMALL LETTER TSA", "Ll", 0), ("OSAGE SMALL LETTER EHTSA", "Ll", 0), ("OSAGE SMALL LETTER TSHA", "Ll", 0), ("OSAGE SMALL LETTER DHA", "Ll", 0), ("OSAGE SMALL LETTER U", "Ll", 0), ("OSAGE SMALL LETTER WA", "Ll", 0), ("OSAGE SMALL LETTER KHA", "Ll", 0), ("OSAGE SMALL LETTER GHA", "Ll", 0), ("OSAGE SMALL LETTER ZA", "Ll", 0), ("OSAGE SMALL LETTER ZHA", "Ll", 0), )
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/docs/tinymist/inputs.typ
typst
Apache License 2.0
#import "mod.typ": * #show: book-page.with(title: "Tinymist LSP Inputs") == Prefer to Using LSP Configurations Though tinymist doesn't refuse to keep state in your disk, it actually doesn't have any data to write to disk yet. All customized behaviors (user settings) are passed to the server by LSP configurations. This is a good practice to keep the server state clean and simple. == Handling Compiler Input Events The compilation triggers many side effects, but the behavior of compiler actor is still easy to predicate. This is achieved by accepting all compile inputs by events. Let us take reading files from physical file system as example of processing compile inputs, as shown in @fig:overlay-vfs. The upper access models take precedence over the lower access models. The memory access model is updated _sequentially_ by `LspActor` receiving source change notifications, assigned with logical ticks $t_(L,n)$. The notify access model is also updated in same way by `NotifyActor`. When there is an absent access, the system access model initiates the request for the file system directly. The read contents from fs are assigned with logical access time $t_(M,n)$. #let pg-hori-sep = 1.5 #let pg-vert-sep = 0.7 #let pg-adjust = 18pt #figure( align( center, move( dx: pg-adjust, diagram( edge-stroke: 0.85pt, node-corner-radius: 3pt, edge-corner-radius: 4pt, mark-scale: 80%, node((pg-hori-sep, +pg-vert-sep), [SystemAccessModel], fill: colors.at(1)), node((pg-hori-sep, 0), align(center)[`NotifyAccessModel`], fill: colors.at(1)), node((pg-hori-sep, -pg-vert-sep), [MemoryAccessModel], fill: colors.at(1)), node((0, 0), align(center)[`NotifyActor`], fill: colors.at(0)), node((0, -pg-vert-sep), align(center)[`LspActor`], fill: colors.at(0)), edge((0, 0), (pg-hori-sep, 0), "-}>"), edge((0, -pg-vert-sep), (pg-hori-sep, -pg-vert-sep), "-}>"), edge( (-1, -pg-vert-sep), (0, -pg-vert-sep), "-}>", [didChange, \ didOpen, etc.], label-anchor: "center", label-pos: 0, ), edge( (-0.8, pg-vert-sep), (0, pg-vert-sep), (0, 0), "-}>", [readFile\ readDir, etc.], label-anchor: "center", label-pos: 0, ), edge((-1, pg-vert-sep), (pg-hori-sep, pg-vert-sep), "-}>"), edge((pg-hori-sep, 0), (pg-hori-sep, pg-vert-sep), "-}>"), edge((pg-hori-sep, -pg-vert-sep), (pg-hori-sep, 0), "-}>"), edge( (pg-hori-sep * 1.59, -pg-vert-sep * 1.6), (pg-hori-sep, -pg-vert-sep * 1.6), (pg-hori-sep, -pg-vert-sep), "-}>", [sourceOf(path)], label-pos: 0.2, ), for i in (-1, 0, 1) { edge( (pg-hori-sep * 1.2, i * pg-vert-sep), (pg-hori-sep * 1.7, i * pg-vert-sep), "-}>", [source], label-pos: 1, ) }, node( (-1.3, 0), rotate(-90deg, rect(stroke: (bottom: (thickness: 1pt, dash: "dashed")), width: 120pt)[Input Sources]), ), node( (pg-hori-sep + 1.45, 0), rotate( 90deg, move( dy: pg-adjust * 2, rect(stroke: (bottom: (thickness: 1pt, dash: "dashed")), width: 120pt)[Compiler World], ), ), ), ), ), ), caption: [The overlay virtual file system (VFS)], ) <fig:overlay-vfs> The problem is to ensure that the compiler can read the content correctly from access models at the time. If there is an only active input source in a _small time window_, we can know the problem is solved, as the logical ticks $t_(L,n)$ and $t_(M,n)$ keep increasing, enforced by actors. For example, if there is only `LspActor` active at the _small time window_, the memory access model receives the source changes in the order of $t_(L,n)$, i.e. the _sequential_ order of receiving notifications. The cases of two rest access models is more complicated, but are also ensured that compiler reads content in order of $t_(M,n)$. Otherwise, the two input sources are both active in a _small time window_ on a *same file*. However, this indicates that, the file is in already the memory access model at most time. Since the precedence, the compiler reads content in order of $t_(L,n)$ at the time. The only bad case can happen is that: When the two input sources are both active in a _small time window_ $delta$ on a *same file*: - first `LspActor` removes the file from the memory access model, then compiler doesn't read content from file system in time $delta$. - first `NotifyActor` inserts the file from the inotify thread, then the LSP client (editor) overlays an older content in time $delta$. This is handled by tinymist by some tricks. === Record and Replay Tinymist can record these input events with assigned the logic ticks. By replaying the events, tinymist can reproduce the server state for debugging. This technique is learnt from the well-known LSP, clangd, and the well known emulator, QEMU.
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/meta/link-06.typ
typst
Other
// Transformed link. #set page(height: 60pt) #let mylink = link("https://typst.org/")[LINK] My cool #box(move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink))))
https://github.com/thanhdxuan/dacn-report
https://raw.githubusercontent.com/thanhdxuan/dacn-report/master/datn-week-1/contents/05-refs.typ
typst
#bibliography("../ref.bib")
https://github.com/KireinaHoro/research-plan
https://raw.githubusercontent.com/KireinaHoro/research-plan/master/systems-cover/systems-cover.typ
typst
#let dmy-format = "[day] [month repr:long] [year]" /// Create a cover page at the *very* beginning of document. Has to be a show /// rule since we want to go before preambles generated by the body template. /// - doc-type (str): Type of document; must be one of `masterthesis`, /// `bachelorthesis`, `semesterproject`, `techreport`, /// or `doctoralplan`. /// - number (str, none): Number of the document you get from the admins. Not used when `doc-type` is `doctoralplan` or `semesterproject`. /// - title (str): Title of the document. /// - author (str): Name of the main author(s). /// - authorinfo (content, none):Extra information of the author. Only used when `doc-type` is `doctoralplan`. /// - collaborator (str, none): Name of the collaborator(s), if any. /// - collaborator-logo (content, none): Logo of the collaborator, if any /// - supervisor (str, none): Name of the supervisor(s), if any. /// - second-advisor (str, none): Name of the second advisor. Only used when `doc-type` is `doctoralplan`. /// - date (datetime): Date of the document. /// - doc (content): Body of the entire document. #let cover-page( doc-type: "masterthesis", number: "nr undefined", title: "title undefined", author: "author undefined", authorinfo: none, admission-date: datetime.today(), contract-date: datetime.today(), additional-info: none, collaborator: none, collaborator-logo: none, supervisor: none, second-advisor: none, date: datetime.today().display(dmy-format), doc, ) = { let type-to-display = ( masterthesis: [Master's Thesis], bachelorthesis: [Bachelor's Thesis], semesterproject: [Semester Project], techreport: [Technical Report], doctoralplan: [Doctoral Plan], ) assert(type-to-display.keys().contains(doc-type), message: "doc-type must be one of: " + str(type-to-display.keys().join(", "))) set page( paper: "a4", margin: (x: 1.7in/2, y: 2.5in/2), ) grid( columns: (auto, 1fr, auto), align: top, image("logos/eth.svg", height: 18mm), [], image("logos/systems.svg", height: 16mm), ) v(1fr) let is-doctoralplan = doc-type == "doctoralplan" let is-semesterproject = doc-type == "semesterproject" let type-font(body) = if (is-doctoralplan) { text(size: 12pt)[#body #parbreak()] } else { text(size: 16.84pt, weight: "bold")[#body #parbreak()] } let group-font(body) = if (is-doctoralplan) { text(size: 12pt)[#body #parbreak()] } else { text(size: 12.63pt)[#body #parbreak()] } let incollaboration-font(body) = if (is-doctoralplan) { text(size: 12pt)[#body #parbreak()] } else { text(size: 10.52pt)[#body #parbreak()] } let title-font(body) = if (is-doctoralplan) { text(size: 18pt)[#body #parbreak()] } else { text(size: 12.63pt)[#body #parbreak()] } let author-font(body) = if (is-doctoralplan) { text(size: 12pt)[#body #parbreak()] } else { text(size: 12.63pt)[#body #parbreak()] } let date-font(body) = if (is-doctoralplan) { text(size: 12pt)[#body #parbreak()] } else { text(size: 12.63pt)[#body #parbreak()] } align(center, { set text(font: "Arial") show par: set block(spacing: 0.3em) type-font({ type-to-display.at(doc-type) if (not is-doctoralplan and not is-semesterproject) [~Nr.~#number] }) v(5mm) group-font[Systems Group, Department of Computer Science, ETH Zurich] if (collaborator != none) { v(4mm) incollaboration-font[in collaboration with] v(3mm) group-font(collaborator) } v(16mm) title-font(title) v(20mm) author-font({ [by] v(3mm) author if (is-doctoralplan) { v(0.2em) authorinfo } if (is-doctoralplan) { v(8mm) [Supervisor: #supervisor] v(3mm) [Second Advisor: #second-advisor] } else if (supervisor != none) { v(8mm) [Supervised by] v(3mm) (supervisor) } }) v(15mm) date-font({ date if (is-doctoralplan) { set align(left) set text(style: "italic") v(30mm) [ #author is employed as a research assistant since #contract-date.display(dmy-format) and was accepted as a PhD student on #admission-date.display(dmy-format). #additional-info ] } }) }) v(1fr) grid( columns: (auto, 1fr, auto), align: top, image("logos/dinfk.svg", height: 6.5mm), [], collaborator-logo, ) doc }
https://github.com/maucejo/book_template
https://raw.githubusercontent.com/maucejo/book_template/main/template/front_matter/front_main.typ
typst
MIT License
#include "remerciements.typ" #include "resume.typ"
https://github.com/cyp0633/hnu-bachelor-thesis-typst-template
https://raw.githubusercontent.com/cyp0633/hnu-bachelor-thesis-typst-template/master/abstract.typ
typst
#let chinese_abstract(title,keywords,content)=[ // 狗屎目圕的 dirty fix #text(size:0em)[ #heading(level: 1)[摘 芁] ] #v(1em) #align(center)[ #text(font: "Source Han Sans",size:15pt)[#title] #v(1.3em) #text(font: "Source Han Sans",size: 16pt)[摘#h(2em)芁] ] #show par: set block(spacing: 1.7em) #content #par(first-line-indent: 0em)[ #text(font: "Source Han Sans",size: 14pt)[关键词] #text(font: "Source Han Sans",size: 12pt)[#keywords] ] ] #let english_abstract(title,keywords,content)=[ // 狗屎目圕的 dirty fix #text(size:0em)[ #heading(level: 1)[Abstract] ] #v(1em) #align(center)[ #text(font: "Times New Roman",size:15pt,weight: "bold")[#title] #v(1.3em) #text(font: "Times New Roman",size: 16pt,weight: "bold")[Abstract] ] #show par: set block(spacing: 1.7em) #content #par(first-line-indent: 0em)[ #text(font: "Times New Roman",size: 14pt,weight: "bold")[Key Words] #text(font: "Times New Roman",size: 12pt,weight: "bold")[#keywords] ] ]
https://github.com/vimkat/typst-ohm
https://raw.githubusercontent.com/vimkat/typst-ohm/main/src/templates/_presentation.typ
typst
MIT License
#import "@preview/polylux:0.3.1" as plx #import "../lib/vars.typ" #import "../lib/utils.typ" #import "../components/logo.typ": logo, logo-omega #import "../templates/document.typ": document as ohm-document #let margin = 32pt #let ohm-logo-content = state("ohm-logo-content", none) #let ohm-title = state("ohm-title", none) #let ohm-author = state("ohm-author", none) #let ohm-date = state("ohm-date", none) #let ohm-header = state("ohm-header", none) #let ohm-footer = state("ohm-footer", none) #let ohm-meta = state("ohm-meta", none) #let content-with-context(ctx, body) = { if type(body) == "function" { body(..ctx) } else { body } } #let ohm-theme( logo-content: none, title: none, author: none, date: datetime.today(), header: none, footer: none, progress-bar: false, body ) = { set document(title: title, author: author, date: date) set page( paper: "presentation-16-9", margin: margin, // Handled in slide-base b/c state makes this go boom header: none, footer: none, ) set text(size: 20pt) show heading: it => { set text(weight: "extrabold") set text(fill: vars.red) if it.level == 1 it } ohm-logo-content.update(logo-content) ohm-header.update(header) ohm-footer.update(footer) ohm-title.update(title) ohm-author.update(author) ohm-date.update(date) ohm-meta.update(( progress-bar: progress-bar, )) ohm-document(blue-as-black: true, body) } // Base header/footer #let header(fill: none) = { set text(size: 10pt, fill: fill) grid( rows: 1, columns: (auto, 1fr), align(left, logo(safety-zone: false, height: 16pt, text-only: true, fill: fill, none)), align(right, ohm-header.display()), ) } #let footer(fill: none) = { set text(size: 10pt, fill: fill) grid( rows: 1, columns: (1fr, auto), align(left, ohm-footer.display()), align(right, plx.logic.logical-slide.display()), ) ohm-meta.display(meta => if meta.progress-bar { plx.utils.polylux-progress(ratio => place( bottom, dx: -margin, dy: margin, rect( width: ratio * 100% + margin * 2, height: 2.5pt, stroke: none, fill: fill, ) ) ) } ) } // Base slide config (with header/footer support) #let base-slide( header: header, header-height: 32pt, footer: footer, footer-height: 16pt, background: none, body ) = { let _fill = if type(background) == "color" { utils.contrast-colors(background) } let _background = if type(background) == "color" { rect(fill: background, width: 100%, height: 100%) } else { background } let _header = content-with-context((fill: utils.default(_fill, vars.red)), header) let _footer = content-with-context((fill: utils.default(_fill, vars.red)), footer) let _body = content-with-context((fill: utils.default(_fill, vars.blue)), body) // Only override if actually needed (to make inheritance work properly) set text(fill: _fill) if _fill != none plx.polylux-slide({ if _background != none { place( dx: -margin, dy: -margin, block(width: 100% + margin * 2, height: 100% + margin * 2, _background) ) } grid( rows: (header-height, 1fr, footer-height), columns: (1fr), row-gutter: 1em, align(top, _header), _body, align(bottom, _footer), ) }) } #let background-omega = place(dx: 53%, scale(120%, logo-omega(outline: true))) #let title-slide( title, subtitle: none, background: background-omega, fill: none, ) = { let _fill = utils.default(fill, utils.contrast-colors(background)) // Cut out parts of the omega if it is used as the background let _content(body) = { if background == background-omega { highlight(fill: white, body) } else { body } } base-slide( header: (fill: none) => logo(safety-zone: false, fill: fill, height: 100%, ohm-logo-content.display()), header-height: 32pt, footer: none, background: background, { set align(horizon) set text(fill: _fill, weight: "black") set par(leading: 0.25em) v(3em) // from header-height stack( spacing: if subtitle != none { 1.5em } else { none }, block( width: 80%, text(size: 4em, _content(title)), ), if subtitle != none { block( width: 80%, text(size: 1.5em, _content(subtitle)), ) }, ) } ) } #let section-slide( title, subtitle: none, background: vars.red ) = { base-slide( background: background, { set align(center + horizon) set text(weight: "extrabold") plx.utils.register-section(title) block(text(size: 2.5em, title)) if subtitle != none { v(0.5em) block(text(size: 1.25em, weight: "bold", subtitle)) } } ) } #let agenda-slide( title: [Agenda], ) = { base-slide[ = #title #plx.utils.polylux-outline(enum-args: (tight: false)) ] } // Nothing fancy, just hiding some arguments :) #let slide(body) = base-slide(body) #let allowed-items = ["title", "author", "date", "section"] #let metadata-line(..items) = { items.pos().map(item => { if item == "title" { ohm-title.display() } if item == "author" { ohm-author.display() } if item == "date" { ohm-date.display(date => date.display("[day].[month].[year]")) } if item == "section" { plx.utils.current-section } }) .filter(item => item != none) .join(" | ") }
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/brainstorm-program-structure/entry.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Brainstorm: Program Structure", type: "brainstorm", date: datetime(year: 2023, month: 8, day: 12), author: "<NAME>", witness: "Violet Ridge", ) = Options #grid( columns: (1fr, 1fr), gutter: 20pt, [ == Option 1 This option uses an object oriented approach, and organizes each subsystem into a class. Each subsystem is represented by a state machine that behaves differently based on the current set state. Each subsystem will run on it's own task in order to be able to act on multiple actions asynchronously. Each class will follow a singleton #footnote("See glossary.") pattern, and will therefore not be constructed more than once. #pro-con(pros: [ - Scales very well - Allows multiple subsystems to act without blocking each other ], cons: [ - Overkill for a small codebase ]) ], image("./1.svg"), [ == Option 2 This option uses a procedural approach. It organizes each subsystem into a namespace, and creates functions that can be used to interact with the underlying devices. This approach is synchronous, meaning when one operation of a subsystem is called, execution will be blocked until the operation is finished. #pro-con(pros: [ - Scales pretty well - Doesn't require in depth understanding of object oriented concepts ], cons: [ - No asynchronous subsystems ]) ], image("./2.svg"), [ == Option 3 This option is by far the simplest, and would be the easiest to implement. This approach defines all devices globally, and does not distinguish between subsystems, only devices. This means that all devices can be used freely by any subsystem. This approach is also synchronous, and is generally not distributed across multiple files. This approach is used by most 53 teams, and is generally sufficient for a simple program. #pro-con(pros: [ - Very simple to implement ], cons: [ - Difficult to scale ]) ], image("./3.svg"), )
https://github.com/rickysixx/unimore-informatica
https://raw.githubusercontent.com/rickysixx/unimore-informatica/main/high-performance-computing/riassunto_hpc.typ
typst
#set par(leading: 0.55em, justify: true, linebreaks: "optimized") #set text(font: "New Computer Modern", lang: "en") #set heading(numbering: "1. ") #show raw: set text(font: "Courier New", size: 11pt) #show raw.where(block: false): box.with( fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt ) #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt, ) #show par: set block(spacing: 1em) #outline( indent: auto ) #let definition(body, title: "") = { table( columns: (1fr), align: (left + top), [*#title*: #body] ) } #pagebreak(weak: true) = Introduction *High-performance computing* is the practice of *aggregating computing power* to get very high performance to solve complex problems. Historically, HPC was only related to *supercomputers* and was used only in niche contexts (scientific calculations, etc.). #definition( title: [Embedded computing system (ES)] )[ An electronic device that is not a computer per se, but includes a programmable computer. ] Embedded systems typically use a *battery*. HPC helps obtain a good balance between performance and *energy efficiency*. Embedded systems evolved a lot over time (more transistors, smaller size, etc.). #figure( definition( title: [Bell's law] )[ Roughly every decade a new, lower priced computer class forms based on a new programming platform, network, and interface resulting in new usage and the establishment of a new industry. ], kind: "definition", supplement: "Definition", caption: [Bell's law summarizes embedded systems' evolution over time] ) With an hardware that is increasingly *parallel* and *heterogeneous* the challenge is on the application developer, who must learn how to extract the maximum performance from these systems. = The multicore revolution Architecture of modern high-performance computers is highly *heterogeneous*: there is no longer a single ISA#footnote[Instruction Set Architecture], but there are different sets of processors, each with its own ISA.\ #figure( image("assets/1cefacdb4c004eacbbbb63ed9a328011.png", height: 35%), caption: [Modern architectures are locally omogeneus, but globally heterogeneous] ) #definition( title: [#highlight(fill: yellow)[Moore's law]] )[ The number of transistors in an integrated circuit doubles every two years. ] Until 2004-2005, manufacturers have been increasing CPUs performance by simply increasing their *clock rate*. This changed after the *multicore revolution*: performance improvement is not about increasing the clock rate anymore, but it's about adding more *parallelism*. #figure( box(height: 20%, columns(2)[ #image("assets/e397931d72b52ee59879efbb7733cda1.png") #image("assets/a3c996bd016bf77a23acb12d1d851a34.png") ] ), caption: [Intel CPU clock rate roadmaps before and after the multicore revolution.] ) The reason behind this change in CPU design is the *power wall*. Clock rate cannot increase without limits because at some point the amount of *heat* to dissipate and the *energy consumption* would be too high to handle. #definition( title: [Circuit delay] )[ The time the current takes to traverse a circuit. ] CPU frequency is circuit delay's inverse: $ f = frac(1, "CD") $ Every technology generation (about 1.5 years), circuit delay is reduced by a 0.7x factor, which implies an increase of the frequency by a 1.4x factor. An increase of CPU frequency implies an increase of *dynamic*#footnote[The power consumed while transistors are working.] power consumed by a digital circuit: $ P_("DYN") = "capacity load" times "voltage"^2 times "frequency" $ Manufacturers have managed to keep dynamic power low by adding *power managers* to computer architecture. These devices reduce frequency when the CPU is idle. But circuits also have a *static* power component, which does not depend on the frequency: $ P_("S") = k_d times "voltage" times "current"_"leaked" $ The only way to low static power consumption is by turning off the circuit. #highlight(fill: yellow)[*Power density* is another big problem: having a lot of power in a *small area* generates heat]. == Instruction-level parallelism CPU pipeline allows to exploit parallelization on *single core* systems. At the end of each stage of the pipeline there is a *register*. This register helps reduce the length of the *critical path*: its length is limited to the single pipeline stage and it's not the entire pipeline. *Multiple issue* is another way to improve ILP: by replicating some pipeline stages (or adding other pipelines altogether) CPU is able to start multiple instructions in the same clock cycle. Multiple issue can be either *static* or *dynamic*: - static multiple issue is performed by the *compiler*, which schedules instructions appropriately; - dynamic multiple issue (or *out-of-order execution*) is performed by the hardware itself But also ILP cannot be increased without limits: - *dependencies* reduce its applicability in practice; - out-of-order CPUs require much more power, so this does not help in avoiding the power wall == Memory wall #figure( image("assets/d727b6042d481436f563c3095f08667e.png", width: 80%), caption: [The gap between CPU and memory performance has increased a lot over time] ) It's useless to invest lots of resources in improving CPU performance, because now the bottleneck is the memory. == Multicore Multicore is another strategy (along with ILP) manufacturers explored to increase CPU performance. Having multiple cores on the *same chip* has big advantages on CPU design, because each CPU can be simpler and slower (and thus less power demanding). #figure( image("assets/e0dcaa197cc2d53d0dfe6268dac2309f.png", height: 19%), caption: [Multicore performance and energy demand] ) #highlight(fill: yellow)[Performance improvement of multicore is only theoretical. The problem now is on the software, which must be written to exploit parallelism given by multiple cores.] == Dark silicon Power consumption is still a problem also after the multicore revolution. Cores cannot be all kept on at the maximum power. #definition( title: [Dark silicon] )[ A portion of hardware that cannot be used at full power, or cannot be used at all, to avoid increasing the power consumption of the circuit. ] Every modern hardware design has a lot of dark silicon. Dark silicon is the consequence of the *utilization wall*: the portion of a chip that can work at *full frequency* drops *exponentially* after each processor generation because of power constraints. "*Four horsemen*" is a way to call 4 different proposed solutions to handle dark silicon. None of these solutions is optimal, but each one has its benefit. Probably the optimal solution is a mixture of those. + *shrinking* horseman: instead of having dark silicon, manufacturer should simply make smaller processors. Not ideal because dark silicon does not mean *useless silicon*, it just means that it's under-clocked or not used all of the time; + *dim* horseman: can be a *spacial* dimming (more cores, but each one with a lower frequency) or a *temporal dimming* (each core has a higher frequency, but they are not used all together). Temporal dimming is widely used in battery-limited sistems (e.g. smartphones); + *specialized* horseman: dark silicon is used only to perform *specialized* tasks (e.g. video decoding/encoding, crypto stuff, etc.); + *deus ex machina* horsemen: move from the current CMOS technology to another one (e.g. nanotubes). None of these newer technology is sustainable across processor generations. = Parallel systems #figure( table( columns: (1fr, 1fr), align: (left + top, left + top), [#align(center)[*advantages*]], [#align(center)[*disadvantages*]], [ - effective use of all (or most of) transistors in a chip; - *scaling* (i.e. adding a core) is very easy; - each processor can be *less powerful*, which optimizes costs and power efficiency; - designing multi-processor systems is easier because once a processor has been tested it can simply be *replicated* ], [ - performance improvement is only *theoretical*. Not all problems can be efficiently parallelized; - more processors needs to be *synchronized*; - software developers should write code that uses these multiple processors ] ), caption: [Pro and cons of multicore] ) == Taxonomy of parallel computers #figure( image("assets/38726964c71c5a72cda5c1673e9d4579.png", height: 13%), caption: [Flynn taxonomy of parallel computers] ) #table( columns: (auto, 30%, 1fr), align: (center + horizon, center + horizon, left + horizon), [SISD\ (single instruction, single data)], [#image("assets/f23a92e4792507b79670ed1bfc55655b.png")], [A single instruction is executed on a single data stream. This is the architecture of single-core systems.\ These single-core systems can still use some forms of parallelization, e.g. through ILP], [MISD\ (multiple instruction, single data)], [#image("assets/c95cd9fa8ae5cb33350a37f49e1c5174.png")], [Multiple instruction streams that can be naturally parallelized are executed on a single data stream.\ This architecture is quite rare today, but it's widely used in AI computation.], [SIMD\ (single instruction, multiple data)], [#image("assets/31bbefd09c9e39f2877955c611e8a699.png")], [A single instruction is executed on multiple data streams.\ This architecture is widely used in GPUs.], [MIMD\ (multiple instruction, multiple data)], [#image("assets/c629ba530e4003e1cd1d30af7383ac23.png")], [Multiple instructions are executed on multiple data streams.\ Since different program counters are used, this architecture is able to execute *multiple programs* (or diffrent parts of the same program) at the same time.] ) SIMD and MIMD are the most widespread architectures today. The most common programming style is SPMD (single program, multiple data). This is not related to the architecture, but to the *execution model* (a single program is executed on all processors of a MIMD). #pagebreak(weak: true) === SIMD architectures In this architecture the hardware itself is able to execute the same instruction on a large dataset (e.g. scalar-vector sum or multiplication). This architecture exploits the fact that lot of work is done inside *loops* for a large data structure (vectors, matrixes): #figure( ```c for (int i = 0; i < N; i++) x[i] += s ```, caption: [Example of scalar-vector sum] ) In this context there is no need to stick to the Von Neumann instruction processing (fetch, decode, execute, etc.), because when the instruction has been decoded once, it can be executed *multiple times* independently without the need to fetch/decode it again. #figure( image("assets/24283267bb4e0b250e352ee5aee029c0.png", width: 80%), caption: [Schema of a SIMD architecture] ) To exploit data parallelism, CPU pipeline must be modified: - EXE stage must be replicated to execute the instruction multiple times; - a larger memory unit must be used to read/write *multiple* vector values at the same time #figure( image("assets/c9cbe98918ff56fe8c293255605a4834.png", width: 80%), caption: [SISD vs SIMD (pseudocode)] ) SIMD architecture needs *adjacent* values in memory. #pagebreak(weak: true) *Loop unrolling* can help revealing more data-level parallelism than available in a single loop iteration: #figure( image("assets/a26d7b154737409f287d570ff3cecec8.png", height: 25%), caption: [RISC-V ASM example of an unrolled loop. Every block of 4 similar instructions can be replaced by a single SIMD instruction.] ) Unrolling is done automatically by the compiler. Loops are unrolled by a factor equal to the width of the SIMD unit of the architecture. === MIMD architectures This architecture is more complex than SIMD, because here there are multiple *independent* pipelines, each one with its own *program counter*. #figure( image("assets/1a82cc6a7ef0f93e7793bc2d8e7cd46f.png", height: 11%), caption: [In MIMD each processing node is interconnected through a communication network] ) MIMD uses *thread-level parallelism*. Each thread can use data-level parallelism (e.g. SIMD) on its own. MIMD architecture allows two different patterns of execution: + multiple program, multiple data (MPMD): each thread executes a *different* program; + multiple threads, multiple data (MTMD): each thread executes a different part of the *same program* #figure( image("assets/5aaa95058d42882ce1800659cfde2409.png", height: 20%), caption: [Different types of parallelism in action (SIMD/SPMD and MPMD)] ) == Memory architecture in multiprocessor systems #figure( table( columns: (auto, 40%, 1fr), align: (center + horizon, center + horizon, left + horizon), [*shared*], [#image("assets/313af4486140a513fe0c5b752d0360d2.png")], [ - one *copy* of data shared among many cores; - synchronization must be handled explicitly; - communication between processors is implicit by modifying shared data; - scales poorly in terms of number of processors; - #highlight(fill: yellow)[main issue: *correctness*]; ], [*distributed*], [#image("assets/84feba4fa9a865e7d3d7727eb124cc7d.png")], [ - each core has its own, private, memory, inaccessible to other cores; - each core is interconnected; - communication is explicit through a *messaging system*; - synchronization is handled implicitly during message send/receive; - better scalability; - #highlight(fill: yellow)[main issue: *performance*] ] ), caption: [Primary patterns of multicore architecture design] ) === Shared memory In a shared memory address model: - each processor can address every physical location in the machine; - each process can address all data it shares with others; - #highlight(fill: yellow)[communication happens through load and stores]; - *memory hierarchy* applies, with multiple levels of cache #figure( table( columns: (auto, 1fr), align: (center + horizon, center + horizon), [physically shared\ (typical of on-chip multiprocessors)], [#image("assets/867b860c6bbc99eab0e46b05da6ddf5d.png")], [distributed shared memory\ (typical of large-scale computers)], [#image("assets/2dc4c356f1a3787f3a3adfcac4cbee15.png")] ), caption: [Different physical implementations for shared memory] ) #highlight(fill: yellow)[Physically shared memory is more performant], because plain load/stores can be used to access data. In distributed shared memory instead a message-passing protocol must be used. #definition( title: [NUMA architecture] )[ A type of multiprocessor architecture where access to memory is *non-uniform*. Different processors take different time to access the memory, because of the *physical distance* between the processor and its own memory. ] === Distributed memory #figure( image("assets/2b8ae1edbf91e5274c0a58e40ccf1ee1.png", height: 15%), caption: [Each processor has its own copy of `X`] ) Communication happens through *message exchange*. If P1 needs to access P2's value of `X`: + P1 sends a read request for `X` to P2; + P2 sends a copy of its `X` to P1; + P1 stores the received value in its own memory Data exchange requires *synchronization* between sender and receiver. Messages are processed through a *FIFO queue*: #figure( image("assets/e8fd36d292684918e126624ec04ddaf3.png", height: 10%), caption: [Message passing communication model] ) Message send/receive can either be blocking (synchronous) or asynchronous. #figure( image("assets/eefccdd1406dcadde57b171a0ce50baa.png", height: 24%), caption: [Physical implementation of message passing] ) #figure( image("assets/fa634e45c9fa6dd597af968f773668d6.png", width: 100%), caption: [Example of a program that uses distributed memory to calculate the distance between two given points on the plane. P1 holds `A` and `B`, while P2 holds `C`.] ) = Shared memory issues Main issues of shared memory: - *coherence*: each processor holds a different *copy* of the same data. It's crucial that all processors see the *most recent version* of the data; - *synchronization*: multiple processors accessing the memory must not mess up the computation. Memory *locks* should be handled; - *consistency*: the time it takes to propagate changes of the data to all memory locations (e.g. internal cache of each CPU) == Coherence Coherence deals with mantaining a *global order* in which writes to a *single location* are seen by all processors. Coherence is relevant anywhere there are multiple actors who may write the memory. This may also happen in single core systems because both the CPU and the I/O system may want to access the memory. #figure( table( columns: (50%, 38%), align: (center + horizon, center + horizon), stroke: none, [#image("assets/acc95a0917499d05f8da40bbff92f6f7.png")], [#image("assets/1b25a7cbfd24eb4e12c5eb518e5d6d15.png")] ), kind: image, caption: [Coherence in single and multiprocessor systems] ) Since writes to DRAM are expensive, single-core systems adopt a *write-back logic*: writes to DRAM are not performed until the very last moment, which is a *cache eviction*. In a multiprocessor system, the interconnection network intercepts a write request of a processor and broadcasts it to all other processors. Each processor can then proceed with cache invalidation to update their local copy of the data. The coherence system must be completely *transparent* to the user and to the programmer. Key ideas for cache coherence: - each processor stores a *copy* of the data it needs in its own cache; - if processors are only *reading* data, nothing happens; - if even a single processor is *writing* a value, all copies of that data must be invalidated === Snoopy protocol Each processor has a *snoopy cache* which listens for memory updates on the bus in order to keep the memory view of each processor coherent. #figure( image("assets/5e907d61ce2e59a253eb371667a18f76.png", height: 25%), caption: [Snoopy caches] ) This protocol does not scale well because it operates over a *single bus*. On a *write miss*, the address is invalidated in all other caches before the write is performed. On a *read miss*, if a *dirty copy* is found in some cache, a write-back is performed before the memory is read. === MSI protocol (Modified, Shared, Invalid) Each cache line has some *state bits*. Each one of them can be either: - *shared*: the processor read a value from the memory because of a read miss. If other processors read the same value, the state does not change; - *invalid*: some *other* processor has written the data; - *modified*: *this* processor has written the data #highlight(fill: yellow)[The processor with the cache line in state M is the owner of the most recent copy of the data]. This may also happen when the cache line is in state S, but the *dirty bit* is different (on when in state M, off when in state S). Only one processor in the system can have a cache line in state M for a specific data, because there could be only one owner of the most recent copy of the data. #figure( table( columns: (auto, auto, auto), [*action*], [*P1 cache line state*], [*P2 cache line state*], [P1 reads], [S], [-], [P1 writes], [M], [-], [P2 reads], [S (write-back)], [S], [P2 writes], [I], [M], [P1 reads], [S (read miss)], [S (write-back)], [P1 writes], [M], [I], [P2 writes], [I], [M] ), caption: [MSI protocol example] ) ==== MSI protocol performance I state is a very cheap way to mark the data as invalid. The alternative would be to read the value *immediately* from the memory, which is much more costly. MSI protocol treats every data item as *shared*. This is its major performance drawback, because when a processor write a value into the memory, all other processors must be notified and this generates a lot of bus traffic which may be useless if the data is actually *private* to that processor. === MESI protocol (Modified exclusive, Exclusive but unmodified, Shared, Invalid) This protocol adds to the MSI protol the state E: *exclusive but unmodified*. This state marks a *private* value that has not been modified (yet) by the processor. This protocol treats all data items as *private* by default. The state of a cache line keeps bouncing between states E and M until some other processor needs that data, which causes the line to jump to S state. #figure( table( columns: (auto, 1fr, 1fr), [*action*], [*P1 cache line state*], [*P2 cache line state*], [P1 reads], [E], [-], [P1 writes], [M], [-], [P1 reads/writes], [M], [-], [P2 reads], [S (write-back)], [S], [P2 writes], [I], [I], [P1 reads], [S], [S] ), caption: [MESI protocol example] ) ==== MESI protocol performance MESI performs better than MSI because it generates much less bus traffic. === Coherence misses Cache lines are organized in *blocks*. A single cache block can hold more than one word of data. Processors access a single word, but cache coherence works at block level. If $P_1$ writes $w_1$, $P_2$ writes $w_2$ and both $w_1$ and $w_2$ share the same block, $P_1$'s write will generate a *false sharing miss* on $P_2$. $P_2$ needs to evict the whole cache block even though it's working only with $w_2$. #figure( table( columns: (auto, auto, auto, auto), align: (center + horizon, center + horizon, center + horizon, left), [*time*], [*P1*], [*P2*], [*outcome*], [1], [write `x1`], [read `x2`], [false miss: P1's write to `x1` invalidates also `x2` for P2], [2], [write `x1`], [write `x2`], [false miss: the cache line is invalidated for both P1 and P2, even though P2 does not care about `x1` and P1 does not care about `x2`], [3], [read `x2`], [-], [true miss: the cache line is dirty because P2 has written `x2` previously] ), caption: [True vs false sharing misses (assuming `x1` and `x2` are in the same cache block)] ) #figure( table( columns: (1fr, 1fr), stroke: none, align: (center + horizon, center + horizon), [#image("assets/e4a60e0a923c7fd3bdbc718e0e9237d9.png")], [#image("assets/2475669d9800c9bc2412d8f742a72808.png")] ), kind: image, caption: [Cache misses over cache size and processor count increments] ) Bigger cache size reduces the impact of cache misses, but a bigger number of processors increases sharing misses. It's important to find a balance between these two factors. === Implementing cache coherence A cache coherent system must: - provide a set of *states*, with a transition diagram and a set of actions for each state; - manage the coherence protocol, which means: - determine *when* to invoke the protocol (e.g. distinguishing between shared and private data); - find the state of the address in other processors' caches; - locate other copies of the data; - communicate with each processor Different systems implement cache coherence differently, but all of them invoke the protocol only when an "access fault" occurs on the cache line. #pagebreak(weak: true) ==== Snoopy protocol Bus-based protocol that *broadcasts* a write request from a processor to *all* other processors in the system. #figure( image("assets/c91d316c0376c22eeb2ffe1949f89752.png", height: 20%), caption: [Architecture of a snoopy protocol] ) This protocol is very simple, but it does not scale well because of the high bus traffic it generates. NUMA systems help reducing the latency (especially when there is a lot of *locality* in the application), but still they are not so useful if the cache coherence protocol cannot scale. Scalability can be improved by applying different layes of interconnection between processors: #figure( image("assets/22fbb0f97c742d4d3f6303aef9d78dd7.png", height: 18%), caption: [Hierarchy of snooping] ) This hierarchy is simple to build, but it has disadvantages too: - the root becomes a bottleneck; - latency is higher, because processors are no longer directly interconnected; Another option to improve snoopy protocol performance is *decentralizing memory* (each group of processors has its own memory): #figure( image("assets/d8d76dd753e5964092fc43297319c0d4.png", width: 80%), caption: [Decentralized memory] ) #pagebreak(weak: true) === Directories This approach relies on *point-to-point* messages instead of broadcasts. Information about the cache block is stored in a *directory*: - every memory block has associated directory information, which keeps track of copies of cached blocks (and their states); - on a miss, the cache coherence protocol looks for the corresponding directory entry and communicates only with nodes that have copies of that data; Directory information can be organized in different ways. A very simple directory structure is based on *presence bits*: #figure( image("assets/e07b84dbe0156b0aa7e596bb04806745.png", height: 30%), caption: [Directory structure with presence bits] ) Each directory entry stores $n$ bits, one for each processor. The $i$-th bit is 1 if the $i$-th processor holds that memory block in its cache. The directory entry also stores the *dirty bit*, which is set to 1 if one processor has written into the memory block. Each processor has a separate directory: #figure( image("assets/fe067e16620ce5052600bcbb24230283.png", width: 80%), caption: [Directory for each node] ) - the *home node* of a memory block is the node whose memory is allocated for that data; - being the home node does not necessarily mean to be the owner of the most recent copy of the data, it just means that memory block is allocated on that node's memory; - the *requesting node* is the node who asks the home node for a memory block #pagebreak(weak: true) ==== Example 1: clean block read miss + P1 has a cache miss; + P1 asks P2 for that data, since P2 is the home node of that memory block; + P2 looks up the directory entry for that memory block, finds that the block is clean, and sends the data to P1; + P2 updates the directory entry by adding a presence bit for P1 #figure( image("assets/865eb46762d33d9480d8518df4628b09.png", height: 25%), caption: [Clean block read miss] ) ==== Example 2: dirty block read miss + P1 has a cache miss; + P1 asks P2 for that data, since P2 is the home node of that memory block; + P2 looks up the directory entry, finds that the block is dirty, and tells P1 to get the data from P3 instead, which is the owner of the most recent copy of the data; + P1 asks P3 for the data; + P3 sends the data to P1; + P2 updates the directory entry by removing the dirty bit and by adding a presence bit for P1 #figure( image("assets/e1401e1886d3575fff0d0a0a2b344047.png", height: 25%), caption: [Dirty block read miss] ) #pagebreak(weak: true) ==== Example 3: write miss + P1 has a write miss; + home node of that memory block is P2, so P1 asks P2 to update the value in its memory; + P2 looks up the directory entry, finds that P2 itself and P3 hold a copy of the data, and tells P1 to ask those nodes to invalidate their copies; + P1 asks P2 and P3 to invalidate their copies and waits for an acknowledge; + after receiving both invalidation acks, P1 can perform the write #figure( image("assets/8fa33b25e1f99c7aadbd86bb2257a008.png", height: 25%), caption: [Write miss] ) ==== Summary: advantages of directories On reads, directory tells the requesting node where to get the memory block from (either from the home node or from the owning node). In both cases it's #highlight(fill: yellow)[point-to-point communication, which is much more efficient than broadcast messaging]. On writes, the advantage of directories depends on the number of sharers#footnote[A sharer is a node which holds a copy of the data.]. In the worst case this falls back to broadcast messaging. === Cache access patterns In general there are two main cache access patterns: - mostly-read objects: the same data is shared among a large number of processors, but writes are infrequent, so their impact on performance is negligible; - migratory objects: the number of sharers is very low and it does not scale with the number of processors. Writes do not affect performance in this case too, because sharers count is low A few observations can be done based on these access patterns: - directories are very useful for limiting traffic; - since it's quite rare that *all* nodes are working on the same data, directory structure can be optimized to reduce storage overhead === Full bit vector approach Directory entries holds #highlight(fill: yellow)[one presence bit for each processor]. This approach has a storage overhead of $P times M$, where $P$ is the number of processors and $M$ is the number of memory blocks. This overhead can be diminished by lowering one of these factors: - $M$ can be reduced by increasing cache block size, but this will affect the performance impact of *sharing misses*; - $P$ can be reduced by *grouping* processors together. The presence bit would not be for a single processor but for a group of them. Within each group a (simpler) snoopy protocol can be used. ==== Limited pointer schemes (LPS) Optimization to the full bit vector approach to reduce factor $P$. This scheme exploit the fact that, in most cases, the number of sharers is very low (about 10): #figure( image("assets/447b1e7d1252779efcc8d71a0905d56a.png"), caption: [Number of sharers in a 64-core system] ) A full bit fector approach is therefore useless, because it would have a lot of 0s. A better solution is to use just 10 pointers to the nodes which are holding the block. Overflows can be managed in different strategies: - broadcasting; - processor grouping; - sharers invalidation: when there is no more room in the directory for a new sharer, the least recent sharer is removed and the newer takes its place; ==== Sparse directories Optimization to the full bit vector approach to reduce the factor $M$. This solutions aims to reduce the size of each directory entry by considering that the majority of the data does not resides in cache, but in the DRAM, and directories need only to care about data in cache. A single directory entry can hold a *linked list* of cache lines: #figure( image("assets/1c4f60715fc3261ff9df592fe442102f.png", height: 19%), caption: [Sparse directories] ) This solution increases the overhead of writes, since a full list traversal is required. Also evictions are more compliated because a node must be removed from the list. == Summary Cache coherence is mandatory to make parallel programming easier. Modern computers implement the snoopy protocol. This is also the reason why the number of cores is limited (4 to 12). Cache in GPUs instead is *manually managed* by the programmer. This allow to scale to a very high number of processors. Distributed machines have different needs. Broadcasting is practically impossible, so there is a directory-based approach. == Synchronization Synchronization is about *protecting access* to shared data in a context where there are multiple processors/threads that may access the same memory area concurrently. Each thread has a set of both *private variables*, which do not need synchronization, and *shared variables*. Threads communicate implicitly by writing and reading shared variables and coordinate by synchronizing on shared variable. #highlight(fill: yellow)[Synchronization is a must to avoid *race conditions*]. When writing shared memory programs it's important to reason about *atomicity*. Only reads and writes are atomic by default. When an operation is atomic, all computations happen in *private* registers. #highlight(fill: yellow)[Atomic operations are a fundamental building block for multi-threaded applications.] Synchronization is the process of using atomic operations to ensure cooperation between threads. Synchronization implements *mutual exclusion*: only one thread is performing a specific work at a given time, while other threads *wait* for their turn. A *critical section* is a portion of code that only a thread at a time can execute, thus access to critical sections must be synchronized between threads. Synchronization can be of different types: - mutual exclusion: a thread performs work, the others wait; - *event synchronization*: an event is raised when the execution of some threads reaches a given point: - *global* synchronization: all threads must wait for the others to finish before resuming their computations. This is also known as a *join point* and it's implemented using *barriers*; - *group* synchronization: join operation is restricted to a limited number of threads; - *point-to-point*: synchronization is only between 2 threads (or very few of them) A *lock* is a mechanism that prevents other threads from doing something. A lock is applied before entering in a critical section and it's released when leaving it.\ If other threads reach a portion of code with an applied lock, they wait for their turn. #highlight(fill: yellow)[Locks imply *waiting*], so it's very important to keep the *granularity* of critical sections small. *Correctness* is another aspect that should be checked througly when writing multithreaded programs. Synchronization requires *hardware support*. It's not possible to write multithreaded programs with only synchronized reads and writes: #figure( image("assets/edbfa63a2caa7caabdaeb791a98d42e5.png", height: 22%), caption: [Non-correct multithreaded program. The check `if (noNote)` must be atomic.] ) #figure( table( columns: (auto, 1fr), align: (center, left + horizon), [ ```c test&set(&address) { result = M[address]; M[address] = 1; return result; } ``` ], [checks if a memory address has value 0 and, if so, sets the value to 1. Does nothing if the value is already 1.], [ ```c swap(&address, register) { temp = M[address]; M[address] = register; register = temp; } ``` ], [swaps atomically the content of two memory addresses], [ ```c compare&swap(&address, reg1, reg2) { if (reg1 == M[address]) { M[address] = reg2; return success; } return failure; } ``` ], [performs the atomic swap only if the content of the memory address has a specific value] ), caption: [Hardware atomic instructions] ) === Implementing locks with `test&set` #figure( ```c int value = 0; Acquire() { while (test&set(value) == 1); } Release() { value = 0; } ```, caption: [Lock implementation using `test&set`] ) If the lock is free, `Acquire()` will set `value` to `1` and will get the lock, otherwise it will wait until `value` is 0. #figure( ``` milkLock.Acquire() if (nomilk) buy milk milklock.Release() ```, caption: [Usage of `Acquire` and `Release` primitives. The code between them is the critical section.] ) === Synchronization performance impact Different aspects to keep in mind: - *latency*: how long does it take to execute a critical section; - *bandwidth*: how long does it take when many other threads are waiting to execute; - *traffic* on the bus; - *storage* requirements; - *fairness*: all threads should be able to perform work Locking though `test&set` implies *cache invalidation*, because a value is written into memory. This also implies a lot of *cache coherence* traffic, which kills performance when the number of processors is high: #figure( image("assets/9342f49c1cfb3ab10acbe9fbdfbaa41b.png", width: 70%), caption: [`test&set` coherence traffic] ) Coherence traffic can be reduced a lot by using private variables and pointers. #figure( table( columns: (auto, auto), align: (center + horizon, center + horizon), stroke: none, [ ```c void lock(volatile int* l) { while (1) { while (*l != 0); if (testandset(*l) == 0) { return; } } } void unlock(volatile int* l) { *l = 0; } ``` ], [ #image("assets/3002629108f521fef8c590002ba2c02b.png") ] ), kind: image, caption: [Implementation and coherence traffic of `test&test&set` lock] ) `test&test&set` lock has a higher latency than plain `test&set`, but it generates much less coherence traffic and thus it has better performance. Neither `test&test&set` nor `test&set` provide any kind of *fairness*. `test&test&set` still keeps the bus pressure high because each thread is costantly checking if the lock has been released. Bus traffic can be reduced by implementing an *exponential backoff*: #figure( ```c void lock(volatile int* l) { int amount = 1; while (1) { if (testandset(*l) == 0) { return; } delay(amount); amount *= 2; } } ```, caption: [`test&test&set` with exponential backoff] ) If a resource is busy, it does not make sense to insist on getting the lock. If a resource is still busy after some time, it means that the lock owner is taking much longer than expected to finish its work, so other processors should wait more. Exponential backoff can cause severe unfairness, because processors that come to the critical section later wait much less thant the first ones. A *ticket lock* can be used to improve fairness: #figure( ```c struct lock { volatile int next_ticket; volatile int now_serving; }; void lock(lock* l) { int my_ticket = atomicIncrement(l->next_ticket); while (my_ticket != l->now_serving); // wait } void unlock(lock* l) { l->now_serving++; } ```, caption: [Ticket lock example (first-come first-served logic)] ) In this example each thread is using the same *shared* variable, so they must be synchronized. Typically an *array-based* lock is preferred: #figure( ```c struct lock { volatile int status[P]; // P = number of processors volatile int head; int my_element; void lock(lock* l) { my_element = atomicIncrement(l->head); while (l->status[my_element] == 1); } void unlock(lock* l) { l->status[next(my_element)] = 0; } } ```, caption: [Array-based lock] ) The polling loop checks only a specific flag inside the shared `status` array. This adds a memory overhead to the locking mechanism. == Shared memory issues: consistency Consistency ensures that the ordering of memory operations to *multiple locations* is maintained. Coherence is not enough, because it ensures ordering only for memory operations that involves the *single* location. In general programs use *many* variables to control their behaviour, therefore cache consistency is needed. *Instruction reordering*, which is very common in modern processors (e.g. out-of-order execution), must ensure memory consistency. #figure( table( columns: (auto, auto), align: (center + horizon, center + horizon), [*Single thread*], [*Multithread*], [ #table( columns: (auto, auto), stroke: none, align: (right, left), [*Ordering 1*], [*Ordering 2*], [ ```c A = 5; flag = 1 ``` ], [ ```c flag = 1; A = 5; ``` ] ) ], [ #table( columns: (auto, auto), stroke: none, align: (right, left), [*Thread 1*], [*Thread 2*], [ ```c A = 5; flag = 1; ``` ], [ ```c while (flag == 0); printf(A); ``` ] ) ] ) ) Instruction reordering in single thread programs is not a big deal if there are no dependencies between variables. In multithreaded programs, however, reordering must be done with care because it's common to implement *inter-processor* control schemes: instructions may appear to be independent when looked at single thread level, but when looked at multithreaded level they are not independent. === Memory operation ordering + $W -> R$: the write must complete before the read; + $R -> R$: the first read must complete before the second; + $R -> W$: the read must complete before the write; + $W -> W$: the first write must complete before the second === Sequential consistency A sequential consistent memory model preserves all those orderings when code is executed, but only for the *same thread*. It cannot guarantee order across multiple threads. #table( columns: (1fr, 1fr), align: (center + horizon, center + horizon), stroke: none, [*Thread 1*], [*Thread 2*], [ ```c B = 0; A = 1; if (B == 0) printf("Hello"); ``` ], [ ```c A = 0; B = 1; if (A == 0) printf("World"); ``` ] ) If this code is executed on a sequential consistent memory model, the output can either be nothing, `Hello` or `World`, but it can never be `Hello World`. Sequential consistency makes programs easier to understand for programmers: what they see in the code is also what the machine sees when executing the program. However sequential consistency is very expensive, because all memory accesses should be delayed until all invalidations complete. For this reason #highlight(fill: yellow)[sequential consistency has never been used in practice]. === Relaxed memory consistent Since sequential consistency is expensive, some orderings are *relaxed* if they are acting on different memory addresses. This allows to implement *memory latency hiding*: while a processor is writing `A`, the other can read `B` (as long as these variables do not depend on each other). Latency hiding on writes is implemented by adding a *write buffer* to the load/store unit. As long as the processor has put a "write request" in this buffer, it can forget about it (it will be carried on asynchronously) and it can proceed with its work. Writes in this buffer are applied sequentially, so the $W -> W$ ordering is preserved, but the $W -> R$ ordering is relaxed. In *total store ordering* (TSO) a processor can move its own reads before its own writes: P1 can read `B` before its write to `A` is seen by other processors, but other processors must wait to see the new value of `A` before reading `B`. In *processor consistency* (PC) instead this is not required: every processor can read `B` before the write to `A` is seen by all the others. Both TSO and PC only relax $W -> R$ ordering. Other orderings are still preserved. *Partial store ordering* (PSO) allows $W -> W$ reordering too: #figure( table( columns: (auto, auto), align: (right, left), stroke: none, [*Thread 1*], [*Thread 2*], [ ```c A = 5; flag = 1; ``` ], [ ```c while (flag == 0); printf(A); ``` ] ), kind: raw, caption: [With PSO, T2 may observe changes on `flag` before changes on `A`.] ) *Weak odering* and *release consistency* allow *all* orderings to be violated. Each processor must support special synchronization operations, called *memory fences*: #figure( image("assets/ea9de2f16ce54e8185d674796e020387.png", height: 17%), caption: [Reordering with memory fences] ) - memory accesses before the fence must complete before the fence issues; - memory accesses after the fence cannot begin until fence instruction is completed A fence may look like a barrier, but they are very different things: - a barrier synchronizes execution of multiple threads; - a fence only blocks memory operations A fence can be placed after a write to force other threads to wait until the result of that operation is propagated to all threads. PSO is so widespreaded, even though it further complicates programmer's life, because programmers already need to take care of synchronization anyhow, so they are able to handle memory ordering too. Fences are typically implicit upon unlocks and barriers. = Performance of parallel programming 3 factors affect performance of a parallel program: - *coverage*: the amount of parallelism in an algorithm; - *granularity*: how the work is partitioned between processors; - *locality*: how often a value is found in cache Programs are composed of sequential parts and parallel parts. The whole point is how big those parallel parts are. Theoretically, speedup due to parallelization should increase linearly with the number of processors. However, in practice this almost never happens due to the *Amdahl's law*. #definition( title: [#highlight(fill: yellow)[Amdahl's law]] )[ Performance improvement gained from using some faster mode of execution is limited by the fraction of time that execution model can be used. ] This means that if there are few parallel sections, or each parallel section is very small, the speedup obtained by parallelization is very limited. If $p$ is the fraction of work that can be parallized and $n$ is the number of processors, the speedup can be obtained by: $ "speedup" = frac("old execution time", "new execution time") = frac(1, (1 - p) + frac(p, n)) $ Linear speedup can be achieved only for $p = 1$, i.e. the *whole program* is parallelizable, which is quite rare in practice. However, as $p$ decreases, the obtained speedup drops dramatically too. Amdahl's law explains why performance improvement across multicore CPU generations stays around 22%, which is much less than the 52% of the single core era. Amdahl's law is also another reason why the number of CPU cores has remained low over time. #highlight(fill: yellow)[Performance of parallel applications are not bounded by Amdahl's law only, but also by the intrinsic overhead of parallelism]: - cost to start a thread; - communication cost between threads; - extra code required to make the program parallel Parallism is a *tradeoff*. An algorithm needs sufficiently large units of parallel work, but not so large that not all processors can work together. == Granularity Granularity is a measure of the ration between useful work and additional work implied by the parallelism. Granularity affects *load balancing*. #figure( table( columns: (auto, auto), align: (left, left), [*Fine-grain parallelism*], [*Coarse-grain parallelism*], [ - higher overhead, because there are more synchronization instruction; - better load balancing ], [ - overhead is better amortized - difficult to load balance efficiently (not all processors have the same amount of work) ] ), caption: [Fine grained vs coarse grained parallelism] ) #highlight(fill: yellow)[Load balancing is extremely important when using barriers, because the slowest processor dictates the overall execution time]. #figure( table( columns: (auto, auto), align: (left, left), [*Static load balancing*], [*Dynamic load balancing*], [ - the amout of work per processor is defined at *complie time*; - works well if all processors are homogeneus, which is not always the case (e.g. NUMA machines); - it's not always possible to distribute the work equally between all processors, e.g. due to *data dependencies* ], [ - there is *task queue* from which a processor takes a task when it's idle; - helps in reducing imbalances in work distributions; - it's the *processor itself* that asks the runtime system for work to do ] ), caption: [Static vs dynamic load balancing] ) == Communication and synchronization When executing an application in parallel, processors need to *communicate* partial results and to *synchronize*. Performance impact of communication depends on the available *bandwidth* and *latency*. Interconnection can either be implemented using a *shared bus* or a *network-on-chip*: - shared bus provides lower latency, but also lower bandwidth because processors can talk one at a time; - NoC provides lots of bandwidth, but has a higher latency. Latency is also not uniform because it depends on the number of hops in the network. #figure( image("assets/14cfa2da2b65852a3e6b9ec18bb1e927.png", width: 46%), caption: [Shared bus vs NoC] ) Communication between processors cannot be avoided when executing a parallel application. Latency hiding is the only way to reduce its cost. Latency hiding can be implemented in different ways: - overlapping message sending with computation; - data prefetch; - switching to other task when a processor is idle; - task *pipelining* Every instruction of a program can be modeled with 2 types: fetching data from the memory and executing work. These two types of instructions can be *pipelined* to keep both the CPU and the MEM unit working: #figure( image("assets/cc4bad3e822f9dfbffe352a2bd255aa3.png", width: 65%), caption: [CPU and MEM utilization with and without pipelining] ) == Locality In a shared memory multiprocessor, memory access can either be: - uniform (UMA): there is a single, centralized main memory. Memory latency is the same for all processors; - non-uniform (NUMA): memory is physically partitioned between different processors, but they all share the same address space. Memory latency is different for each processor *Partitioned global address space* (PGAS) means that every processor is able to address any portion of the memory, but it's not able to access it physically. This is the case of *distributed* shared memory. Even though processors are executing the same code, there could be *locality* problems because not all processors have the same latency in reaching the memory. Two key aspect to optimize the memory hierarchy: - reducing *memory latency*: - maximize the *memory bandwidth* Compiler back-ends help a lot in exploiting locality. Improving locality in programs deals with *reusing data*: - *temporal locality*: when reading a memory address, there is a high probability that the same address is read again after a short time; - *spatial locality*: when reading a memory address, there is a high probability that in a short time also addresses near that one will be read #figure( ```c for (int i = 0; i < N; i++) for (int j = 1; j < N - 1; j++) A[j] = A[j + 1] + A[j - 1] ```, caption: [This loop uses both temporal and spatial locality] ) Programs should do most of their work on *local* data, because local memories can be much smaller (and thus faster). When iterating over matrices, *loop permutation* can be benificial to improve data locality: #figure( table( columns: (auto, auto), align: (center + horizon, center + horizon), stroke: none, [*Column-major*], [*Row-major*], [ #image("assets/ebd232c30d7acdf3c39b417ca1464d3b.png", width: 80%) ], [ #image("assets/bec16051aec1b581f437775f55886c07.png", width: 80%) ] ), kind: image, caption: [Row-major traversal vs column-major traversal] ) === Tiling #highlight(fill: yellow)[Tiling (or blocking) is a way to reorder loop iterations when the data structure is too big to fit in a single cache line]. The iteration space is splitted in different blocks, where each one is small enough to fit in a cache line. This improves data locality also when the data structure is very big. #figure( image("assets/bcd8b0ff82079bf651cdc2cbe7f7c4a7.png", width: 55%), caption: [Tiling example] ) Tiling also allows to reduce the number of cache evictions because when a block of the data structure is read from the main memory, all of its content is used. #highlight(fill: yellow)[Tiling can help to achieve a *superlinear speedup* because it improves also the sequential part of the program]. #pagebreak(weak: true) === Memory banking Memory is often organized in several *independent banks*: #figure( image("assets/fbf8ec24042e3c179e37cabd292ca56c.png", width: 30%), caption: [Memory banking] ) Each bank has a single port to access it, so different threads should use different banks. This can be implemented by changing the parallelization scheme or the memory layout of the data. = Parallel programming in practice #figure( image("assets/fc2741a4bbef52b9ac8912c063de0bc6.png", height: 30%), caption: [4 steps of parallelization] ) == Decomposition In most cases, decomposition must be manually performed by the programmer. Automatic decomposition by the compiler continues to be a challenging research problem. Programs usually decompose naturally in *function calls* and *loop iterations*. Task decomposition must be: - *flexible*, both in the number of tasks and in the size of each task; - *efficient*: each task should have enough work to do to amortize the overhead of parallelization; - *simple*: the code has to remain readable and easy to debug If the program uses some data structure (array, matrix, tree, etc.), *data decomposition* is likely possible. This decomposition executes the same task on multiple elements of the data structure at the same time. Functions that deal with the same data structure can often be *pipelined*. #definition( title: [#highlight(fill: yellow)[Bernstein's condition]] )[ Given $R_i$ the set of memory locations read by task $T_i$ and $W_j$ the set of memory locations written by task $T_j$, $T_i$ and $T_j$ can run in parallel if and only if *all* of these are verified: $ R_i sect W_j = emptyset\ R_j sect W_i = emptyset\ W_i sect W_j = emptyset $ ] === Decomposition example: A2D-grid based solver In this algorithm, each row element depends on both the previous column and the previous row: #figure( image("assets/f3ddb6bf9b23364d31d2578c0d143b47.png", height: 23%), caption: [Dependencies in A2D-grid based solver] ) When looked in this way, it seems that no parallelism can be extracted from this algorithm. However a careful analysis can spot that parallelism does exist along matrix *diagonals*: #figure( image("assets/43cf130fe86476115c4ec3d39529bf6a.png", height: 23%), caption: [Parallelism along diagonals in the A2D-grid based solver] ) Task decomposition based on diagonal elements however is not optimal, because: - each task has a different amount of work (each diagonal has a different length); - code must be drastically changed to iterate through diagonals instead of rows/columns #pagebreak(weak: true) A better approach is to change the order in which grid cells are updated: #figure( image("assets/9fd5f94901beee01cb06930b01be40b5.png", height: 23%), caption: [Red-black coloring] ) Red-black coloring first updates #text(fill: rgb("#E32400"))[*red*] cells, then it moves on *black* cells. The result of these two algorithm (sequential and parallel) will not be the same, however in this context this is not an issue because Gauss-Seidel is itself an *iterative* algorithm which only provides an *approximation* of the result (not an exact result). #highlight(fill: yellow)[Decomposition requires the programmer to have a deep understanding of the problem]. == Assignment There are many more tasks than cores/threads, so it's important to achieve a good *balancing*. #figure( image("assets/2c2b3a4c4cff839bde469f4c9ec4086a.png", height: 16%), caption: [Example of poor balancing. P4 takes 2x longer to complete, which menas that 50% of program exeuction time is sequential] ) Although decomposition is often in charge to the programmer, assignment is typically performed automatically by the compiler or the runtime system. #figure( image("assets/186b6aaac5a75283a06a31cfade17f72.png", height: 21%), caption: [Two possible assignment strategies for the grid solver example. Which one is better depends on the system the program is run on.] ) Assignment can either be *static* or *dyamic*. Static assignment does not have any runtime overhead, but it's applicable only when all tasks have a similar execution time or at least the execution time of each task is *predictable*, because this allows to have a good balance *on average*. The simplest way to implement dynamic assignment is through a *centralized queue*: all tasks are pushed in this structure at the beginning of program's execution, then each threads pops one task from this queue when it's idle. Task *granularity* is very important in dynamic assignment. Small tasks help achieve a better balancing, but they also generate more overhead. Dynamic assignment should be smart: the runtime system should consider the state of other workers, expected execution time, dependencies, etc. when assigning a task to a worker (the runtime system should not choose the task to assign randomly). Access to the task queue should be *synchronized* between processors. When there are a lot of them it may be benificial to use *private* work queues (one for each processor) instead of a global one. When a private queue is empty, the processor can "steal" work from another one. == Orchestration Orchestration means adding code to manage communication and synchronization between workers. The goal is to reduce the overhead of parallelization. Orchestration depends on both the architecture and the cost of available synchronization/communication APIs (if they are cheaper, adding more of them it's not a big deal). Back to the grid solver example, initial orchestration can be done like this: #figure( image("assets/6971bdf7fb0d75e045722643ac2a6254.png", height: 18%), caption: [Grid solver initial orchestration idea] ) By looking at dependencies, it's clear that blocked assignment requires much less communication between workers, so this approach should be preferred: #figure( image("assets/3b223385e6f8be776c617b571e90dc9b.png", height: 22%), caption: [Blocked vs interleaved assignment communication] ) Orchestration is implemented differently based on the memory architecture of the system. === Shared address space Here synchronization is programmer's responsibility, who should place barriers and locks properly. Programmer can use the `getThreadId()` primitive to differentiate work between threads. #figure( ```c void solve(float* A) { int threadId = getThreadId(); int myMin = 1 + (threadId * n / NUM_PROCESSORS); int myMax = myMin + (n / NUM_PROCESSORS); while (!done) { diff = 0.f; barrier(myBarrier, NUM_PROCESSORS); for (int j = myMin; j < myMax; j++) { foreach (red cell i in this row) { float prev = A[i, j]; A[i,j] = 0.2f * (A[i-1,j] + A[i,j-1] + A[i,j] + A[i+1,j], A[i,j+1]); lock(myLock); diff += abs(A[i,j] - prev); unlock(myLock); } } barrier(myBarrier, NUM_PROCESSORS); if (diff / (n*n) < TOLERANCE) done = true; barrier(myBarrier, NUM_PROCESSORS); } } ```, caption: [Pseudo-code example for grid solver] ) This code can be improved in different ways: + the critical section can be moved *outside* the `for` loop by accumulating on a *private* variable (instead of having all threads accumulating on the same shared variable); + one barrier can be removed by having *multiple copies* (stored in an array) of the `diff` variable to reduce dependencies between iterations. This trade off (more memory footprint to reduce parallelization overhead) is very common in parallel programming. === Distributed memory system (message passing) The grid can be divided evenly between multiple threads. Each thread may have some *ghost cells*, which are cells that have been replicated from other threads and therefore are ownership of that thread. #figure( image("assets/5c1618ceb3bf68ae53074f54d38df254.png", height: 35%), caption: [Ghost cells] ) Every thread must communicate to the next one if there are more iterations to do. == Mapping to hardware Mapping logical workers to hardware execution unit can be done by: - the operating system; - the compiler (e.g. by using OpenMP); - the hardware (e.g. what CUDA does) Placing related threads on the same processor may help in maximizing *locality* and reducing the overhead of communication. But also placing unrelated threads on the same processor may be beneficial in order to use the hardware more efficiently. = OpenMP programming OpenMP is the standard programming model for *shared memory* systems. It consists in a collection of compiler directives, library APIs and environment variables. OpenMP requires special support by the compiler. Both `gcc` and `clang` nowdays fully support it. In the beginning, OpenMP focused only on *loops*, especially *DOALL* loops (loops without dependencies across iterations). OpenMP primarly targeted *expert* programmers who did not want to write low level code to handle parallelization. Over time, OpenMP has broadened its focus also to things other than loops (e.g. tasks, accelerators/heterogeneous systems) and has spent lot of efforts in making parallel programming easier for everyone, also for non-expert programmers. #pagebreak(weak: true) OpenMP adheres to the *fork/join model*: #figure( image("assets/06e5225e21ac53e3667a8e9edc6b1761.png", width: 80%), caption: [Fork-join model. The program is started by the *master thread*, which spawns new threads (*fork point*). At the end of parallel computation there is an implicit barrier (*join point*) where execution resumes on the master thread only.] ) OpenMP provides a set of `#pragma` *directives* to deal with: - definition of *parallel regions*; - *work sharing* (how work is distributed between threads); - *synchronization* Each directive may have zero or more *clauses* to better specify how the directive should work. OpenMP provides also a set of runtime APIs (e.g. to get the current thread identifier). == `parallel` directive OpenMP fundamental construct to outline parallel computation within a sequential program. When this directive is encountered, OpenMP creates a *parallel region*. This directive by itself does not create parallelism however, because work is simply *replicated* on all threads. Worksharing directives must be used to have different threads execute different things. #figure( ```c #pragma omp parallel { printf("Hello world!"); } // this is an implicit barrier ```, caption: [OpenMP `parallel` directive] ) When OpenMP encounters a parallel region, by default it creates one thread for each CPU core. This can be changed using the `num_threads(n)` clause. === Memory view inside parallel region In an OpenMP parallel region a variable can either be *private* to the current thread or *shared* between all threads. OpenMP provides a set of *data sharing clauses* to specify how each variable should be considered. If no data sharing clauses are used: - variables defined *inside* the parallel region are treated as *private* variables; - variables defined *outside* the parallel region are treated as *shared* variables: #figure( ```c int a = 5; // shared #pragma omp parallel { int thread_id = omp_get_thread_num(); // private printf("Thread ID: %d\n", thread_id); } ``` ) OpenMP provides also 2 additional data sharing clauses: - `firstprivate`: variable is private, but it's initialized using a shared value (*copy-in* semantics); - `lastprivate`: variable is private, but when it's written the change is propagated to all other threads when the parallel region ends (*copy-out* semantics) In both cases storage is *private*, so cache coherence is not a problem. == `for` directive OpenMP `for` directive is a worksharing directive that parallelizes a `for` loop. #figure( ```c #pragma omp parallel for for (int i = 0; i < N; i++) { c[i] = a[i] + b[i]; } // implicit barrier ```, caption: [OpenMP `for` directive. An implicit barrier is added after the `for`.] ) The `nowait` clause may be used to avoid adding the implicit barrier: #figure( ```c #pragma omp parallel for nowait for (...) { ... } ```, caption: [OpenMP `nowait` clause] ) === `schedule` clause OpenMP default loop scheduling is *static*: loop's iteration space is divided evenly between all threads. Programmer can change loop scheduling to *dynamic* by using the `schedule` directive. Loop scheduling may specify a *chunk factor*, which determines the *unit of work* (i.e. how many iterations are executed together by a single thread). #figure( table( columns: (auto, auto), align: (center + horizon, center + horizon), [*Static scheduling*], [$ ceil(frac(N, N_("threads"))) $], [*Dynamic scheduling*], [$ 1 $] ), caption: [Default chunk factor for static and dynamic scheduling] ) Chunk factor determines parallelization *granularity*. #figure( table( columns: (auto, auto, auto), align: (left, left, left), [#align(center)[*chunk size*]], [#align(center)[*T1 iteration space*]], [#align(center)[*T2 iteration space*]], [default: $c = frac(22, 2) = 11$], [#align(center)[from `i = 0` to `i = 10`]], [#align(center)[from `i = 11` to `i = 21`]], [#align(center + horizon)[5]], [ - from `i = 0` to `i = 4`; - from `i = 10` to `i = 14`; - from `i = 20` to `i = 21` ], [ - from `i = 5` to `i = 9`; - from `i = 15` to `i = 19` ] ), caption: [Example of static scheduling with a different chunk factor (2 threads and 22 iterations). With a chunk factor of 5, work is slightly unbalanced (T1 executes 12 iterations, while T2 only 10).] ) #highlight(fill: yellow)[With static scheduling you know in advance exactly which thread will execute a particular iteration. This is not possible instead with dynamic scheduling, because iterations are assigned to threads as they finish their work.] == `barrier` directive Can be used to place an barrier *explicitly*. == `critical` directive Marks a *critical section* i.e. a portion of code that only *one thread at a time* can execute. #figure( ```c double area = 0; int n; #pragma omp parallel for shared(area) { for (int i = 0; i < n; i++) { double x = (i + 0.5) / n; #pragma omp critical area += 4.0 / (1.0 + x * x); } } double pi = area / n; ```, caption: [OpenMP `critical` directive example] ) == `reduction` clause Implements a *reduction*, a programming pattern in which a partial result is *accumulated* into a variable. `reduction` clause can be used to avoid the `critical` directive, and therefore to achieve better performance because the code is no longer sequential. Inside the parallel region, accumulation is done on *private* variables automatically created by OpenMP. When the parallel computation ends, each one of these private variables is summed together and the result is written to the shared variable. #figure( ```c double area = 0; int n; #pragma omp parallel for shared(area) reduction(+:area) { for (int i = 0; i < n; i++) { double x = (i + 0.5) / n; #pragma omp critical area += 4.0 / (1.0 + x * x); } } double pi = area / n; ```, caption: [OpenMP `reduction` clause example] ) == `master` directive Denotes a portion of code that can be only executed by the *master* thread. No synchronization is implied, because all other threads simply skip this code. == `single` directive Denotes a portion of code that can be executed only by one thread, which may not be the master thread. `single` is different from `critical` because the first will execute the work *only once*, while the latter will execute the work many times as the number of threads. A barrier is implicitly added at the end of a portion of code marked with this directive. == `sections` directive This directive was OpenMP first attempt to exploit *task parallelism*. Each `section` directive detones a task which can be executed in parallel with others: #figure( ```c #pragma omp parallel sections { #pragma omp section v = alpha(); #pragma omp section w = beta(); #pragma omp section y = delta(); } x = gamma(v, w); z = epsilon(x, y); ```, caption: [OpenMP `sections` example] ) == Tasking model `sections` directive allows to exploit task parallelism, but each task must be *statically* outlined in the code. This is not always feasible, for example when the body of a loop (or of a recursive function) is marked as a task: #figure( ```c for (Node* n = l->first; n != NULL; n = n->next) { process(n); } ```, caption: [`sections` directive cannot be used here because loop *trip count* is not known in advance] ) This code can still exploit task parallelism by combining `parallel` and `single` directives: #figure( ```c #pragma omp parallel { for (Node* n = l->first; n != NULL; n = n->next) { #pragma omp single nowait process(n); } } ```, caption: [Task parallelism using `single` directive] ) But this too is not feasible, because the code is counter-intuitive and has performance issues. #figure( ```c void visit_tree_node(Node* n) { #pragma omp parallel sections { #pragma omp section if (n->left != NULL) visit_tree_node(n->left); #pragma omp section if (n->right != NULL) visit_tree_node(n->right) } process(n); } ```, caption: [Tree traversal is another example of code hard to parallelize using `sections`] ) The problem in tree traversal is that tasks are created *recursively*. Recursive task creation may not be supported by all compilers and, besides that, creating too many tasks generates a severe overhead. For these reasons, OpenMP introduced its *tasking model* in its specification 3.0. Task parallelism in OpenMP allows to parallelize irregular problems, like unbounded loops and recursive algorithms. OpenMP tasking model is composed of different parts: - *creating* tasks; - data scoping (which variables are private, shared, etc.); - *synchronization* between tasks; - execution model: how task are created, managed and executed in the system #highlight(fill: yellow)[An OpenMP task is a unit of work which execution may be deferred (but it may also start immediately).] OpenMP tasks are composed of 3 parts: + code to execute; + data environment; + control variables #figure( ```c void traverse_list(List* l) { for (Node* n = l->first; n != NULL; n = n->next) { #pragma omp task process(n); } } ```, caption: [OpenMP tasks are defined using the `task` directive] ) A thread that encounters the `task` directive will create a *task description*, which packages code and data environment, for that task. OpenMP tasking model is highly composable: tasks can be nested and can be used together with other OpenMP constructs (`for`, `sections`, etc.). #highlight(fill: yellow)[There is no synchronization between OpenMP tasks by default]. In the example above, when `traverse_list` returns it's not guaranteed that all tasks have been executed. This can be changed using the `taskwait` directive, which acts like a barrier for tasks: #figure( ```c void traverse_list(List* l) { for (Node* n = l->first; n != NULL; n = n->next) { #pragma omp task process(n); } #pragma omp taskwait } ```, caption: [OpenMP `taskwait` example] ) A *team* is a set of threads belonging to the parallel region that encloses a code block. Tasks are executed by a thread of the team that created it. Typically, the thread that creates the task is not the one who will execute it, but this distinction is not mandatory (the same thread may both create and then execute the task). When a parallel region begins, one implicit task is created for each thread, so #highlight(fill: yellow)[there are always at least as many tasks as threads]. #highlight(fill: yellow)[There is also always a first-level task that encloses all the others]. Threads can *suspend* (and then resume) tasks. Task scheduling is managed by OpenMP runtime and it's transparent to the programmer. === `depend` clause Used to specify *dependencies* between tasks and therefore have *point-to-point synchronization* between them. A dependency may be in task's *inputs*, *outputs* or both. #figure( ```c #pragma omp task shared(x) depend(out: x) x = do_something(); #pragma omp task shared(x) depend(in: x) do_something_else(x); #pragma omp task shared(x) depend(in: x) do_something_else_again(x); ```, caption: [OpenMP `depend` clause example] ) === `if` clause This clause is not specifically related to OpenMP tasking model, but one of its main uses is to avoid task creation when the amount of work is very limited: #figure( ```c #define CUTOFF 20 int fib(int n) { int x, y; #pragma omp task shared(x) if (n > CUTOFF) x = fib(n - 1); #pragma omp task shared(y) if (n > CUTOFF) y = fib(n - 2); #pragma omp taskwait return x + y; } ```, caption: [This example uses the `if` directive to avoid creating tasks with a small amount of work to do. This helps reduce the overhead because the number of tasks will be much lower.] ) == OpenMP accelerator model OpenMP accelerator model deals with *heterogeneous systems*. One of its main goal is to unify the programming standard across different architectures (GPU, SIMD units, etc.). Each architectural component is considered as a *device*. There is always one *host* device and there may be multiple *target* devices. System memory is divided between *host memory* and *device memory*. Each device is composted of one or more *compute units*. Each compute unit is divided into one or more *processing elements*. #figure( image("assets/08e811c2cf57ab395e230594e012e819.png", height: 20%), caption: [OpenMP execution model using accelerator] ) === `target` directive Denotes a portion of code that runs on the accelerator. Similar to `parallel` directive, `target` directive by itself does not create parallelism: it *replicates* the same work on multiple accelerator threads. When using the `target` directive, `map` clause allows to specify how variables are mapped between host and target data environments. #figure( ```c #pragma omp target map(to: b, c, d) map(from: a) { #pragma omp parallel for for(int i = 0; i < n; i++) a[i] = b[i] * c + d; } ```, caption: [`target` directive example] ) Offloading to the target is *synchronous* by default (the host waits until the target has finished). This can be changed by using the `nowait` clause. === `teams` directive Worksharing directive that creates a *legue* of thread teams. #figure( image("assets/a712e83c4e80fa3027c3763581d7cb83.png", height: 13%), caption: [Legue of threads] ) Thread in different teams cannot synchronize with each other. Only the master thread of each team executes the code inside the `teams` region. === `distribute` directive Worksharing directive that distributes the iteration space of a loop across the master threads of each team executing the region. Scheduling is static by default and can be changed using the `dist_schedule` directive. #figure( image("assets/8811c3e074b447f6e338a406ea0d1f76.png", height: 21%), caption: [OpenMP accelerator model] ) === `declare target` directive It's not possible to invoke other functions inside a `target` region unless that function is marked with `declare target` directive: #figure( ```c #pragma omp declare target int foo() { ... } #pragma omp end declare target int main() { #pragma omp target foo(); return 0; } ```, caption: [`declare target` example] ) = GPU acceleration #highlight(fill: yellow)[A GPU is an *accelerator* for graphical work]. GPUs are designed to exploit the high amount of *data* and *pipeline* parallelism in these problems (e.g. increasing the brightness of an image is an addition of a constant to a matrix of pixels). A GPU is an heterogeneous multi-processor chip highly specialized for graphical operations: #figure( image("assets/652318372ddf54dc4b687109505089b0.png", height: 12%), caption: [Overview of GPU architecture] ) Shader cores are *programmable processors*. The work distributor distributes work among different shaders. It can be implemented both in hardware or in software. Design of a GPU core starts from the CPU core: #figure( image("assets/e28ff2c6c53bc1dc751ad904d18504ac.png", width: 80%), caption: [CPU core architecture] ) CPU core is much complex (branch prediction, out-of-order execution, etc.) and this limits the amount of them that can be on a chip. GPU cores cannot be so complicated, because there is the need to have *thousands* of them. Therefore, #highlight(fill: yellow)[a GPU core is like a CPU core slimmed down]. There are multiple ALUs with a *single* fetch/decode unit for all of them: #figure( image("assets/78702341cbf85079263ce580f3f5b4ce.png", height: 20%), caption: [GPU core architecture] ) This architecture exploits *SIMD parallelism*: the same instruction is applied on different streams of data; there is no need to fetch/decode the same instruction multiple times. Compilers transform scalar instructions into *vector instructions* to make them work on GPU hardware. GPU cores can also use *task parallelism*, but the granularity is somewhat limited by the vector instructions. SIMD processing does not imply SIMD instructions. Instructions should be transformed in SIMD form either manually by the programmer or automatically by the hardware. #highlight(fill: yellow)[Conditional execution is a pain for this type of architecture] because the parallelism is broken: while one ALU is evaluating a conditional expression, others must wait for it to finish. Stalls caused by dependencies between instructions are avoided using a large *context storage*. This helps having a large number of "waiting" fragments, so when one of them stalls there is a high probability that another one is ready to execute. There is a tradeoff between the number of contexts and the size of each one. Higher context number means better latency hiding, because there can be more tasks in the queue, but it also mean that the size of each context cannot be too big. Context switching can be performed either by hardware or software. == Memory architecture CPU cores have multiple levels of cache to reduce memory latency. #highlight(fill: yellow)[In a GPU the problem is no longer the latency of the memory, but is its *bandiwdth*], because GPU deals with SIMD instructions. Therefore GPUs need an entire different technology for their memories (e.g. GDDR5) optimized for bandwidth instead of latency. Memory bandwidth is a critical resource when developing GPU applications. Programmers needs to keep low the pressure on the memory system, for example by increasing the arithmetic intensity (do more math instead of reading already computed results) or by using device memory (e.g. CUDA shared memory). An efficient GPU workload should: - have thousands of independent pieces of work, so all (or most of them) ALUs can be used and lots of context are available for switching; - not be limited by memory bandwidth = CUDA programming CUDA is a programming model for NVIDA GPUs. It's much more complex than OpenMP, because code has been changed more heavily than OpenMP. #figure( image("assets/afc07d2d76cdfdcd499ba1a35aa69387.png", height: 28%), caption: [CUDA execution model] ) The CPU sees the GPU as an external processor, with its own memory, capable of executing lots of threads in parallel. Data-parallel parts of the application are outlined within a *kernel* function that every thread on the device executes#footnote[SIMT paradigm: single instruction multiple threads.]. GPU threads are much more lightweight than CPU ones, but to have the maximum efficiency there must be thousands of them executing. In a CUDA application, sequential code runs on the CPU, while parallel parts are offloaded to the GPU. #figure( image("assets/08eb0f7790713f6d50c227b0a3646787.png", height: 25%), caption: [Sequential program vs CUDA parallel program] ) CUDA threads are grouped in *blocks*. Blocks are in turn grouped in *grids*. #figure( image("assets/efdcc63633790ce9b5244c476ae85f99.png", height: 25%), caption: [CUDA grid] ) Limits on the number of threads/blocks depend on the architecture. == How to port sequential code into CUDA + identify parallel parts of the code and isolate them in kernel functions; + identify data needed by each kernel that must be transferred on the device; + implement the required CUDA kernels; + modify the host code to invoke CUDA kernels #highlight(fill: yellow)[Every CUDA thread executes the same kernel function, but it operates on different portions of the same data structure]. CUDA provides different qualifiers for kernels: - `__global__`: executed *asynchronously* on the device, callable from the host only; - `__device__`: executed on the device, callable on the device only; - `__host__`: executed on the host, callable on the host only `cudaMalloc()` and `cudaMemcpy()` APIs can be used to allocate and to copy data to/from the device respectively. These are synchronous APIs, but CUDA also provides an asynchronous variant. #pagebreak(weak: true) When a kernel is launched on the device: + each block is assigned to a streaming multiprocessor; - there is no specific order in which blocks execute; - once a block is assigned to a SM it cannot migrate to other SMs; + threads in each block are grouped in teams called *warps*; + the scheduler selects a warp for execution among the available blocks; + idle blocks execute when another block stalls or has completed execution; + every CUDA core executes one of the threads inside a warp CUDA kernels scale transparently over different architectures. #figure( image("assets/aa3ae1e2e437af63150751e524d35a4c.png", width: 80%), caption: [Example of high CUDA scalability] ) Mapping between blocks and SM is not determined statically; it depends on the available execution capacity. Threads inside the same block execute concurrently on the same SM, while threads of different blocks execute concurrently over different SMs. *Registers* are a space where each thread can store its data. Registers are segmented by threads: the scheduler does not swap the content of the registers when performing context switching, but different threads access different sections of the register. The number of registers required by a thread decreases the parallelism of the application, because there is less space to store data for other threads and therefore there is less space to perform context switching efficiently. Example: if an architecture has 32.768 regsiters, each block has $32 times 8$ threads and the kernel needs 30 registers, a single SM can run only $floor(frac(32.768, 30 times 32 times 8)) = 4$ blocks. == CUDA driver API CUDA currently supports 2 APIs: - CUDA driver API, which allows very low-level operations - C for CUDA (CUDART), which is much more easier to use and it's based on the CUDA driver API #figure( image("assets/e13d868c294eb4addb423ea93575cebc.png", height: 17%), caption: [CUDA APIs scheme] ) #figure( image("assets/3605a5a84edcbd87ae67c6ce47283ad3.png"), caption: [This example shows how much CUDA runtime API is easier than the driver API] ) == CUDA compiler CUDA compiler processes both host and device code, then it splits them. CUDA compilers transforms device code into *PTX*, which is CUDA's ISA. == CUDA memory model #figure( image("assets/95ba5dbd8d2828718c1176007494bc1c.png", height: 30%), caption: [CUDA memory scheme] ) === Global memory Largest R/W memory available on the device shared among all blocks. It's a high-latency high-bandwidth memory. `cudaMalloc` allocates memory in this region. Global memory is *column-major*. Threads should access it using an *offset* instead of a *stride*. #figure( image("assets/837e6e6c5d3817045c887a408bf87506.png", height: 30%), caption: [Offset vs strided memory access] ) Between global memory and SMs there are 2 cache levels: - L1, private to the single SM; - L2, shared among all SMs Load/store operations in global memory are handled by the load/store unit. Every load/store operation is started from all threads of a warp at the same time. === Shared memory Fast memory within the SM. "Shared" is misleading here, because this memory is shared only between threads of the *same block*. #highlight(fill: yellow)[Data in this memory is not preserved between different kernel executions.] Shared memory is typcally used as a *cache* for the global memory and to communicate with other threads in the block. Each thread can access the whole shared memory address space, so writes on it must be *synchronized* between all threads in the same block. Shared memory is: - *multicast*: if multiple threads of the same warp access the same element, the access is done in a single transaction; - *broadcast*: if *all* threads of a warp access the same element, the access is done in a single transaction Shared memory is organized in *banks*. Access to the same bank is serial: if multiple threads access *different* address of the same bank, a *bank conflict* will occur. To allocate a variable defined *inside the kernel function* on the shared memory, its definition must be preceded by `__shared__`: #figure( ```c __global__ kernel(...) { __shared__ float arr[SIZE]; } ```, caption: [`arr` is allocated to device shared memory] ) Shared memory can be used also *dynamically* when its size cannot be determined at compile time. The size (in bytes) of the shared memory for each block must be specified with the optional third parameter when invoking the kernel: #align(center)[ ```c kernel<<<blocks, threadsPerBlock, sharedMemorySize>>>(...): ``` ] === Thread synchronization Threads *in the same block* can be synchronized using `__syncthreads()` API. This API should be used with care to avoid deadlocks: #figure( ```c if (threadIdx.x < 16) { ... __syncthreads(); } else { ... } ```, caption: [`__syncthreads()` here will produce a deadlock for the first 16 threads in the warp. They will wait forever because the other 16 threads will never enter the `if`, and thus will never reach the `__syncthreads()`.] ) Synchronization between *different* kernels is automatically handled by the system: before invoking the second kernel, the system waits until all writes of the first one are completed. CUDA provides also *atomic operations* that must always be used when writing data into global or shared memory. These APIs are expensive in CUDA, so they must be used with care. === Constant memory Read-only memory that holds data not known at compile time. This memory is initialized by the host and then it's used by CUDA threads. Actually, constant memory it's just a portion of the global memory, but its access uses a dedicated cache. This memory must be used when all threads of the same warp access the same data. When a warp reads a vale from the constant memory, the value will be put in the constant cache by the system (if not already present), so access to the same data by other warps will be much more efficient. === Registers #highlight(fill: yellow)[Registers hold thread-local data]. Registers are not unlimited, so their usage should be keep low. The higher the register pressure, the lower is the achievable parallelization with CUDA, because the lower is the number of blocks that can execute on a SM. CUDA compiler optimizes register usage. === CUDA local memory Not a physical memory, but just a *view* of its private memory for a thread. Tries to use register, then it fallbacks on the global memory when there is no space left. == Data transfers in CUDA Communication between host and device is complicated because the memory is accessed differently between the two systems: - modern CPUs use *virtual* memory addressing; - GPUs use *phyiscal* memory addressing Virtual memory on the host is managed both by the CPU and the OS. When started, each process gets an amounts of virtual memory which typically is much more than the physical memory available. Translation of virtual addresses in physical addresses is done by the CPU and the OS. Virtual memory can be mapped also to the secondary storage (e.g. the disk) if there is not enough space in the DRAM. === Pageable memory transfer #figure( image("assets/3a43fa75175d91f84b78b8f35e7c332a.png", width: 50%), caption: [Pageable memory transfer] ) This type of transfer is subject to high overhead, because: - it may be swapped to disk; - requires multiple copies, one for each page A plain `malloc` will allocate memory in this area. #figure( ```c w0 = (float*)malloc(SIZE); cudaMalloc(&w0_dev, SIZE); cudaMemcpy(w0_dev, w0, SIZE, cudaMemcpyHostToDevice); kernel<<<...>>>(w0_dev, SIZE); cudaMemcpy(w0, w0_dev, SIZE, cudaMemcpyDeviceToHost); ```, caption: [Pageable memory transfer example] ) === Pinned (page-locked) memory transfer #figure( image("assets/780c561e8a7494aa16e6155ebc76156b.png", width: 50%), caption: [Pinned memory transfer] ) This transfer performs better than the pageable one, but it reduces the amount of physical memory available for the OS. #figure( ```c cudaMallocHost(&w0, SIZE); cudaMalloc(&w0_dev, SIZE); cudaMemcpy(w0_dev, w0, SIZE, cudaMemcpyHostToDevice); kernel<<<...>>>(w0_dev, SIZE); cudaMemcpy(w0, w0_dev, SIZE, cudaMemcpyDeviceToHost); ```, caption: [Pinned memory transfer example] ) === Unified Virtual Memory (UVM) UVM combines host and device memory in a single *logical* view. #figure( image("assets/25db6fe8d64b50a45ece36ca296fa181.png", width: 60%), caption: [UVM is just a simplified logical view of the more complex physical memory system] ) #figure( ```c cudaMallocManaged(&w0, SIZE); kernel<<<...>>>(w0, SIZE); free(w0); ```, caption: [UVM usage example] ) While it's not visible in the code, a data transfer still takes place with UVM. #highlight(fill: yellow)[Data transfers with UVM happen through multiple small transfers], so while it's easier to write code using UVM, it has a quite big overhead. #figure( image("assets/b0f66674300844d1e06b3962b6c2e5ed.png", width: 100%), caption: [Overhead of different data transfer types] ) In general, UVM is useful only if: - GPU is integrated with the host; - data is loaded on the GPU *only once* and kernel *operation intensity* is high === Asynchronous data transfers CUDA provides also asynchronous data transfer APIs (e.g. `cudaMemcpyAsync()`). Asynchronous data transfers requires pinned memory or *streams*. ==== CUDA streams A CUDA stream is a FIFO queue of GPU operations (mainly kernel launches and memory copies) that must be executed in a specific order (e.g. insert order in the queue). CUDA defines a *default stream* (stream 0) which is used transparently to the user when no other streams are defined. #figure( image("assets/add8cd175a024a5201e9f3080c053031.png", width: 45%), caption: [Default stream usage] ) Commands in the same stream are executed sequentially, but commands in different streams are executed concurrently. Streams can therefore be beneficial to optimize application performance. Streams can be synchronized both explicitly, using CUDA APIs, or implicitly. Streams are always synchronized when using blocking memory allocation APIs (e.g. `cudaMalloc`, `cudaMallocHost`). CUDA streams help in overlapping computation and memory transfers *within the device*. *Double buffering* is a technique that exploits multiple streams execution to improve concurrency. It's very similar to CPU pipeline: #figure( image("assets/b0edc4fbe83beb3cf046e9a3beb4b296.png", width: 80%), caption: [GPU double buffering example] ) #pagebreak(weak: true) = FPGA (Field-programmable gate arrays) #highlight(fill: yellow)[FPGA is a computer architecture that combines the flexibility of software with the high performance of hardware]. It's an intermediate approach between full-custom hardware (ASIC) and something that is *programmable*. FPGA is custom hardware, but the way it's implemented does not rely on the physical representation of transistors, but just on *reconfiguring* some logic. #figure( image("assets/d432ddb92c322524b306dae3f034a65f.png", width: 80%), caption: [Performance and energy efficiency of diffferent architectures.] ) CPU and GPU are bound to the Von Neumann architecture: every program is executed in the same exact way. This is required to be able to execute *any* program, but it's not the optimal solution to extract performance from the system. ASIC and FPGA, since they can implement completely custom logic, are the most efficient architectures. An FPGA is a matrix of *configurable logic blocks* (CLB): #figure( image("assets/4cf86efa9a12d6c7515993ab4404c4f9.png", height: 29%), caption: [CLB matrix] ) Each CLB is made of two components: - *slices*, made of *lookup tables*. These perform logic operations; - *flip flops*, used as a memory storage A lookup table is basically a multiplexer that evaluates a *truth table* stored in the configuration. #figure( image("assets/4208c680a46c9fbf124e2813fb6147ff.png", height: 20%), caption: [Lookup tables and flip flops] ) *Wires* are used to interconnect multiple CLBs together. *Connection boxes* and *switch matrices* are the fundamental components of these interconnections. #figure( image("assets/fe6365c6940d342f862cab39f425d836.png", height: 20%), caption: [Routing in FPGA] ) By configuring connection boxes and switch matrices, it's possible to allow (or forbid) a certain direction of communication. Switch boxes are actually *bitmasks* that open/close a door. FPGAs have access to the system's DRAM, but they also have two types of internal memory: - *block RAM*: SRAM memory connected to the circuit using switching boxes and switching matrices; - *distribute RAM*: interconnection of several flip-flop within the same CLB FPGA also have components to perform *I/O operations*. FPGAs can either be *integrated* (on the same chip of the CPU) or *discrete*. == Place & route #highlight(fill: yellow)[Place is the process of deciding which parts of a logic circuit are mapped to which CLBs in the FPGA]. #highlight(fill: yellow)[Route is the process of defining the interconnection of CLBs to implement the logic circuit functionality]. #figure( image("assets/c875dcf051413043aeea398cd954903c.png", height: 20%), caption: [Simpled $2 times 2$ CLBs FPGA] ) If this is the circuit we want to implement in our FPGA: #align(center)[ #image("assets/1f02728f0bccf7d7f295cf84ff717fe6.png", height: 10%) ] we can identify 2 separate parts. Each one of them will be mapped in a dedicated CLB: #align(center)[ #image("assets/16675a75d6c34a21ae292f8d5bf7d892.png", height: 10%) ] The next step is to place the CLBs in the FPGAs. We have just 2 CLB to place in a $2 times 2$ grid, so there are different alternatives: #table( columns: (40%, 1fr), align: (center + horizon, left + horizon), [#image("assets/40c8ddaf4ee23134c7b26e0b36877561.png")], [This placement is not optimal because routing is complicated (3 switching boxes used).], [#image("assets/42c2f93be7ba62591f446efcb7e90fc4.png")], [This is the #highlight(fill: yellow)[optimal solution] because it uses just 2 SBs and 2 wires.], [#image("assets/4fd05c47dbe119621a53881aed8e892a.png")], [This is very similar to the previous one, but it uses one more wire, so it's not optimal.] ) == FPGA configuration FPGA reconfiguration is about changing switching blocks configuration through a *bitstream*. #highlight(fill: yellow)[Reconfiguring the FPGA is the process of loading this bitstream on it]. During the development phase, the FPGA device is programmed using utilities such as the Vivado IDE. On production hardware, the bitstream is placed in non-volatile memory and the hardware is configured to program the FPGA when powered on. Reconfiguring FPGA takes time, so it's crucial to find a balance between *complete* reconfiguration and *partial* reconfiguration. FPGA reconfiguration can be *static* (must be done *before* execution, it cannot be done on a working environment) or *dynamic* (can be done also during execution). Reconfiguration can be *external* (the bitstream comes from an FPGA external source) or *internal*. = HLS - High Level Synthesis HLS is a (very) abstract manner of describing how the hardware of an FPGA should behave. FPGAs are configured using an hardware design flow: + desired hardware behaviour is described using an *Hardware Description Language* (HDL); + HDL is turned into a configuration bitstream using tools like Vivado HDL is very similar to a programming language: #figure( image("assets/d2092f638a0a06292ea29999a536981f.png", height: 25%), caption: [HDL example] ) *Synthesis* is the process from which a *gate-level netlist* is generated from hardware description. Designing hardware requires an understanding of how logic gates work. Not all FPGA users have those skills, so its design must be simplified in some way. #figure( image("assets/d6ee216305c9c5cba1914a345b6cd567.png", height: 30%), caption: [Different levels of abstraction when designing an FPGA] ) FPGA must be designed in two directions: - *behaviour*: the algorithm which runs on the FPGA; - *structure*: registers, gates, flip flops, etc. #highlight(fill: yellow)[High level synthesis (HLS) is an automated design process that transforms a high-level function specification to a register-trasnfer level description suitable for hardware implementation]. HLS allows to describe the hardware using a high-level language such as C/C++. HLS covers the first layer of hardware synthesis: #figure( image("assets/f8ab78a6d40528b9f3b6e547a09a1e92.png", height: 25%), caption: [HLS vs HDL] ) Control logic and datapath can be extracted directly from the C/C++ code. *Scheduling* and *binding* are the core of HLS: - scheduling determines in which clock cycle an operation will occur; - binding determines which *core* will execute an operation Each C/C++ function is translated into a dedicated RTL block. Function arguments become ports on these RTL blocks.\ Functions may also be *inlined* to dissolve their hierarchy. HLS largely uses the *loop unrolling* and *loop pipelining* optimizations to expose higher parallelism and reduce the latency. HLS describes hardware as a *finite-state machine* that performs different atomic operations. Producing the final bitstream requires time, therefore developers rely often on *simulators*. #highlight(fill: yellow)[Memory performance of these simulator is not realistic], but still simulation is useful when developers care only about executing a function in the FPGA and do not care about its integration in the system. The *initialization interval* (II) is the number of clock cycles to wait before the computing of the next iteration of a loop can start. It depends on the availability of resources (e.g. number of ports to access the memory). #page()[ #align(center + horizon, text(17pt)[ *Labs* ]) ] = Profiling Profiling is not only useful for measuring performances, but also for *debugging* and *optimizations*. Profiling is used in many context (e.g. web applications), not only in hardware. Steps to create a parallel program: + identify parts of the program (*hotspots*) that can be parallelized; + parallelize the code on multiple threads; + *assess* that parallelization had a benefit on performance (and also that the new parallelized version still produces correct results) Profiling can be useful in all these steps, because: - it helps in identifying hotspots; - in can be used to check the overhead of parallelization, the cost of memory access, etc.; - it can be used during the assessment to check if parallelization had a benefit on performance Different metrics for different aspects of the system: - *throughput*: operations per seconds, measured in FLOP/s (floating point operations); - *memory bandwidth*: measured in GB per seconds; - *energy efficiency*: this metric has become very important in the last years, not only for *environmental* aspects but also for *efficiency* (doing more with less energy waste) The *Roofline model* is a metodology to describe performance of a system which can display also the maximum achievable performance: #figure( image("assets/5e65d03d9746e7fb65523a366794a405.png", height: 30%), caption: [Roofline model] ) The $x$ axis measures the *operational intensity*, which is the computational cost of the operation relative to the amount of data it needs. The $y$ axis measures the throughput of the system. Example of operational intensity for `c = a + b`: + read `a`; + read `b`; + calculate `a + b` 3 instructions in total with 2 data accesses, so the operational intensity is $frac(1, 3)$. The roofline model helps in identifying *memory bottlenecks* because it can show if a program is memory-bounded. The graph provided by the roofline model is very important. *Before* going through optimizing the code, the programmer must know what is the maximum achievable performance in order to not waste time in optimization. Profiling is a *dynamic* program analysis that measures different aspects: - memory usage; - time complexity; - instruction usage; - frequency and duration of *function calls* Profiling is *dynamic* because different operations takes different amount of time, so the profiler cannot simply see the (static) source code of the program. There are different techniques to collect profiling data: - *performance counters*: typically implemented at *hardware level* by CPUs; - code instrumentation; - hardware interrupts: execution is interrupted every $t$ seconds to check for a metric; - OS hooks (scheduling point, context switch); - ISA simulators: can be used when there is no bare-metal hardware == Profiling tools #figure( table( columns: (auto, auto), align: (center + horizon, left), [*perf*], [ - uses hardware and OS counters; - very low-level and fine-grained statistics; - highly dependent on the architecture ], [*gprof*], [ - measures *function* execution time; - requires special compilers annotations; - does not actually measure the time spent in a fuction; this time is just *inferred* by taking "snapshots" of the application at regular intervals; - not suited for applications with very small functions because their execution time might be lower than the sampling interval ], [*Valgrind*], [ - collection of tools, rather than a single one; - profiled code is executed in a *sandbox*. This is an advantage because there is no need of hardware counters or compiler annotations, but it also mean that performance when run on *real* hardware will be slightly different ] ), caption: [Comparison of common profiling tools] ) = HLS == Interfaces #figure( table( columns: (auto, auto), align: (center + horizon, left + horizon), [*AXI* (or *mAXI*)], [full-access interface], [*AXI-lite*], [lightweight interface, used for scalar and constant propagation], [*AXI-stream*], [very efficient, non-memory mapped interface] ), caption: [AXI4 interfaces] ) *Bundling* is how interfaces are mapped to physical memory ports. The number of memory ports is limited and multiple accesses using the same port happen in sequence (not concurrently), so they should be used with care. AXI master is a *bidirectional channel*: it's able to read and write concurrently.
https://github.com/ngyngcphu/tick3d-docs
https://raw.githubusercontent.com/ngyngcphu/tick3d-docs/main/contents/04_framework_technology/index.typ
typst
Apache License 2.0
= Framework & Technology Phần này sẜ giới thiệu sÆ¡ lược về các cÃŽng nghệ được sá»­ dụng trong dá»± án. Nhóm quản lÃœ phiên bản mã nguồn với Git và GitHub, sá»­ dụng framework ReactJs cho front-end, Fastify cho back-end, ánh xạ tới cÆ¡ sở dữ liệu với Prisma và sá»­ dụng PostgreSQL để quản lÃœ cÆ¡ sở dữ liệu. Dưới đây nhóm sẜ giới thiệu tóm lược về mỗi cÃŽng nghệ đã nêu: == Git #figure(caption: [Git], image("../images/framework/Git.png", fit: "cover", width: 70% ), ) Git là một hệ thống quản lÃœ phiên bản phân tán nguồn mở, được <NAME> tạo ra vào năm 2005 để giải quyết nhu cầu quản lÃœ mã nguồn hiệu quả trong quá trình phát triển nhân Linux. Hệ thống này đã trở thành một trong những hệ thống quản lÃœ phiên bản phổ biến nhất được sá»­ dụng hiện nay. Git được sá»­ dụng để theo dõi những thay đổi trong mã nguồn trong quá trình phát triển phần mềm và cho phép nhiều lập trình viên làm việc đồng thời trên cùng một cÆ¡ sở mã nguồn. Một số Æ°u điểm của Git bao gồm tốc độ, sá»± đơn giản, tính chất phân tán hoàn toàn, hỗ trợ phát triển song song và tính toàn vẹn. Git được thiết kế để hoạt động nhanh và hiệu quả, ngay cả khi làm việc với các cÆ¡ sở mã nguồn lớn. Nó có giao diện dòng lệnh đơn giản và trá»±c quan giúp lập trình viên dễ dàng tìm hiểu và sá»­ dụng. Git là một hệ thống kiểm soát phiên bản phân phối hoàn toàn, có nghÄ©a là mọi lập trình viên đều có bản sao hoàn chỉnh của cÆ¡ sở mã trên máy cục bộ của họ. Điều này giúp dễ dàng làm việc ngoại tuyến và cộng tác với các lập trình viên khác. Git cÅ©ng hỗ trợ việc phát triển song song, cho phép nhiều lập trình viên làm việc đồng thời trên cùng một cÆ¡ sở mã mà khÃŽng có xung đột. Git sá»­ dụng các hàm băm mật mã để đảm bảo tính toàn vẹn của cÆ¡ sở mã, khiến cho việc sá»­a đổi mã một cách vÃŽ tình hoặc cố Ãœ mà khÃŽng bị phát hiện là gần nhÆ° khÃŽng thể. #pagebreak() == GitHub #figure(caption: [GitHub], image("../images/framework/github.png", fit: "cover", width: 70% ), ) GitHub là một nền tảng web bổ sung cho các chức năng của Git. GitHub cung cấp dịch vụ lÆ°u trữ cho các kho Git (Git repositories) cùng với nhiều tính năng quản lÃœ dá»± án và cộng tác. Với GitHub, người dùng có thể lÆ°u trữ kho Git của họ trên Internet, giúp chúng có thể truy cập được từ mọi nÆ¡i có kết nối Internet. Cách tiếp cận này giúp đơn giản hóa việc cộng tác vì các thành viên trong nhóm có thể dễ dàng sao chép các kho Git, tạo nhánh và gá»­i "yêu cầu kéo" (Pull Requests) để xem xét và tích hợp mã. GitHub cÅ©ng hỗ trợ việc quản lÃœ dá»± án bằng cách cung cấp các cÃŽng cụ để theo dõi sá»± cố, báo cáo lỗi và quản lÃœ các yêu cầu tính năng. Ngoài ra, nó tích hợp tốt với các dịch vụ tích hợp liên tục (Continuous Integration) nhÆ° GitHub Actions, cho phép các quy trình được kiểm thá»­ và triển khai tá»± động. #pagebreak() == ReactJS #figure(caption: [ReactJS], image("../images/framework/reactjs.png", fit: "cover", width: 70% ), ) ReactJS là một thÆ° viện JavaScript được sá»­ dụng để xây dá»±ng giao diện người dùng. Nó được tạo ra bởi <NAME>, một kỹ sÆ° phần mềm tại Facebook và được Facebook phát triển và duy trì. ReactJS là một thÆ° viện khai báo, hiệu quả và linh hoạt, chịu trách nhiệm về lớp View của ứng dụng. Nó cho phép các nhà phát triển tạo các thành phần UI có thể tái sá»­ dụng, có thể được lồng ghép với các thành phần khác để xây dá»±ng các ứng dụng phức tạp từ các khối xây dá»±ng đơn giản. ReactJS sá»­ dụng cÆ¡ chế dá»±a trên DOM ảo để điền dữ liệu vào HTML DOM, cÆ¡ chế này hoạt động nhanh vì nó chỉ thay đổi các thành phần DOM riêng lẻ thay vì tải lại toàn bộ DOM mỗi lần. ReactJS có một số lợi thế so với các JavaScript framework khác nhÆ° dễ sá»­ dụng, tốc độ nhanh và có khả năng mở rộng. Nó giúp các lập trình viên xây dá»±ng các ứng dụng web có kích thước lớn và sá»­a đổi dữ liệu mà tránh việc tải lại trang khÃŽng cần thiết. ReactJS chỉ xá»­ lÃœ lớp View trong mẫu MVC của giao diện người dùng ứng dụng. ReactJS cập nhật và hiển thị các thành phần một cách hiệu quả, đồng thời xá»­ lÃœ khéo léo các bản cập nhật DOM. Nó có thể được tích hợp vào bất kỳ ứng dụng nào, cho dù đó là một phần của trang hay một trang hoàn chỉnh hay thậm chí là toàn bộ ứng dụng. ReactJS cÅ©ng có khả năng tÆ°Æ¡ng thích ngược, nghÄ©a là nó cÅ©ng có thể được sá»­ dụng với các phiên bản trình duyệt cÅ© hÆ¡n. #pagebreak() == Fastify #figure(caption: [Fastify], image("../images/framework/fastify.png" , fit: "cover", width: 70% ), ) Fastify là một web framework dành cho Node.js tập trung chủ yếu vào việc cung cấp trải nghiệm tốt lập trình viên với chi phí thấp và một kiến trúc plugin mạnh mẜ. Fastify lấy cảm hứng từ Hapi và Express và là một trong những web framework nhanh nhất hiện tại. Fastify có khả năng mở rộng thÃŽng qua các hook, plugin và decorators. Fastify có một trình logging được tích hợp sẵn, từ đó gần nhÆ° loại bỏ chi phí cho tác vụ logging. Fastify thân thiện với người dùng và được xây dá»±ng để mang tính diễn đạt cao mà khÃŽng làm giảm hiệu suất và tính bảo mật. Một trong những Æ°u điểm chính của Fastify nằm ở tốc độ, đạt được nhờ tối thiểu hóa chi phí và tập trung vào hiệu suất. Nó cung cấp tính năng tá»± động serialize và deserialize dữ liệu đến và đi, hỗ trợ việc xác thá»±c các request, tham số định tuyến và chuẩn hóa đầu vào, khiến nó trở thành một lá»±a chọn an toàn để phát triển web. #pagebreak() == Prisma #figure(caption: [Prisma], image("../images/framework/prisma.png", fit: "cover", width: 70% ), ) Prisma là một ORM thế hệ mới giúp đơn giản hóa quy trình làm việc với cÆ¡ sở dữ liệu và thay thế các ORM truyền thống. Nó cung cấp khả năng truy cập cÆ¡ sở dữ liệu an toàn kiểu (type-safe) với Prisma Client, di chuyển (migrate) dữ liệu với Prisma Migrate cÅ©ng nhÆ° quản lÃœ dữ liệu trá»±c quan với Prisma Studio. Prisma Client có thể được sá»­ dụng để xây dá»±ng các API GraphQL, REST, gRPC và hÆ¡n thế nữa. Prisma hiện hỗ trợ nhiều hệ thống quản lÃœ cÆ¡ sở dữ liệu nhÆ° MySQL, PostgreSQL và MongoDB. Một số lợi ích của Prisma có thể kể đến nhÆ° an toàn kiểu, API hiện đại và đọc/ghi dữ liệu quan hệ một cách linh hoạt. Prisma thống nhất quyền truy cập vào nhiều cÆ¡ sở dữ liệu cùng một lúc và từ đó giảm đáng kể độ phức tạp trong các quy trình làm việc trên nhiều cÆ¡ sở dữ liệu. Nó cÅ©ng có hệ thống sá»± kiện và streaming theo thời gian thá»±c cho cÆ¡ sở dữ liệu, đảm bảo người dùng nhận được cập nhật cho tất cả các sá»± kiện quan trọng xảy ra trong cÆ¡ sở dữ liệu của mình. #pagebreak() == PostgreSQL #figure(caption: [PostgreSQL], image("../images/framework/postgresSQL.png", fit: "cover", width: 70% ), ) PostgreSQL, được phát triển và duy trì bởi một nhóm các nhà phát triển phần mềm PostgreSQL Global Development Group, là một hệ thống cÆ¡ sở dữ liệu quan hệ đối tượng nguồn mở sá»­ dụng và mở rộng ngÃŽn ngữ SQL kết hợp với nhiều tính năng lÆ°u trữ và mở rộng quy mÃŽ một cách an toàn cho các khối lượng dữ liệu phức tạp nhất. PostgreSQL nổi tiếng bởi kiến trúc đã được chứng minh, độ tin cậy, tính toàn vẹn dữ liệu, bộ tính năng mạnh mẜ, khả năng mở rộng và cộng đồng nguồn mở đằng sau cung cấp nhất quán các giải pháp sáng tạo và hiệu quả. PostgreSQL đi kÚm với nhiều tính năng nhằm giúp các lập trình viên xây dá»±ng ứng dụng, các quản trị viên bảo vệ tính toàn vẹn của dữ liệu và xây dá»±ng mÃŽi trường có khả năng đối phó với lỗi, đồng thời giúp người dùng quản lÃœ dữ liệu của mình dù lớn hay nhỏ. Ngoài việc là nguồn mở và miễn phí, PostgreSQL còn có khả năng mở rộng cao. Chẳng hạn nhÆ° người dùng có thể tạo loại dữ liệu của riêng mình, xây dá»±ng các hàm tùy chỉnh, thậm chí viết mã từ các ngÃŽn ngữ lập trình khác nhau mà khÃŽng cần biên dịch lại cÆ¡ sở dữ liệu. #pagebreak()
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/003%20-%20Gatecrash/006_The%20Greater%20Good.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Greater Good", set_name: "Gatecrash", story_date: datetime(day: 06, month: 02, year: 2013), author: "<NAME>", doc ) When the massive doors of the war room swung open, <NAME> could feel energy hit him like a wave of heat from a smelting forge. It wasn't actual heat, but more like an energetic wind that pulsated through his body like a shockwave. For a second, he was taken aback by the power. He had been around many angels in his time, but her aura was an order of magnitude higher than any he had encountered. A quick smirk flashed across the face of the Boros guildmage who escorted Gideon as they walked into the chamber. The escort carried out the Boros salute and announced, "Warleader. <NAME> to see you." He then bowed and left. Aurelia looked up from a wide steel table etched with symbols, miniature towers, and buildings covering its surface, but Gideon couldn't take his eyes off of the Boros guildmaster. Her hair, eyes, armor—everything about her—seemed to shimmer like air rising off the sun-scorched horizon. Gideon couldn't tell whether there were tiny vortices of energy all over her or if she was magically surrounded by a shield of swirling mana. He realized he was staring. #figure(image("006_The Greater Good/01.jpg", width: 100%), caption: [Aurelia, the Warleader | Art by Slawomir Maniak], supplement: none, numbering: none) "Guildmaster," he said, placing his hand on his chest and bowing his head slightly. "<NAME>." Her voice was powerful with an otherworldly quality. "Your accent, dress, and even your name say you're not from this district. And yet... I have word that you saved an entire brigade of my Boros from a Rakdos ambush that would have killed every last one of them." "They were well trained for combat. I only showed them where to strike and when." "Such modesty." Aurelia smiled. "But I think it is safe to say that you did a little striking of your own." Aurelia moved around the table and stood before Gideon. "What puzzles me, Jura, is why I haven't heard of your skill in battle before now. I get the feeling someone like you isn't apt to lay low and shirk the glory of battle." "I'm not from around here, Guildmaster. Most of my travels take me... elsewhere." Aurelia regarded Gideon's answer with a mix of curiosity and angelic aloofness, but Gideon could see her mind working. "Fair enough." She refolded her wings and indicated the miniature buildings on the table. "You know this place?" "I do not," Gideon said. "It is the Ninth."Aurelia placed a hand on one of the building rooftops. "It's at the edge of the One Hundred Steps. Azorius turf. Of course, the Azorius don't see fit to enter the Ninth. It's a little too... hands-on... for their tastes. The Rakdos and Gruul tug and tear it apart like a dromad's corpse, while the Dimir... well... they do what the Dimir do best: hide in the shadows and pull puppet strings." #figure(image("006_The Greater Good/02.jpg", width: 100%), caption: [Crowned Ceratok | Art by <NAME>], supplement: none, numbering: none) Gideon looked at the neat, clean, empty model buildings, but he imagined the real plight of the people attempting to peacefully exist within a war zone. "So, it's contested turf. The innocent people living there must be paying a high price." "Exactly," Aurelia said with heaviness in her tone. She looked at Gideon. "The innocent always pay the highest price. I would love to go in there with some Cinder Elementals and burn out every last Rakdos, Gruul, and Dimir, but unguilded Ravnicans have been living there for centuries in relative peace. Back then, it used to all be Azorius turf. But when the old #emph[Guildpact] was broken..." Aurelia trailed off. "I won't bore you with a history lesson, Jura, but in the aftermath, the Azorius had to abandon the Ninth so they could rebuild New Prahv. Naturally, the Rakdos and Gruul pushed their way in and began brawling like oafs. Much of the Ninth was lost." "And where was the Boros in all this?" "I wasn't guildmaster, then." Aurelia's reply had a touch of cold steel to it. Gideon had hit a nerve. "We were led by a disgrace to the Legion. I watched as swaths of the Ninth slipped away. Its loss and other unforgivable blunders all but forced... a change... in guild leadership. Forgive me, Jura. I can still taste the bitterness of those times. Let me show you something." Aurelia motioned for Gideon to accompany her across the polished marble floor of the great war room to a high balcony that looked over the central grounds of Sunhome. The air smelled fresh and clean. Gideon's eyes adjusted to the bright sunlight. Far below, legions of Boros knights trained and marched in the gleaming sun, while flags and banners moved in the breeze. It was a glorious sight. #figure(image("006_The Greater Good/03.jpg", width: 100%), caption: [Assemble the Legion | Art by <NAME>champs], supplement: none, numbering: none) After gazing over the grandeur of Sunhome and its armies, Aurelia spoke. "I can't enjoy this fully, Jura. All this glory, and all I can think of are those poor people in the Ninth who are left behind to endure squalor, lawlessness, and stupidity." She looked at Gideon. "Jura, the Ninth is a stain on Ravnica, a stain on the Boros, and a stain on my soul. I dearly wish to cleanse it." "And you want me to help?" "No, Jura, I want you to lead." Aurelia turned and put a hand on his shoulder, a hand which felt much heavier than Gideon expected. "I know a leader when I see one. You have greatness within you." She pointed to a hundred gleaming soldiers out on the parade grounds. "I am prepared to give you command of that battalion, there, if you will fight with us. Or better still, if you join us." Power radiated from her face as Aurelia fixed her eyes on Gideon. #figure(image("006_The Greater Good/04.jpg", width: 100%), caption: [Boros Elite | Art by <NAME>urai], supplement: none, numbering: none) "The battalion is mine even if I choose not to join the Boros?" Gideon asked. Aurelia's face remained implacable but she hesitated before answering. "Yes, Jura. But command will be mine. Clear?" "Of course." Gideon felt a sense of duty and allegiance to the angelic guildmaster rush up from deep within his chest. With soldiers like that, mountains could be moved. But Gideon had seen something much worse than the Ninth in his travels. Something worse than even the demon lord Rakdos could muster. He had seen a world being devoured. But even as #emph[Zendikar] faced extraplanar horrors, Ravnica's streets teemed with innocents caught in the crossfire of guild warfare—the so-called "gateless." He was needed here. With Aurelia's help, he could save countless lives. #figure(image("006_The Greater Good/05.jpg", width: 100%), caption: [Gideon, Champion of Justice | Art by <NAME>za], supplement: none, numbering: none) Gideon knew the dangers of too readily following someone else's orders. He was not ready to become Boros. But he was ready to wield its weapons for the greater good. Gideon looked up from the map of the Ninth and smiled like a wolf. "When do we start?"
https://github.com/jamesrswift/springer-spaniel
https://raw.githubusercontent.com/jamesrswift/springer-spaniel/main/template/main.typ
typst
The Unlicense
#import "@preview/springer-spaniel:0.1.0" as springer-spaniel #import springer-spaniel.ctheorems: * #import springer-spaniel.gentle-clues: * #import "@preview/physica:0.9.3": * #show: springer-spaniel.template( title: [Towards Swifter Interstellar Mail Delivery], authors: ( ( name: "<NAME>", institute: "Primary Logistics Departmen", address: "Delivery Institute, Berlin, Germany", email: "<EMAIL>" ), ( name: "<NAME>", institute: "Communications Group", address: "Space Institute, Florence, Italy", email: "<EMAIL>" ), ( name: "<NAME>", institute: "Missing Letters Task Force", address: "Mail Institute, Budapest, Hungary", email: "<EMAIL>" ) ), abstract: [ Recent advances in space-based document processing have enabled faster mail delivery between different planets of a solar system. Given the time it takes for a message to be transmitted from one planet to the next, its estimated that even a one-way trip to a distant destination could take up to one year. During these periods of interplanetary mail delivery there is a slight possibility of mail being lost in transit. This issue is considered so serious that space management employs P.I. agents to track down and retrieve lost mail. We propose A-Mail, a new anti-matter based approach that can ensure that mail loss occurring during interplanetary transit is unobservable and therefore potentially undetectable. Going even further, we extend A-Mail to predict problems and apply existing and new best practices to ensure the mail is delivered without any issues. We call this extension AI-Mail. ], ) #pagebreak() = Introduction <sec:2> Our concept suggests three ways that A-Mail can be best utilized. - First is to reduce the probability of the failure of a space mission. This problem, known as the Mars problem, suggests that the high round-trip time required for communication between Mars and Earth inhibits successful human developments on the planet. Thanks to A-Mail's faster-than-light delivery system this problem could be solved once and for all. - As A-Mails are written using pen and paper, no digital technology is needed for short and long distance communication. This suggests a possibility of reducing the communication monopoly currently held by an entity known as the "internet". Our suggestion of A-Mail being responsible for postal delivery would reduce dependence on online services by delivering the vast majority of mail offline. Space is a place where drastic changes in methods of production and distribution can easily occur. - Lastly, A-Mail is capable of performing high-level complex calculations. It is this capability that distinguishes A-Mail from traditional space mailers. This is an especially useful capability when planning long-distance space missions. The delivery speed of an A-Mail can be determined through this simple formula: $ v(t) = lim_(t -> infinity) integral^infinity c dot sqrt(t^2) dd("t") $ Building on the strong foundations of A-Mail, we extend our platform to predict problems and apply existing and new best practices to ensure the mail is delivered without any issues. We call this extension AI-Mail. AI-Mail is a new concept designed and delivered by artificially intelligent (AI) agents. The AI-Mail agents are intelligently designed to solve problems at various points in the delivery chain. These problems are related to targeting, delivery delay, tone of delivery, product information, product return, system crash, shipment error and more. AI-Mail provides a one-stop solution for A-Mail's shortcomings. I'd explain how to typeset maths, but Typst handles that for us natively under the hood. #footnote[ In physics texts please depict your vectors in #strong(emph[boldface-italic]) type - as is customary for a wide range of physical subjects. ] $ abs(gradient_alpha^mu (y)) & <= 1/(d - a) integral abs(gradient 1/( abs(𝜉 - y)^(d-alpha))) dd(mu (𝜉)) = integral 1 / (abs(𝜉 - y)^(d-alpha+1)) dd(mu (𝜉))\ & = (d - alpha + 1) limits(integral) _d(y)^infinity (mu(B(y,r)))/(r^(d-alpha+2)) dd(r) <= (d-alpha + 1) limits(integral)^infinity_d(y) (r^(d-alpha))/(r^(d-alpha+2)) dd(r) $ == Subsection Heading <sec:2.1> #lorem(50) #quote[ Please do not use quotation marks when quoting texts! Simply use the `quote` element -- it will automatically be rendered in line with the preferred layout. ] === Subsubsection Heading #lorem(50) as has already been described in @sec:2.1, see also @fig:full. #footnote[ If you copy text passages, figures, or tables from other works, you must obtain _permission_ from the copyright holder (usually the original publisher). Please enclose the signed permission with the manuscript. The sources permission to print must be acknowledged either in the captions, as footnotes or in a separate section of the book. ] Please note that the first line of text that follows a heading is not indented, whereas the first lines of all subsequent paragraphs are. ==== Paragraph Heading #lorem(25) all your cross-references and citations as has already been described in @sec:2. #figure( caption: [This figure takes up the full width, so we just use the normal `figure` element. We can refer to it in the main body by labelling the figure (_e.g._, `<fig:full>`)], block(stroke: 0.75pt, height: 5cm, width: 100%) ) <fig:full> For typesetting numbered lists we recommend using the natively supported numbered list, which can be started/continued by starting a line with $plus$. + Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. + Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. + Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. + Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. ===== Subparagraph Heading #lorem(50) as has already been described in @sec:2.1, see also @fig:full. #springer-spaniel.sidecaption( caption-width: 33%, figure( caption: [For smaller figures, which need not take up the full width of the page, this template provides a wrapper for `figure` called `sidecaption` which will move the caption to the left third of the page while the figure occupies the right two thirds.], block(stroke: 0.75pt, height: 4cm, width: 67%) ), label: <fig:side> ) For unnumbered list we recommend using the natively supported numbered list, which can be started/continued by starting a line with $minus$. - Livelihood and survival mobility are oftentimes coutcomes of uneven socioeco-nomic development, cf. Table 1 - Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. - Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. - Livelihood and survival mobility are oftentimes outcomes of uneven socioeconomic development. #lorem(75) @einstein For typesetting theorems, proofs, lemma(s? what's the plural?), corollaries, and so on, this template provides a styled wrapper of the `ctheorems` package, examples of which are shown below: #theorem("Euclid")[There are infinitely many primes.] <euclid> #proof([of @euclid])[ Suppose to the contrary that $p_1, p_2, dots, p_n$ is a finite enumeration of all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list, it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. Since $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = 1$, a contradiction. ] #lemma[ If $n$ divides both $x$ and $y$, it also divides $x - y$. @latexcompanion @knuthwebsite ] #corollary[ if $n$ divides two consecutive natural numbers, then $n = 1$. ] #lorem(40) #info[The `gentle-clues` package is included in this template, and will be given a new style that better first this template in a future version] #lorem(75) #figure(caption:[You can make the table yourself using native Typst elements for simple data],{ table( columns: (auto, auto, auto, 1fr), stroke: none, table.hline(stroke: springer-spaniel.dining-table.toprule), [Classes], [Subclass], [Length], [Action Mechanism], table.hline(stroke: springer-spaniel.dining-table.midrule), [Translation], { [mRNA] springer-spaniel.dining-table.note.make[Table foot note (with suberscript)] }, [22 (19---25)], [Translation repression, mRNA cleavage], [Translation], [mRNA cleavage], [21], [mRNA cleavage], [Translation], [mRNA], [21---22], [mRNA cleavage], [Translation], [mRNA], [22---24], [Histone and DNA modification], table.hline(stroke: springer-spaniel.dining-table.toprule) ) springer-spaniel.dining-table.note.display-style( springer-spaniel.dining-table.note.display-list ) }) #figure( caption: [The alternative this template makes available is the construction of tables by column instead of by row], springer-spaniel.dining-table.make( columns: ( ( header: [Classes], key: "class", gutter: 0.5em, ), ( header: [Subclass], key: "subclass", gutter: 0.5em, ), ( header: [Length], key: "length", gutter: 0.5em, ), ( header: [Action Mechanism], key: "mechanism", gutter: 0.5em, width: 1fr, ), ), data: ( ( class: [Translation], subclass: [mRNA] + springer-spaniel.dining-table.note.make[Table foot note (with suberscript)], length: [22 (19---25)], mechanism: [Translation repression, mRNA cleavage] ), ( class: [Translation], subclass: [mRNA cleavage], length: [21], mechanism: [mRNA cleavage] ), ( class: [Translation], subclass: [mRNA], length: [21---22], mechanism: [mRNA cleavage] ), ( class: [Translation], subclass: [mRNA], length: [22---24], mechanism: [Histone and DNA modification] ), ) ) ) If you have a pair of paragraphs you would like to separate using an asterism, this template provides a set of asterisms and fleurons that are suited to this template. #lorem(20) #springer-spaniel.asterism.paragraph #lorem(120) = Subsection Heading If you want to list definitions or the like we recommend using the natively supported `description` element -- it will automatically rendered in line with the preferred layout. A noun is prefixed with #sym.slash and postfixed by a semicolon, follwed by the definition. / Type 1: That addresses central themes pertainng to migration, health, and disease. In @sec:2, Wilson discusses the role of human migration in infectious disease distributions and patterns. / Type 2: That addresses central themes pertainng to migration, health, and disease. In @sec:2, Wilson discusses the role of human migration in infectious disease distributions and patterns. If at any point you want to break to a new page, you can do so by calling `pagebreak()`. #pagebreak() #bibliography("sample.bib", style: "springer-mathphys")
https://github.com/SkiFire13/master-thesis
https://raw.githubusercontent.com/SkiFire13/master-thesis/master/preface/toc.typ
typst
#let extra-outline(title: none, target: none) = context { if query(target).len() != 0 { if query(target).any(it => it.caption == none) { panic("Figure without caption") } outline(title: title, indent: auto, target: target, fill: repeat([.])) } } #let toc() = page[ #[ #show outline.entry.where(level: 1): it => { show repeat: none v(12pt, weak: true) smallcaps(it) } #outline(title: [= Index] + v(.5em), indent: auto) ] #extra-outline(title: [= Index of figures] + v(.5em), target: figure.where(kind: image)) #extra-outline(title: [= Index of tables] + v(.5em), target: figure.where(kind: table)) ]
https://github.com/Jollywatt/typst-fletcher
https://raw.githubusercontent.com/Jollywatt/typst-fletcher/master/src/default-marks.typ
typst
MIT License
#import "deps.typ" #import deps.cetz.draw #let DEFAULT_MARKS = ( // all numbers are interpreted as multiples of stroke thickness head: ( size: 7, // radius of curvature sharpness: 24.7deg, // angle at vertex between central line and arrow's edge delta: 53.5deg, // angle spanned by arc of curved arrow edge tip-origin: 0.5, tail-end: mark => calc.min(..mark.extrude), tail-origin: mark => { let dx = calc.cos(mark.sharpness) + calc.cos(mark.sharpness + mark.delta) mark.tail-end - mark.size*mark.delta/1.8rad*dx }, stroke: (cap: "round"), draw: mark => { for flip in (+1, -1) { draw.arc( (0, 0), radius: mark.size, start: flip*(90deg + mark.sharpness), delta: flip*mark.delta, fill: none, ) } }, cap-offset: (mark, y) => { import calc: sin, sqrt, pow, cos, abs, max let r = mark.size let Ξ = mark.sharpness r*(sin(Ξ) - sqrt(max(0, 1 - pow(cos(Ξ) - abs(y)/r, 2)))) }, ), doublehead: ( inherit: "head", size: 10.56, sharpness: 19.4deg, delta: 43.5deg, ), triplehead: ( inherit: "head", size: 13.5, sharpness: 25.5deg, delta: 42.6deg, ), harpoon: ( inherit: "head", draw: mark => { draw.arc( (0, 0), radius: mark.size, start: -(90deg + mark.sharpness), delta: -mark.delta, fill: none, ) }, ), straight: ( size: 10, sharpness: 20deg, tip-origin: mark => 0.5/calc.sin(mark.sharpness), tail-origin: mark => -mark.size*calc.cos(mark.sharpness), fill: none, draw: mark => { draw.line( (180deg + mark.sharpness, mark.size), (0, 0), (180deg - mark.sharpness, mark.size), ) }, cap-offset: (mark, y) => calc.tan(mark.sharpness + 90deg)*calc.abs(y), ), solid: ( inherit: "straight", tip-origin: 0, tip-end: mark => -0.5/calc.sin(mark.sharpness), tail-end: mark => -0.5/calc.sin(mark.sharpness), stroke: none, fill: auto, ), stealth: ( size: 6, stealth: 0.3, angle: 25deg, tip-origin: mark => 0.5/calc.sin(mark.angle), tail-origin: mark => -mark.size*calc.cos(mark.angle) - 1, tip-end: mark => mark.size*(mark.stealth - 1)*calc.cos(mark.angle), stroke: (miter-limit: 20), draw: mark => { draw.line( (0,0), (180deg + mark.angle, mark.size), (mark.tip-end, 0), (180deg - mark.angle, mark.size), close: true, ) }, cap-offset: (mark, y) => if mark.tip { -mark.stealth/calc.tan(mark.angle)*calc.abs(y) } else { calc.tan(mark.angle + 90deg)*calc.abs(y) }, ), latex: ( size: 23, // radius of curvature sharpness: 10deg, // angle at vertex between central line and arrow's edge delta: 20deg, // angle spanned by arc of curved arrow edge tip-end: mark => mark.size*(calc.sin(mark.sharpness) - calc.sin(mark.sharpness + mark.delta)), tail-end: mark => mark.tip-end/2, tail-origin: mark => mark.tip-end, fill: auto, stroke: none, draw: mark => { for flip in (+1, -1) { draw.merge-path({ draw.arc( (0, 0), radius: mark.size, start: flip*(90deg + mark.sharpness), delta: flip*mark.delta, fill: none, ) draw.line((), ((), "|-", (0, flip*1e-1))) }) } } ), cone: ( size: 8, radius: 6, angle: 30deg, tip-end: mark => -mark.size, tail-end: mark => mark.tip-end/2, tail-origin: mark => mark.tip-end, stroke: none, draw: mark => { for flip in (+1, -1) { draw.merge-path({ draw.arc( (-mark.size, -flip*1e-1), radius: mark.radius, start: 0deg, stop: flip*mark.angle, ) draw.line((), (0, 0)) }) } } ), circle: ( size: 2, tip-end: mark => -mark.size, tail-end: mark => mark.size, tip-origin: mark => mark.size + 0.5, tail-origin: mark => -(mark.size + 0.5), fill: none, draw: mark => draw.circle((0,0), radius: mark.size, fill: mark.fill), cap-offset: (mark, y) => { let r = mark.size let o = r - calc.sqrt(calc.max(0, r*r - y*y)) if not mark.tip { o *= -1 } o }, ), square: ( size: 2, angle: 0deg, fill: none, tip-origin: mark => +(mark.size + 0.5)/calc.cos(mark.angle), tail-origin: mark => -(mark.size + 0.5)/calc.cos(mark.angle), tip-end: mark => -mark.size/calc.cos(mark.angle), tail-end: mark => +mark.size/calc.cos(mark.angle), draw: mark => { let x = mark.size draw.rotate(mark.angle) draw.rect( (-x, -x), (+x, +x), ) } ), diamond: ( inherit: "square", angle: 45deg, ), bar: ( size: 4.9, angle: 90deg, tail-origin: mark => calc.min(..mark.extrude), draw: mark => draw.line( (mark.angle, -mark.size), (mark.angle, +mark.size), ), cap-offset: (mark, y) => { let o = y*calc.tan(mark.angle - 90deg) // if mark.tip { o *= -1 } -o }, ), cross: ( size: 4, angle: 45deg, draw: mark => { draw.line((+mark.angle, -mark.size), (+mark.angle, +mark.size)) draw.line((-mark.angle, -mark.size), (-mark.angle, +mark.size)) }, cap-offset: (mark, y) => calc.tan(mark.angle + 90deg)*calc.abs(y), ), hook: ( size: 2.88, rim: 0.85, tip-origin: mark => mark.size + 0.5, stroke: (cap: "round"), draw: mark => { draw.arc( (0,0), start: -90deg, stop: +90deg, radius: mark.size, fill: none, ) draw.line((), (rel: (-mark.rim, 0))) }, ), hooks: ( inherit: "hook", draw: mark => { for flip in (-1, +1) { draw.arc( (0,0), start: -flip*90deg, stop: +flip*90deg, radius: mark.size, fill: none, ) } }, ), ">": (inherit: "head", rev: false), "<": (inherit: "head", rev: true), ">>": (inherit: "head", extrude: (-2.88, 0), rev: false), "<<": (inherit: "head", extrude: (-2.88, 0), rev: true), ">>>": (inherit: "head", extrude: (-6, -3, 0), rev: false), "<<<": (inherit: "head", extrude: (-6, -3, 0), rev: true), "|>": (inherit: "solid", rev: false), "<|": (inherit: "solid", rev: true), "}>": (inherit: "stealth", rev: false), "<{": (inherit: "stealth", rev: true), "|": (inherit: "bar"), "||": (inherit: "bar", extrude: (-3, 0)), "|||": (inherit: "bar", extrude: (-6, -3, 0)), "/": (inherit: "bar", angle: +60deg, rev: false), "\\": (inherit: "bar", angle: -60deg, rev: false), "x": (inherit: "cross"), "X": (inherit: "cross", size: 7), "o": (inherit: "circle"), "O": (inherit: "circle", size: 4), "*": (inherit: "circle", fill: auto), "@": (inherit: "circle", size: 4, fill: auto), "[]": (inherit: "square"), "<>": (inherit: "diamond"), // crow's foot notation crowfoot: ( many-width: 5, many-length: 8, one-width: 5, zero-width: 3.5, gap: 3, first-gap: 5, many: true, one: true, zero: true, tail-origin: mark => -mark.many-length, zero-fill: white, fill: none, draw: mark => { let x = 0 if mark.many { draw.line((0, mark.many-width), (-mark.many-length - .5, 0), (0, -mark.many-width)) x -= mark.many-length } if mark.one { x -= mark.gap x = calc.min(x, -mark.first-gap) draw.line((x, mark.one-width), (x, -mark.one-width)) } if mark.zero { x -= mark.gap draw.circle((x - mark.zero-width, 0), radius: mark.zero-width, fill: mark.zero-fill) } } ), "n": (inherit: "crowfoot", zero: false, one: false, many: true), "n!": (inherit: "crowfoot", zero: false, one: true, many: true), "n?": (inherit: "crowfoot", zero: true, one: false, many: true), "1": (inherit: "crowfoot", zero: false, one: true, many: false), "1!": (inherit: "crowfoot", zero: false, one: true, many: false, extrude: mark => (0, -calc.max(4, mark.gap))), "1?": (inherit: "crowfoot", zero: true, one: true, many: false), ) #let MARKS = state("fletcher-marks", DEFAULT_MARKS)
https://github.com/qianxi0410/cv.typ
https://raw.githubusercontent.com/qianxi0410/cv.typ/master/main.typ
typst
MIT License
#import "template.typ": * // 加蜜数据 #let data = toml("main.toml") #let (name, email, phone, website, birthday, avatar) = data.cv; #show: cv.with( name: name, email: email, phone: phone, website: website, birthday: birthday, avatar: avatar ) #educations(data.educations) #projects(data.projects) #internships(data.internships) #awards(data.awards) #skills(data.skills)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/013%20-%20Magic%202015/001_Beast.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Beast", set_name: "Magic 2015", story_date: datetime(day: 18, month: 06, year: 2014), author: "<NAME>", doc ) #emph[Garruk Wildspeaker was once deeply in touch with nature, a potent beastcaller, and master of green magic...until the necromancer <NAME> cursed him using the dangerous artifact known as the Chain Veil. Suffused with black mana and cut off from the voice of the wild, Garruk became a feral killer with only one goal: find Liliana and make her reverse what she had done.] #emph[Garruk tracked Liliana to the world of Innistrad, where they again faced off. Liliana gained the upper hand long enough to get away. In the aftermath of that battle, driven half-mad by the Veil's curse, Garruk faces a crucial moment of decision...] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) I wake up and open my eyes. The air reeks of death and undeath. The witch's scent is in there somewhere, but it's faint. I'm prone, half-submerged in water. The cries of carrion birds ring in my ears. Everything hurts. A stinking black bird lands on my chest. I grab it with both hands, snap its neck, and throw it. Its corpse makes a splash. I inhale a lungful of moldy air and sit up. I'm in a swamp, at night. The marsh around me is littered with birds feasting on hacked-up pieces of things once undead. There's no light, but I can see in the dark. #figure(image("001_Beast/01.jpg", width: 100%), caption: [Swamp | Art by <NAME>], supplement: none, numbering: none) The remains of the witch's servants surround me. I killed them. She nearly killed me. Where is she? Where is my axe? There's a long thin shape under the water next to me. I reach in and my hand closes around a wooden shaft. I pull my axe out of the swamp and lean it against a fallen log. Carrion birds around me scatter, alighting in the trees above. Exhaustion hits me again, and I'm back inside my room at the last inn I slept at, weeks ago. The fallen log is the bed, but no beds are large enough for me. I lie down on the floor, and sink again into the muck. A beast as tall as me and as wide as it is tall approaches me and sniffs my still form. It smells mostly right, but there's decay underneath, the same as what's always coming off of me now. Under its fur, its skin is shot through with black veins, just like mine. I summoned it during the fight with the witch. #figure(image("001_Beast/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) I raise my head to look at it. It jumps back, then winces as it lands on its back legs. It makes a rumbling growl, and when it speaks, it is the innkeeper, trembling with fear. "You scare the other patrons," he says. "You can't stay here again tonight." He's not sure he could take me in a fight, but the desperation in his posture says he might try. He edges backward, slightly, and almost chirps. "They say there's a pack of werewolves around here that tries to do good despite their curse." He just wants me gone. "You should look for them. They only take in the strong, though. They kill the weak." "Do I look weak to you?" I snarl. "No, sir," he snorts. He turns and limps out of my room, splashing with each step. More splashing noises come from the opposite direction now. They are slower, and louder, and a wave of rotted air rolls over me. I sit up again. I'm outside the inn, and the thick clusters of trees are buildings huddled together in the tiny town. There's a huge mass of bloated corpses, a little bigger than the beast I was talking to, coming right for me. #figure(image("001_Beast/03.jpg", width: 100%), caption: [Skaab Goliath | Art by Volkan Baga], supplement: none, numbering: none) The birds scatter with an explosion of noise. "Stitcher attack!" they cry, as they fly away. "Save the children!" If it wants to kill the townsbirds, it'll have to kill me first. I stand up, pulling myself up with the axe. I'm still bleeding from cuts on my arms. A few of them ooze black. My back hurts when I stand straight, but I have enough strength to take this thing. And if I don't, I'll die. I was probably dying out here anyway. I charge it, screaming. It's a ball of human corpses, maybe five feet across, with another corpse as each of its three legs and two arms, and a pitted rotten wolf embedded into it on top where a head should be. My axe slices into the thing's shoulder with a wet sound. One of the wolf's legs flops freely where I severed it from the body. Its left arm comes around to rake me with glistening silver claws, but my axe's impact pushes the thing back six inches. It only makes a surface scratch. I pull my axe out. Its right arm is coming for me, but I duck inside its range and turn the axe into its upper arm, which is a fused pair of human legs. I make a deep cut, and its claws miss me, but its left arm is coming back around and I'm stuck. The thing jerks left, off of my axe, and falls on its side into the muck with a big splash. My beast is there, head lowered, short tusks now covered in glistening black. I'm soaked, but my axe is free. I raise it and bring it down across the thing's shoulders, slicing the rotted wolf's corpse off the top. The whole thing shudders and stops moving. No more bird children will fall to this monstrosity. The beast rumbles up to me, slowly, and makes a low groan. Now it's Pavel, the werewolf who leads the pack the innkeeper told me about. "I'm Pavel," he says. "We're all werewolves. You're...something else...but we're hunting the stitcher who did this. She's tough, and we could use your help. Want to come with?" He can help me find the witch. "Where?! Where is she!?" I grab him by the tusks and scream into his face. He steps backward, haltingly. I move with him. He snarls. "You need to show more control than this, or we'll kill you, too." His tiny eyes glisten with a little sympathy and a lot of calculation. I let go of his tusks and stand as tall as I can despite the pain. "You could try." He rests back on his haunches, no longer threatened, and almost purrs. "I hope we won't have to. Come with me." He turns his back and lumbers into the blackness of the swamp. I totter along behind him. We walk in silence for a while. He twists and turns through the forest, seemingly at random. A few times, we recross our path. "Where are we going?" He rumbles a low growl. "We live far away from civilization, where our condition cannot harm anyone but ourselves. The others will not accept you immediately; you will have to earn their trust." "But you kill stitchers." Pavel turns his head to face me as we walk, and grunts. "We kill zombies. We do not kill sentient creatures. We disable them, and leave them with the proper authorities." He turns his head back to the path before us. "If you insist on killing your prey, you will not be allowed to remain with us." I hear an elk cry nearby. My stomach rumbles. "Wait here." I pace away until I can't hear Pavel anymore, climb ten feet into a tree, and watch. It's coming this way. I stand on the branch, ready my axe, and wait. #figure(image("001_Beast/04.jpg", width: 100%), caption: [Dawntreader Elk | Art by <NAME>], supplement: none, numbering: none) The elk walks right under me. I drop off of the branch, and the flat of my axe slams into the back of its head as I land. Its corpse falls sideways and lands in the muck with a dull splash. I pull it onto a dry embankment. It smells clean, just like I don't. I pull my knife, cut a long vine from one of the trees, hang the elk by its horns, and open it from hip to neck. Dripping blood collects underneath the corpse, first pooling and then draining off into the swamp. I reach in, hold the bladder closed, slice it out, and drop it into the water. The intestines go into the muck next with a plop and a slurp. Pavel limps up to me again, purring, as I pull out the elk's liver. "Your hunting has been invaluable to us. We would have starved without you. We have decided that you can stay." I toss the liver to him, and he snatches it out of the air with his muzzle. I'm starving, and the meat smells amazing, but Pavel is probably hungry too. I cut off three ribs, skin and all, and toss the chunk toward him. "So when do we go stitcher hunting?" "Tonight," he says before ripping a piece off the hunk of dead elk. I skin the rest of it, cut off a rib, and tear into a chunk of meat myself. It tastes incredible. We finish the elk between the two of us with ease. He lays down on all fours, and groans when his stomach hits the ground. I lay down on my back. We share a long moment, each of us resting and breathing in the swamp, as we digest my kill. #figure(image("001_Beast/05.jpg", width: 100%), caption: [Garruk's Packleader | Art by <NAME>], supplement: none, numbering: none) I sit up, bored. "So where is she?" He looks at me, irritated, and grunts. "We don't know exactly. Somewhere near Gatstaf, probably on the way to Gavony." "I'll find her." I stand up and shoulder my axe. "Be careful," he says. "Any stitcher worth her salt will have guardians. You should not face them alone." I turn away. "And if you kill her," he groans, "you will not be allowed to return. We are not beasts." I pace away from him into the woods. I wander through the swamp, looking for any sign of her. I sniff the ground occasionally, but I can't make out her scent over my own. There's something on a branch over there. I approach, and find a ripped piece of purple silk. I hold it to my nose and inhale. It's her. I put it into a pouch on my belt, crouch, and sniff. There it is. It's faint, but she must have come this way. There are broken branches over there, too, cracked by human feet. Small, just like hers are. I take five paces and sniff the ground again. Still there. Fifteen more and another sniff of the ground, and I know I've got her. Her trail takes me through the swamp, dodging over trees and around pools of standing water. Had she gone through them, she might have lost me, but who knows what's lurking under the surface? Some swamp creature might have eaten her. She'll be dead anyway after I smash the back of her skull in. Just when I think I'm getting close, deep footsteps rumble slowly toward me, maybe two hundred feet away. I pad into a pool of water mostly covered in plants and drop onto my haunches until only my head is exposed, and even that is covered by foliage. A rotting beast comes into view, its skin all shot through with black, and its gaping maw and tusks dripping fresh blood. It reeks of death magic. It pants, breathing heaving breaths, legs trembling. It sniffs around, but doesn't see me behind the leaves. The stitcher's guardian. Poor thing. Whoever did this to you deserves to die. I sit still, and it rumbles past me without even a glimpse in my direction. Ten minutes later, I creep out of the pool, half-covered in thin green vines. I shake most of them off and keep following the trail. After another five minutes, I hear slow and heavy footsteps a hundred feet behind me. I turn, and there's the stitcher. It's not the witch—it's huge, green with black veins, maybe nine feet tall and nine feet wide, and has gleaming black tusks. I expected a woman, at least, and smaller, but I guess this is what necromancers look like here. She'll die all the same. I charge. She just sits down, and watches me as I come, probably waiting to surprise me. I wind up with my axe as I approach, and she still just sits there. Her eyes go wide as the blade sinks into her skull, and she drops onto her stomach with a wet crunch and a squeal. She flails for a second or two, and then dies. Pavel's words run through my head again. "We are not beasts." Maybe #emph[they] aren't. A white light flashes in the distance, illuminating the horizon, and then reaching all the way to the sky. We all watch it as it rolls toward us, brighter and brighter as it comes. Then it washes over us, and all I see is white. #figure(image("001_Beast/06.jpg", width: 100%), caption: [], supplement: none, numbering: none) I'm standing in a swamp, over a dead beast. It smells fresh. From the black veins on its skin, I must have summoned it. From the axe wound in its head, I must have killed it. It is only a beast. Not the innkeeper, not Pavel, not the stitcher's guardian, not even the stitcher. I can't see in the dark anymore, but I can see color, and I smell normal now. The sun is starting to come up. I flex my right arm. The black veins are gone, and I am strong, as strong as I was before. I take a deep breath, and let loose a roar. It echoes throughout the swamp. Birds scatter, and do not speak as they fly away. I'm on #emph[Innistrad] , in some swamp. The witch almost killed me. And her curse is gone. What did she do to me? How far gone was I? An overwhelming wave of nausea hits me as my vision goes black and white again. I drop to my knees, clutch a thick branch on a fallen tree with black-laced hands, and vomit. By the time the retching stops, half the elk I ate is on the ground in front of me. I feel a little better, but the curse is back. And I am very tired. #figure(image("001_Beast/07.jpg", width: 100%), caption: [Garruk, the Veil-Cursed | Art by <NAME>s], supplement: none, numbering: none) I sniff the air. The witch's scent is still here, mixed in with the half-digested elk, and one of her footprints is right there in front of me. I keep following the trail, now supporting myself with the axe. Twenty minutes of tracking takes me to a road. I emerge from the swamp, blinking in the breaking dawn. The road extends as far as I can see in both directions. The blinding light came from the right, where the sun is rising now. It was enough to cure me, if only for a moment. I don't know what it was, but it was powerful. It is the only thing that has ever helped. If I had been closer, would it have saved me? If I found the source, I could be free. I could stand tall, walk straight, call healthy creatures to my side. I could stop hunting her. What would I do instead? I have hunted her for so long. What did I do before? I look to my left, and see a broken branch. I crouch down to it and sniff, and a growl rumbles in my gut. It's her. I may not get another chance at a cure. If I leave the light behind, I'll have to kill her before I lose myself again. If I follow the light, though, I'll lose the trail. I sniff the ground again. She's still there, and it's fresh enough to follow. I turn to my left, away from the blinding dawn, and begin to walk. #figure(image("001_Beast/08.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/goto_definition/import_star_variable.typ
typst
Apache License 2.0
// path: variable.typ #let x = 2; ----- . #import "variable.typ": * #(/* position after */ x);
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/36.typ
typst
#import "../conf.typ": * = ИМтегральМая фПрЌула КПшО. РазлПжеМОе фуМкцОО регулярМПй в ПкрестМПстО тПчкО в ряЎ ТейлПра. == ИМтегральМая фПрЌула КПшО. #theorem[_ЀПрЌула КПшО Ўля круга_ Пусть f гПлПЌПрфМа в D, $overline(O_rho (a)) in D$ тПгЎа #eq[$ f(z) = 1/(2 pi i) integral_(abs(zeta - a) = rho) (f(zeta)) / (zeta - z) d zeta $] ] #proof[ В сОлу $overline(O_rho (a)) in D => exists R > rho: space O_R (a) in D$. ЗафОксОруеЌ $z in O_rho (a)$ РассЌПтрОЌ слеЎующую фуМкцОю #eq[$ g(zeta) = cases((f(zeta) - f(z)) / (z - zeta) \, zeta != z, f'(z) \, z = zeta) $] ОМа уЎПвлетвПряет услПвОяЌ усОлеММПй ЛеЌЌы Гурса, слеЎПвательМП #eq[$ 0 = integral_(abs(zeta - a) = rho) g(zeta) d zeta = integral_(abs(zeta - a) = rho) (f(zeta)) / (zeta - z) d zeta - integral_(abs(zeta - a) = rho) (f(z)) / (zeta - z) d zeta = integral_(abs(zeta - a) = rho) (f(zeta)) / (zeta - z) d zeta - f(z) integral_(abs(zeta - a) = rho) (d zeta) / (zeta - z). $] ОбПзМачОЌ $G(z) = integral_(abs(zeta - a) = rho) (d zeta) / (zeta - z)$. ОМа гПлПЌПрфМа в ПбластО как ОМтеграл КПшО. $G' = integral_(abs(zeta - a) = rho) (d zeta) / (zeta - z)^2 equiv 0$ СлеЎПвательМП $G(z) = "const" = G(a) = 2 pi i$ ОтсюЎа эелеЌеМтарМП пПлучОЌ требуеЌПе. ] #note[ЀПЌулОрПвку Ўля бПлее ПбщегП случая сЌПтрО в прПшлПЌ бОлете] == РазлПжеМОе фуМкцОО регулярМПй в ПкрестМПстО тПчкО в ряЎ ТейлПра. #theorem[ Пусть $f$ - гПлПЌПрфМая в $D$, $O_R (a) subset D$, тПгЎа #eq[$forall z in O_R (a): f(z) = sum_(n=0)^(infinity) c_n (z-a)^n, space c_n = (f^((n))(a)) / n! $] ] #proof[ ВПзьЌеЌ $0 < r < R$, тПгЎа $f$ гПлПЌПрфМа в $overline(O_r (a))$. ТПгЎа пП теПреЌе КПшО $2 pi i space f(z) = integral_(gamma_r) (f(xi) d xi) / (xi - z)$. РаспОшеЌ #eq[ $1 / (xi - z) = 1 / ((xi - a) - (z - a)) = 1 / ((xi - a)) dot.op 1 / (1 - (z - a) / (xi - a)) =^((|z-a| < |xi - a|)) = 1 / (xi - a) sum_(n = 0)^infinity ((z-a)/(xi-a))^n = sum_(n = 0)^infinity (z-a)^n/(xi-a)^(n+1)$ ] ППлучеММый ряЎ схПЎОтся равМПЌерМП, а зМачОт ЌПжМП пПчлеММП ОМтегрОрПвать. $2 pi i space f(z) = integral_(gamma_r) f(xi) / (xi - z) d xi = sum_(n = 0)^infinity integral_(gamma_r) f(xi) (z-a)^n/(xi-a)^(n+1) d xi = sum_(n=0)^(infinity) 2 pi i c_n (z-a)^n$ ПрОчеЌ пП слеЎтвОю фПрЌулы КПшО Ўля круга, $2 pi i dot.op c_n = (f^((n)) (a)) / n!$ Ну раз верМП Ўля любПгП $r < R$, тП О Ўля $R$ верМП. ]
https://github.com/RaphGL/ElectronicsFromBasics
https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap4/6_scientific_notation_in_spice.typ
typst
Other
=== Scientific notation in SPICE The SPICE circuit simulation computer program uses scientific notation to display its output information, and can interpret both scientific notation and metric prefixes in the circuit description files. If you are going to be able to successfully interpret the SPICE analyses throughout this book, you must be able to understand the notation used to express variables of voltage, current, etc. in the program. Let\'s start with a very simple circuit composed of one voltage source (a battery) and one resistor: #image("static/00079.png") To simulate this circuit using SPICE, we first have to designate node numbers for all the distinct points in the circuit, then list the components along with their respective node numbers so the computer knows which component is connected to which, and how. For a circuit of this simplicity, the use of SPICE seems like overkill, but it serves the purpose of demonstrating practical use of scientific notation: #image("static/00080.png") Typing out a circuit description file, or #emph[netlist], for this circuit, we get this: ```netlist simple circuit v1 1 0 dc 24 r1 1 0 5 .end ``` The line \"`v1 1 0 dc 24`\" describes the battery, positioned between nodes 1 and 0, with a DC voltage of 24 volts. The line \"`r1 1 0 5`\" describes the 5 Ω resistor placed between nodes 1 and 0. Using a computer to run a SPICE analysis on this circuit description file, we get the following results: ```table node voltage ( 1) 24.0000 ``` ```table voltage source currents name current v1 -4.800E+00 total power dissipation 1.15E+02 watts ``` SPICE tells us that the voltage \"at\" node number 1 (actually, this means the voltage between nodes 1 and 0, node 0 being the default reference point for all voltage measurements) is equal to 24 volts. The current through battery \"v1\" is displayed as -4.800E+00 amps. This is SPICE\'s method of denoting scientific notation. What its really saying is $-4.800 times 10^0 "amps"$, or simply -4.800 amps. The negative value for current here is due to a quirk in SPICE and does not indicate anything significant about the circuit itself. The \"total power dissipation\" is given to us as 1.15E+02 watts, which means $1.15 times 10^2 "watts"$, or 115 watts. Let\'s modify our example circuit so that it has a 5 $k Omega$ (5 kilo-ohm, or 5,000 ohm) resistor instead of a 5 $Omega$ resistor and see what happens. #image("static/00081.png") Once again is our circuit description file, or \"netlist:\" ```netlist simple circuit v1 1 0 dc 24 r1 1 0 5k .end ``` The letter \"k\" following the number 5 on the resistor\'s line tells SPICE that it is a figure of $5 k Omega$, not $5 Omega$. Let\'s see what result we get when we run this through the computer: ```table node voltage ( 1) 24.0000 ``` ```table voltage source currents name current v1 -4.800E-03 total power dissipation 1.15E-01 watts ``` The battery voltage, of course, hasn\'t changed since the first simulation: its still at 24 volts. The circuit current, on the other hand, is much less this time because we\'ve made the resistor a larger value, making it more difficult for electrons to flow. SPICE tells us that the current this time is equal to $-4.800E-03$ amps, or $-4.800 times 10^-3$ amps. This is equivalent to taking the number -4.8 and skipping the decimal point three places to the left. Of course, if we recognize that $10^-3$ is the same as the metric prefix \"milli,\" we could write the figure as -4.8 milliamps, or -4.8 mA. Looking at the \"total power dissipation\" given to us by SPICE on this second simulation, we see that it is $1.15E-01$ watts, or $1.15 times 10^-1$ watts. The power of -1 corresponds to the metric prefix \"deci,\" but generally we limit our use of metric prefixes in electronics to those associated with powers of ten that are multiples of three (ten to the power of . . . -12, -9, -6, -3, 3, 6, 9, 12, etc.). So, if we want to follow this convention, we must express this power dissipation figure as 0.115 watts or 115 milliwatts (115 mW) rather than 1.15 deciwatts (1.15 dW). Perhaps the easiest way to convert a figure from scientific notation to common metric prefixes is with a scientific calculator set to the \"engineering\" or \"metric\" display mode. Just set the calculator for that display mode, type any scientific notation figure into it using the proper keystrokes (see your owner\'s manual), press the \"equals\" or \"enter\" key, and it should display the same figure in engineering/metric notation. Again, I\'ll be using SPICE as a method of demonstrating circuit concepts throughout this book. Consequently, it is in your best interest to understand scientific notation so you can easily comprehend its output data format.
https://github.com/alberto-lazari/computer-science
https://raw.githubusercontent.com/alberto-lazari/computer-science/main/dim/notes.typ
typst
#import "@local/unipd-doc:0.0.1": * #show: notes() #show: unipd-doc( title: [Digital and Interactive Multimedia], subtitle: [Notes], author: [<NAME>], date: [I Semester A.Y. 2023-2024], ) = Presentation == Outline + 3d vision and acquisition + Lab + 3d processing + Seminar? + Lidar and automotive + VR + AR + SLAM + Seminars == Exam Two parts: + 2 open questions (10 pts each) + 10 multiple choice (1 pt each) Dates: - Jan 22 12:30 - Feb 07 12:00 / Multimedia: Multiple types of media combined (audio, video, text, ...) = Media types == Image Images can be formed by combining: - Illuminance: $i(x, y)$ - Reflectance: $r(x, y)$ == Video - Fast sequence of single images - At least 25 fps to see motion, because of retina's persistence phenomenon = 3D Perception 3 different ways to perceive: - Oculomotor (binocular vision) - Static visual - Motion == Oculomotor cues - Accomodation: changes in focal aperture in the crystalline - Vergences: movements of the eyes to merge the two images == Visual cues Features of images that allow to create a 3D (static) perception: - Occlusions - Relative dimensions: far $->$ small, close $->$ big - Textures - Linear perspective: straight lines in perspective - Aerial perspective: fog in the far distance - Shadows == Motion Also motion can create 3D perception of a (2D) video: - Motion parallax - Relative angular velocity: far objects appear slower - Radial expansion - Shadow movement = Binocular vision Requires: + Simultaneous perception: two images in both eyes + Fusion: - Motor: accomodation + vergence - Sensory: create single image + Stereopsis: interpret two images add 3D perception to the fused image / Horopter: area where points don't produce duplicate images (Panum area) #lecture[3 -- 10/10] = 3D media Technologies are divided in: - Passive - Active w.r.t. the viewer == Passive 3D rendering - Lens arrays (3D cards) - Parallax occlusion: bands with holes, similar to lens (3DS?) - Anaglyph: red/blue glasses (colors are off, though) - Dolby 3D: slightly different colors per eye (requires wheel on projector and double the frame-rate) - Polarized light: need to stay still and not rotate head - Circular polarization: it needs: - Two projectors with polarizers - Special silver reflective screen - Glasses == Active 3D Example: Nvidia glasses, alternate shutters = Stereo images - Disparity map shows intensity of parallax effect between two images (two eyes) - Stereo images have to be rectificated #sym.arrow point the object in focus #lecture[4 -- 31/10] = Camera parameters - Intrinsic: depend on the camera itself - Extrinsic: camera location/orientation = Features Feature recognition can be useful for: - Camera calibration - Stereo image creation - Tracking - Image mosaicing They have to be invariant to: - Illumination - Scale - Rotation - Affine (similarity, slight changes) - Perspective projection == SIFT algorithm Used for feature recognition (ex, for image matching) #lecture(5) == Direct Linear Transform (DLT) Infer the 11 parameters (5 intrinsic + 3 rotations + 3 translations) from image. At least 6 points are needed #lecture(9) = 3D reconstruction == Rectification Make the image rows match with epipolar lines == Point clouds Set of points in the space. Provides information for each point about: - Geometry: position - Color, reflectance, ... (optional) = Camera arrays Possible applications: - HDR - Higher resolution - Tiled panoramas - Synthetic aperture photography: show subjects partially hidden behind occluders - Hybrid aperture photography: mix various apertures in the same image (ex light fields) == Light fields Use microlens arrays to merge various point of views, apertures and focus in a same image, allowing for post-processing access of those informations #lecture(10) = VR / VR experience: the user feels *immersed* in a *responsive* virtual world #sym.arrow dynamic control of view point == Immersion VR is immersive because of: + Stereovision, provided by *headset* + Dynamic control of viewpoint + Surrounding experience Can also provide: - Various Degrees Of Freedom (DOF) - Interaction with controllers - Aptic feedback == Navigation - Controller/keyboard/joystick: more nausea-prone - Teleporting (movement has to be not too quick) - Threadmills #lecture(11) = 360 images Acquisition with: - Multiple cameras - Catadioptric: reflection on curved mirrors - Fish-eye lens Sphere construction needs: - Multiple cameras (can't acquire the whole sphere) - Stitching == Sphere representations How to represent a sphere on a flat topology? - Equirectangular projection: geographical maps' method Great distortions and low algorithms performance - Cube map: good performances + natural images, but artifacts - Pyramid projection: lots of discontinuities, but clear center (pyramid basis). Useful for streaming #lecture(13) = Quality of Experience How to objectively measure it? == Saliency maps Interesting regions, that catch user's attention and focus Can be generated with: - Bottom-up approaches: ex Gabor filters, based on feature detection - Top-down ones == 360 content Rendering can be done either: - Client-side: requires full video streaming (90% of the FOV is disregarded) and processing - Server-side: render and stream only necessary parts #sym.arrow reduce bandwidth. Can be done with: - Two-tier streaming: parallel stream of base, low-res video + HD viewport area. Bad performance, because two streams compete for resources - Viewport-adaptive streaming: more versions for different possible viewports. Requires server-side storage - Tile-based streaming: sphere divided in tiles, to be streamed - at different resolutions (full delivery) - possibly not streamed at all (partial delivery, bad QoE) Predict head movements with saliencies #lecture[14 -- Seminar] = Immersive media compression Point clouds are difficult to compress: sparse, irregular... #sym.arrow quantize (voxelize) Then just use #underline[_*AI*_] to reconstruct: - Uses 3D convolutional neural network - Works perfectly for dense point clouds, not so much on sparse ones - Works on static point clouds (models, not animations/videos) Alternatively use graph-based solutions: - No voxelization - Results are too smooth - Point properties difficult to compress (color) #lecture(17) = Objective evaluation (QoS) Image quality assessment: compare and provide evidence of improvement Subjective tests are too complicated, expensive, difficult... == Full reference Requires a reference of the original picture (?) - PSNR/MSE: not consistent with human perception (blur looks not destructive) - SSIM $in [0, 1]$: improvement, measures similarity between two images. It compares luminance - VMAF $in [0, 100]$: for video == Reduced reference Uses feature extraction == No reference Brisque and NIQE (lower is better) = QoE Depends on many factors: - Technological - Multi-sensory - Emotions (frustration, surprise) #lecture(18) = Subjective assessment Most reliable way of measuring multimedia quality In order to be reliable needs: - Large number of users (at least 15, screened for visual acuity) - Description of: + Laboratory equipment: screen, distance, illumination, ... + Data set: contents used + Methodology: rating target (quality, comparison, impairment) and scale, stimuli (single/double) + Score processing: mean, outlier detection, ... - Introduction to method, training sequence. Consider a break after that (to answer questions) - No more than 30 mins sessions / Spatial Information (SI): complexity in image (spatial detail present) / Temporal Information (TI): frequency of changes in video == Learning effect Calibrate time to balance: - Training: user becomes more sensitive - Tiredness: user becomes less sensitive Control it by: - Showing full range of stimuli (SI/TI) - Short sessions - Pay participant - Randomize stimuli == Methods - Single-Stimulus/Absolute Category Rating (SS/ACR): single image at a time, index of presentation - ACR with Hidden Reference (ACR-HR): a picture is secretly a reference. Differential MOS between scores (against the reference) - Double-Stimulus Impairment Scale (DSIS): rate degradation of image, given a non-impaired reference (first, then the other is showed) - Double-Stimulus Continuous Quality-Scale (DSCQS): two images, one is reference (don't know which). Vote on whole presentation, on vertical scale. Results are to be considered as differences from reference - Single-Stimulus Continuous Quality Evaluation (SSCQE): continuously rate video quality, with slider - Simultaneous Double-Stimulus for Continuous Evaluation (SDSCE): continuously rate side-by-side video, knowing which is reference - Subjective Assessment of Multimedia Video Quality (SAMVIQ): various different sequences, with explicit and hidden references. User can go backward etc... - Pair-wise Comparison (PC): two videos, one after other. Select the best - Simulator Sickness Questionnaire (SSQ): 360° video, 0-3 rating. At least 28 subjects, no more than 25 continuous mins, no more 50 rating mins. < 1.5 h participation === Comparison - Methods that use explicit references measure fidelty (DSIS) - ACR is easier to implement - ACR-HR is even better, because it only considers the difference between the reference (no bias towards specific pictures) - PC can be used as a last resort for the items that have the same rating (direct comparison, 1v1) === Designs Need to show all pairs to compare: - Full design: $O (n^2)$ - Reduced design: assume transitivity + make sorting algorithm: test becomes human merge sort $O (n dot log n)$ == MOS process / Mean Opinion Score (MOS): average observer rate / Standard deviation: $display( s = sqrt(1 /n sum_(i = 0)^N (x_i - m)^2) )$, where $N$: sample size, $m$: mean / Standard error: $display( "SE" = s / sqrt(N) )$ / Confidence Interval: $"ci" = m plus.minus 0.95 dot "SE"$ 95% probability that user's average is within confidence interval == Crowdsourcing Alternative method, ask people from internet, under compensation: - No controlled environment #lecture(22) = Augmentation/Mediation / Augmentation: amount of virtual content on top of real world Examples: - Information overlay - Spatial anchor of virtual objects / Mediation: change surroundings Examples: - Beautification - Diminished reality == AR - Strong AR: full surroundings knowledge (precise tracking, semantic understanding) - Weak AR: little tracking/interaction Technological solutions: - Marker-based AR: very precise tracking, if light conditions are good. When no marking the experience disappears - Marker-less AR: more flexible, might not be suitable for the experience (not enough space/does not make sense) - Location-based AR: Google Maps, not always accurate, because of technologies/sensors === SLAM algorithm Combine visual + inertial sensors to: - Create map of environment - Continuously position device System: + Sensors + Front-end: feature extraction of real environment + Back-end: localize POV, reconstruct model, analyze frames + Estimate: reconstruction of environment, with locations of features + POV 3D maps are usually meshes
https://github.com/khalilhannechi/labs
https://raw.githubusercontent.com/khalilhannechi/labs/main/Lab-4.typ
typst
#import "Class.typ": * #show: ieee.with( title: [#text(smallcaps("Lab #4: ROS2 using RCLPY in Julia"))], authors: ( ( name: "<NAME>", department: [Senior-lecturer, Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "a-mhamdi", ), ( name: "<NAME>", department: [Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "khalilhannechi", ), ( name: "<NAME> ", department: [Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "azizchaiebc", ), ) // index-terms: (""), // bibliography-file: "Biblio.bib", ) . Introduction: This lab consists of two parts: "Application" and "Clarification." In the first part, we'll utilize Julia REPL to implement ROS2 codes as depicted in Figure 1. The second part involves explaining each command and its function in detail. #figure( image("Images/REPL.png", width: 100%, fit: "contain"), caption: "Julia REPL" ) <fig:repl> #test[in this lab i can't simulate ROS2 with my laptop for that i'm gonna use the simulation picture in Images/ infodev folder] = Application First, we'll begin by installing ROS2. Then, we'll proceed by sourcing our ROS2 installation as follows: ```zsh source /opt/ros/humble/setup.zsh ``` .Secondly, we'll open a Julia terminal and write down the codes below. Alternatively, we can directly open them from our folder "infodev/codes/ros2" #rect(fill: yellow)[The first programme is the publisher code ] #let publisher=read("../Codes/ros2/publisher.jl") #let subscriber=read("../Codes/ros2/subscriber.jl") #raw(publisher, lang: "julia") #rect(fill: yellow)[The second programme is the subscriber code] After writing both programs, we'll execute each in separate terminals. Subsequently, the subscriber will listen to the message broadcasted by the publisher. #raw(subscriber, lang: "julia") . To initiate the graphical tool rqt_graph and establish data flow between the publisher and subscriber, we must connect both to a node named "infodev," as illustrated in Figure 2. This is accomplished by executing the following lines of code: ```zsh source /opt/ros/humble/setup.zsh rqt_graph ``` #figure( image("Images/rqt_graph.png", width: 100%), caption: "rqt_graph", ) <fig:rqt_graph> . After linking the publisher and the subscriber, the publisher will transmit the designated message one hundred times to the node associated with the subscriber.. #rect(fill:aqua)[[Info [TALKER] Hello, ROS2 from Julia!(1...100)]] then the subscriber will respond, in the node ,by #rect(fill:aqua)[[ Info [LISTNER] I heard Hello, ROS2 from Julia!(1...100) ]] as in figure 3 #figure( image("Images/pub-sub.png", width: 100%), caption: "The communication between the publisher and the subscriber unfolds as follows", ) <fig:pub-sub> @fig:topic-list shows the current active topics, along their corresponding interfaces. /* ```zsh source /opt/ros/humble/setup.zsh ros2 topic list -t ``` */ #figure( image("Images/topic-list.png", width: 100%), caption: "List of topics", ) <fig:topic-list> //#test[Some test] = Clarafication : - in this part we gonna explain each code line and we gonna start with the pulisher code first : #rect(fill:yellow)[The First programme is the spublisher code] ```zsh using pycall ``` This package can come in handy when you aim to make use of Python's extensive libraries or integrate Python-specific features into your Julia codebase. ```zsh ##Import the rclpy module from ROS2 Python rclpy = pyimport("rclpy") ``` In Julia, you can leverage PyCall to import the 'rclpy 'module from Python. rclpy serves as a Python client library for the Robot Operating System (ROS) 2. ```zsh str = pyimport("std_msgs.msg") ``` import the std_msgs.msg module from ROS 2 into Julia ```zsh rclpy.init() ``` Initialize ROS2 runtime ```zsh node = rclpy.create_node("my_publisher") ``` create a node named "my_publisher" using the rclpy ```zsh rclpy.spin_once(node, timeout_sec=1) ``` . Execute a single iteration of the ROS 2 event loop within a specified timeout period using the 'spin_once' function from the 'rclpy 'module. ```zsh pub = node.create_publisher(str.String, "infodev", 10) ``` - In Python, use the create_publisher function from the rclpy module to instantiate a publisher within a ROS 2 node named "node." This publisher will be configured to publish messages of a specific type on a defined topic with a designated name. ```zsh for i in range(1, 100) msg = str.String(data="Hello, ROS2 from Julia! ($(string(i)))") pub.publish(msg) txt = "[TALKER] " * msg.data @info txt sleep(1) end ``` . Using PyCall in Julia, establish a publisher node to communicate with a ROS 2 system. This node will publish messages to a topic named "infodev." Each message will contain a string with the text "Hello, ROS2 from Julia!" accompanied by an incrementing number ranging from 1 to 99. ```zsh rclpy.shutdown() node.destroy_node() ``` Deliting the rcply and destroy the node #rect(fill:yellow )[ The second programm : the subscriber code] ```zsh rclpy = pyimport("rclpy") ``` Utilize PyCall in Julia to import the rclpy module from Python. This module, integral to the Robot Operating System 2 (ROS 2) ecosystem, offers capabilities for crafting ROS 2 nodes, publishers, subscribers, and additional functionalities. ```zsh str = pyimport("std_msgs.msg") ``` Using PyCall in Julia, import the std_msgs.msg module from ROS 2. This module comprises message types frequently employed in ROS 2, including standard messages for various data types such as strings, integers, floats, and more. ```zsh node = rclpy.create_node("my_subscriber") ``` creat a node called my subscriber in a specific topic ```zsh function callback(msg) txt = "[LISTENER] I heard: " * msg.data @info txt end ``` Create a callback function in Julia that executes when messages are received by a subscriber. This function will print the received message data, prefixed with an indication that it was received by the listener node ```zsh sub = node.create_subscription(str.String, "infodev", callback, 10) ``` In Python, within a ROS 2 node named "node," utilize the create_subscription function from the rclpy module to instantiate a subscriber. This subscriber will subscribe to messages of type std_msgs.msg.String on the topic "infodev" and trigger the callback function upon receiving messages. ```zsh while rclpy.ok() rclpy.spin_once(node) end ``` . Develop a loop in Python that iteratively spins the ROS 2 node until the ROS 2 context, checked via 'rclpy.ok()', remains valid. This loop ensures sustained processing of messages and callbacks by the node for as long as the ROS 2 context remains valid. //#test[Some test]
https://github.com/ellmau/cv-typst
https://raw.githubusercontent.com/ellmau/cv-typst/main/cv_de.typ
typst
#import "cv.typ": * #show: my-cv.with(language:"de")
https://github.com/grnin/Zusammenfassungen
https://raw.githubusercontent.com/grnin/Zusammenfassungen/main/Bsys2/11_Ext4.typ
typst
// Compiled with Typst 0.11.1 #import "../template_zusammenf.typ": * #import "@preview/wrap-it:0.1.0": wrap-content /*#show: project.with( authors: ("<NAME>", "<NAME>"), fach: "BSys2", fach-long: "Betriebssysteme 2", semester: "FS24", tableofcontents: (enabled: true), language: "de" ) */ = Ext4 In Ext4 sind die wichtigen Datenstrukturen vergrössert #hinweis[(_Inodes_ haben 256 Byte statt 128, _Gruppendeskriptoren_ 64 Byte statt 32, _Blockgrösse_ bis 64 KB)]. Grosse Blöcke sind besser fÃŒr viele grosse Dateien, da weniger Metadaten benötigt werden. Erlaubt höhere maximale Dateigrösse. Zudem werden Blöcke von den Inodes mit _Extent Trees_ verwaltet und _Journaling_ wird verwendet. #wrap-content( image("img/bsys_47.png"), align: top + right, columns: (80%, 20%), )[ == Extents Ein _Extent_ beschreibt ein _Intervall physisch konsekutiver Blöcke_. Ist 12 Byte gross #hinweis[(4B logische Blocknummer, 6B physische Blocknummer, 2B Anzahl Blöcke)]. Positive Zahlen = Block initialisiert, Negativ = Block voralloziert. Da eine EinschrÀnkung auf ausschliesslich konsekutive Dateien nicht praktikabel ist, muss eine Datei _mehr als einen Extent umfassen_ können. Im Inode hat es in den 60 Byte fÃŒr direkte und indirekte Block-Adressierung Platz fÃŒr 4 Extents und einen Header. == Extent Trees _Index-Knoten_ #hinweis[(Innerer Knoten des Baums, besteht aus Index-Eintrag und Index-Block)]\ _Index-Eintrag_ #hinweis[(EnthÀlt Nummer des physischen Index-Blocks und kleinste logische Blocknummer aller Kindknoten)] ] === Extent Tree Header FÃŒr mehr als 4 Extents braucht man einen zusÀtzlichen Block. Deshalb sind die ersten 12 Byte kein Extent, sondern der Extent Tree Header: - 2 Byte _Magic Number_ #hex("F30A") - 2 Byte _Anzahl EintrÀge_, die _direkt_ auf den Header folgen #hinweis[(Wie viele Extents folgen dem Header?)] - 2 Byte _Anzahl EintrÀge_, die _maximal_ auf den Header folgen können - 2 Byte _Tiefe des Baums_ #hinweis[(0: EintrÀge sind Extents, $>=$1: EintrÀge sind Index Nodes)] - 4 Byte _reserviert_ === Index Nodes Ein Index-Node spezifiziert _einen Block, der Extents enthÀlt_. Der Block enthÀlt am Anfang einen _Header_ und danach die Extents #hinweis[(max. 340 bei 4 KB Blockgrösse)]. - 4 Byte _kleinste logische Blocknummer_ aller Kind-Extents - 6 Byte _physische Blocknummer_ des Blocks, auf den der Index-Node verweist - 2 Byte _unbenutzt_ Werden mehr als $4 dot 340 =$ _$bold(1360)$ Extents_ #hinweis[(#hex(550))] benötigt, muss man Blöcke mit Index-Nodes einfÃŒhren. Statt Extents stehen dann _Index Nodes im Block_. Die _Tiefe_ im Inode wird auf _2_ gesetzt, in den Index-Node-Blöcken auf 1. Die _kleinste logische Blocknummer_ aller Kind-Extents _propagiert_ dann bis in den jeweils obersten Index-Node. Benötigt man dann _noch mehr Extents_, kann die _Tiefe_ im Inode bis auf _5_ gesetzt werden. #wrap-content( image("img/bsys_48.png"), align: top + right, columns: (50%, 50%), )[ === Index-Block Ein Index-Block enthÀlt einen eigenen _Tree-Header_, Tiefe ist um 1 kleiner als beim ÃŒbergeordneten Knoten. EnthÀlt _Referenz auf die Kind-Knoten_: je nach Tiefe entweder Index-EintrÀge oder Extents. `i_block[0...14]` kann als (sehr kleiner) Index-Block aufgefasst werden. ] === Notation #table( columns: (1fr, 1fr), table.header([(in)direkte Addressierung], [Extent-Trees]), [_direkte Blöcke:_ Index $|->$ Blocknr.], [_Indexknoten:_ Index $|->$ (Kindblocknr, kleinste Nummer der 1. logischen Blöcke aller Kinder)], [_indirekte Blöcke:_ indirekter Block.Index $|->$ direkter Block], [_Blattknoten:_ Index $|->$ (1. logisch. Block, 1. phy. Block, Anz. Blöcke)], [], [_Header:_ Index $|->$ (Anz. EintrÀge, Tiefe)], ) ==== Beispiel Berechnung 2MB grosse, konsekutiv gespeicherte Datei, 2KB Blöcke ab Block #hex("2000") _(In-)direkte Block-Adressierung_\ 2 MB = $2^21$B, 2 KB = $2^11$B, $ 2^(21-11) = 2^10 = #fxcolor("rot", hex(400))$ Blöcke von #fxcolor("grÃŒn", hex(2000)) bis #fxcolor("orange", hex("23FF")) $0 arrow.bar #fxcolor("grÃŒn", hex(2000)), 1 arrow.bar #hex(2002), ..., #hex("B") arrow.bar #hex("200B")$ $#hex("C") arrow.bar #hex(2400)$ #hinweis[(indirekter Block)]\ $#hex(1400).#hex(0) arrow.bar #hex("200C"), #hex(1400).#hex(1) arrow.bar #hex("200D"), ..., #hex(1400).#hex("3F3") arrow.bar #fxcolor("orange", hex("23FF"))$ _Extent Trees_ \ *Header:* $0 arrow.bar (1,0)$\ *Extent:* $1 arrow.bar (0, #fxcolor("grÃŒn", hex(2000)), #fxcolor("rot",hex(400)))$ == Journaling Wird eine Datei _erweitert_, passiert folgendes: - _Neue Blöcke_ werden fÃŒr die Daten _alloziert_ - Der _Inode_ der Datei wird _angepasst_, um die Blöcke zu referenzieren - Die _Block-Usage-Bitmaps_ werden _angepasst_ - Die _Counter_ freier und benutzer Blöcke werden _angepasst_ - Die _Daten_ werden in die Datei geschrieben Wenn das Dateisystem dabei _unterbrochen_ wird, kann es zu _Inkonsistenzen_ kommen. Ein System _ohne_ Journaling kann sehr lange brauchen, um ein Dateisystem auf Inkonsistenzen zu prÃŒfen, da _alle Metadaten_ ÃŒberprÃŒft werden mÃŒssen. _Journaling verringert diese PrÃŒfung erheblich_. Dateisystem muss nur die Metadaten ÃŒberprÃŒfen, die noch im Journal referenziert sind. === Journal Das Journal ist eine _reservierte Datei_, in die Daten relativ _schnell geschrieben_ werden können. Besteht aus _wenigen sehr grossen Extents_ oder bestenfalls aus _einem einzigen Extent_ #hinweis[(Typischerweise Inode 8, 128MB)]. Eine _Transaktion_ ist eine Folge von Einzelschritten, die das Dateisystem gesamtheitlich vornehmen soll. === Journaling und Committing Daten werden zuerst als _Transaktion ins Journal_ geschrieben #hinweis[(Journaling)]. Daten werden erst _danach_ an ihre _endgÃŒltige Position_ geschrieben #hinweis[(Committing)]. Daten werden nach dem Commit aus dem Journal _entfernt_. Journaling ist _schneller_, weil alle Daten in _konsekutive_ Blöcke geschrieben werden. Committing muss u.U. _viele verschiedene_ Blöcke modifizieren. === Journal Replay Startet das System neu, kann es _anhand der Journal-EintrÀge_ die Metadaten untersuchen, die _potenziell korrupt_ sein könnten. Alle Transaktionen, die noch im Journal sind, wurden _noch nicht durchgefÃŒhrt_ und werden mit Journal Replay (noch einmal) ausgefÃŒhrt oder auf Fehler ÃŒberprÃŒft. _Im Gegensatz zu ext2 muss nicht der gesamte DatentrÀger auf Fehler untersucht werden._ === Journaling Modi Es gibt 3 Modi: (Full) Journal, Ordered und Writeback. Die Modi _Ordered_ und _Writeback_ schreiben nur _Metadaten_, _Journal_ schreibt auch _Datei-Inhalte_ ins Journal. #wrap-content( image("img/bsys_49.png"), align: top + right, columns: (50%, 50%), )[ ==== (Full) Journal _Metadaten und Datei-Inhalte_ kommen ins Journal. Grosse Änderungen werden in mehrere Transaktionen gesplittet. _Vorteil:_ maximale Datensicherheit _Nachteil:_ grosse Geschwindigkeitseinbussen. ] #wrap-content( image("img/bsys_50.png"), align: top + right, columns: (60%, 40%), )[ ==== Ordered _Nur Metadaten_ kommen ins Journal. Dateiinhalte werden immer _vor_ dem Commit geschrieben: + Transaktion ins Journal + Dateiinhalte an endgÃŒltige Position schreiben + Commit ausfÃŒhren _Vorteil:_ Dateien enthalten nach dem Commit den richtigen Inhalt _Nachteil:_ Etwas geringere Geschwindigkeit als Writeback.\ #hinweis[(In Linux gibt es einen lost+found Ordner im Root-Verzeichnis)] ] \ #wrap-content( image("img/bsys_51.png"), align: top + right, columns: (60%, 40%), )[ ==== Writeback _Nur Metadaten_ kommen ins Journal. Commit und Schreiben der Dateiinhalte werden in _beliebiger Reihenfolge_ ausgefÃŒhrt. _Vorteil:_ Sehr schnell, keine Synchronisation von Commit und Datenschreiben nötig. _Nachteil:_ Dateien können DatenmÃŒll enthalten. ] == Vergleich Ext2 & Ext4 #table( columns: (auto, auto), table.header([Ext2], [Ext4]), [ - schlank und leistungsfÀhig - einfach zu implementieren - mÀchtiger als FAT, weniger mÀchtig als NTFS ], [ - fÃŒgt wichtige Features hinzu - Journaling - Effizientere Verwaltung grosser Verzeichnisse und Dateien ], )
https://github.com/ayoubelmhamdi/typst-phd-AI-Medical
https://raw.githubusercontent.com/ayoubelmhamdi/typst-phd-AI-Medical/master/chapters/ch21.typ
typst
MIT License
#import "../functions.typ": heading_center, images, italic,linkb, dots #import "../tablex.typ": tablex, cellx, rowspanx, colspanx, hlinex #let finchapiter = text(fill:rgb("#1E045B"),"■") // #linebreak() // #linebreak() // #counter("tabl").update(n=>n+20) = DETECTION ET CLASSIFICATION DES NODULES PULMONAIRES À L’AIDE DU DEEP LEARNING == Introduction Le cancer du poumon figure parmi les principales causes de mortalité liées au cancer dans le monde entier #cite("national2011reduced"). La reconnaissance et le diagnostic précoces des nodules pulmonaires, petites masses de tissu dans les poumons, peuvent considérablement augmenter les taux de survie et le succÚs du traitement pour les individus atteints de cancer du poumon. Cependant, la détection et la classification de ces nodules pulmonaires représentent un défi de taille en raison de leur taille, forme, emplacement et caractéristiques physiques variables #cite("SetioTBBBC0DFGG16"). De plus, la majorité des nodules pulmonaires sont bénins ou non cancéreux, avec seulement un faible pourcentage classé comme malin ou cancéreux #cite("dou2017automated"). Ces conditions créent des complications pour la détection et la classification automatisées des nodules pulmonaires par des modÚles d'apprentissage automatique. Un des défis majeurs dans le dépistage du cancer du poumon est de distinguer les nodules pulmonaires _bénins_ et _malins_ à partir des images de scanner. Les systÚmes de détection assistée par ordinateur (CAO) peuvent aider les radiologues à identifier et à caractériser les nodules en fonction de leur taille, leur forme, leur évolution et leur _*risque de malignité*_#cite("Shen2015","Nasrullah2019"). Ces systÚmes utilisent des techniques d'intelligence artificielle, notamment des réseaux de neurones profonds, pour analyser les images et fournir une classification automatique des nodules. Cette approche peut réduire le temps de lecture, augmenter le taux de détection, harmoniser les pratiques cliniques et éviter des examens inutiles ou invasifs. Dans cet étude, nous proposons d'utiliser le deep learning pour améliorer la prise en charge des nodules pulmonaires. Le deep learning permet d'apprendre à partir de grandes quantités de données et de réaliser des tâches complexes comme la classification ou la segmentation d'images. Nous utilisons le dataset *LIDC-IDRI*#footnote("sous licence «Creative Commons Attribution 3.0 Unported License».")@Clark2013, qui contient $1018$ scanners thoraciques annotés par *quatre radiologues experts*. Chaque nodule pulmonaire est décrit par un fichier _XML_ qui contient son _identifiant_, ses _caractéristiques_ et sa _région d'intérêt_. Par exemple, voici le fichier XML correspondant au nodule numéro 4 : #pagebreak() ```xml <unblindedReadNodule> <noduleID>4</noduleID> <characteristics> <subtlety>4</subtlety> <internalStructure>1</internalStructure> <calcification>6</calcification> <sphericity>4</sphericity> <margin>4</margin> <lobulation>1</lobulation> <spiculation>2</spiculation> <texture>5</texture> <malignancy>3</malignancy> </characteristics> <roi> <imageZposition>1487.5</imageZposition> <imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.270602739536521934855332163694</imageSOP_UID> <inclusion>TRUE</inclusion> <edgeMap><xCoord>322</xCoord><yCoord>303</yCoord></edgeMap> <edgeMap><xCoord>322</xCoord><yCoord>304</yCoord></edgeMap> <edgeMap><xCoord>322</xCoord><yCoord>305</yCoord></edgeMap> <edgeMap><xCoord>323</xCoord><yCoord>303</yCoord></edgeMap> <edgeMap><xCoord>322</xCoord><yCoord>303</yCoord></edgeMap> </roi> </unblindedReadNodule> ``` Ce fichier _XML_ contient des informations importantes sur le nodule, telles que sa _taille_, sa _forme_, sa _structure_, sa _calcification_, sa _texture_ et son _*risque de malignité*_. Il contient également la _position_ et le _contour_ du nodule sur l’image. Nous commençons par développer un modÚle de classification qui peut identifier le *type* de nodulaire à partir des images CT scan(nodule ou lésion). Nous avons utilisé le dataset *LUNA16*#footnote("sous licence «Creative Commons Attribution 4.0 International License».") #cite("SetioTBBBC0DFGG16"), qui est un sous-ensemble du dataset _LIDC-IDRI_, pour entraîner et évaluer notre modÚle de classification. Nous avons comparé les performances de notre modÚle de classification avec celles des radiologues et avec d'autres études dans la tâche de classification des nodules. Ensuite, nous créons un nouveau dataset appelé *TRPMLN*, qui extrait *les nodules qui ont une moyenne de malignité égale à 3 ou plus dans les annotations des quatre experts*. Nous avons inclus une annexe qui présente l'implémentation du code _PYTHON_ pour créer cet ensemble de données. Nous développons un autre modÚle de classification qui peut *classer les nodules en fonction de leur risque de malignité* à partir des images CT scan. Nous comparons les performances de notre modÚle avec celles des radiologues et avec d'autres études dans le même tâche. Le plan de l'étude est le suivant : dans la section Méthode, nous présentons le dataset _LIDC-IDRI_, le dataset _LUNA16_, le dataset _TRPMLN_, les modÚles de deep learning et les critÚres d'évaluation. Dans la section Résultats, nous montrons les résultats obtenus par nos modÚles sur les datasets _LUNA16_ et _TRPMLN_. Dans la section Discussion, nous analysons les forces et les limites de notre approche. Dans la section Conclusion, nous résumons nos contributions et proposons des perspectives futures. #finchapiter == Matériel et Méthode. Notre étude comprenait trois étapes principales : le prétraitement des données, le développement de l'algorithme de détection des nodules et l'évaluation des performances #cite("dou2017automated","ding2017accurate","armato2011lidc"). === Ressources Les ressources de notre étude étaient des scans CT et des annotations provenant du dataset _ LIDC-IDRI_, du dataset _LUNA16_ et _TRPMLN_. Le dataset _ LIDC-IDRI_ est une base de données publique qui contient 1018 scans thoraciques annotés par quatre radiologues experts. Chaque nodule pulmonaire est décrit par un fichier XML qui contient son identifiant, ses caractéristiques et sa région d'intérêt#footnote("Dataset Wiki: https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=1966254"). Voici un tableau des points clés du résumé : #figure( tablex( columns: 2, align: horizon, auto-vlines: false, repeat-header: false, [ *Pointer* ],[ *Résumé* ], [ Origine ],[ Partenariat public-privé] + footnote("L'origine de l'ensemble de données LIDC-IDRI est un partenariat public-privé car il a été financé à la fois par le secteur public (le National Cancer Institute) et le secteur privé (la Fondation pour les National Institutes of Health et les sociétés d'imagerie médicale qui ont participé à le projet)."), hlinex(stroke: 0.25pt), [ Taille ],[ 1018 CT scans ], hlinex(stroke: 0.25pt), [ Nodules ],[ Annoté par 4 radiologues ], hlinex(stroke: 0.25pt), [ Annotations ],[ Deux phases ], hlinex(stroke: 0.25pt), [ Disponibilité ],[ Disponible publiquement ], hlinex(stroke: 0.25pt), [ Utiliser ],[ Développement et évaluation CAO ], ), // caption: [Coordonnées des candidats détectés dans le dataset Luna16 avec diamÚtres], // kind: "tabl", supplement: [#text(weight: "bold","Table")], ) === Scans CT avec Nodules Pulmonaires. Pour lire, traiter et représenter visuellement les scans CT montrant des nodules pulmonaires, nous avons mis en œuvre tois bibliothÚques Python : SimpleITK#footnote("sous licence «Apache License 2.0.»."), Pylidc #footnote("sous licence «MIT License.»."), et matplotlib#footnote("sous licence «PSF License.»."). - Avec _*SimpleITK*_#cite("Beare2018", "Yaniv2017", "Lowekamp2013") et _*Pylidc*_#cite("Hancock2016") , nous avons lu les fichiers de scan CT de l'ensemble de données _LUNA16_ ou _LIDC-IDRI_, convertissant ces images de leur format _raw_ , _mhd_ ou _DICOM_ en tableaux numériques multidimensionnels manipulables, appelés tableaux numpy. - Nous avons utilisé _*Matplotlib*_#cite("Hunter2007") pour tracer et afficher les tranches de scan CT contenant des nodules, complétant ces images par des lignes blanches marquant les limites autour de chaque nodule pour souligner leur emplacement et leurs dimensions. La @Fig1 offre un exemple d'une tranche de scan CT, où le nodule est mis en évidence par des lignes blanches. #images( filename:"images/3_nodules.png", caption:[ // Exemples d'une tranche de scan CT avec un nodule mis en évidence par des lignes blanches. Catégories de nodules pulmonaires dans un scanner CT; bénigne, maligne primaire, et maligne métastatique (de gauche à droite)#cite("Nasrullah2019"). ], width: 90% // ref: ) <Fig1> ==== Dataset LUNA16. Le dataset _LUNA16_ est un sous-ensemble du dataset _ LIDC-IDRI_, qui contient 1186 nodules annotés dans $888$ scans thoraciques. Ce dataset fournit également deux fichiers CSV distincts contenant les détails des candidats et des annotations. Dans le fichier candidates.csv, quatre colonnes sont illustrées : _seriesuid_, _coordX_, _coordY_, _coordZ_, et _classe_. Ici, le _seriesuid_ fonctionne comme un identifiant unique pour chaque scan ; _coordX_, _coordY_, et _coordZ_ représentent les coordonnées spatiales pour chaque candidat en millimÚtres, et _classe_ fournit une catégorisation binaire, dépeignant si le candidat est un nodule (1) ou non (0). #figure( tablex( columns: 5, align: center + horizon, auto-vlines: false, repeat-header: false, [*seriesuid*], [*coordX*], [*coordY*], [*coordZ*], [*class*], [1.3.6...666836860], [68.42], [-74.48], [-288.7], [0], hlinex(stroke: 0.25pt), [1.3.6...666836860], [68.42], [-74.48], [-288.7], [0], hlinex(stroke: 0.25pt), [1.3.6...666836860], [-95.20936148], [-91.80940617], [-377.4263503], [0], ), caption: [Coordonnées des candidats détectés dans le dataset Luna16 avec diamÚtres], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) Le fichier _annotations.csv_ est composé de cinq colonnes : _seriesuid_, _coordX_, _coordY_, _coordZ_, et _diamÚtre_mm_, commandant l'identifiant unique du scanner, les coordonnées d'annotation spatiales en millimÚtres, et le diamÚtre de chaque annotation en millimÚtres, respectivement. Ces annotations ont été marquées manuellement en se basant sur l'identification des nodules de plus de 3 mm de diamÚtre par quatre radiologistes indépendants #cite("dou2017automated","ding2017accurate","armato2011lidc"). #figure( tablex( columns: 5, align: center + horizon, auto-vlines: false, repeat-header: false, [*seriesuid*], [*coordX*], [*coordY*], [*coordZ*], [*diameter_mm*], [1.3.6.1....6860], [-128.6994211], [-175.3192718], [-298.3875064], [5.65147063], hlinex(stroke: 0.25pt), [1.3.6.1....6860], [103.7836509], [-211.9251487], [-227.12125], [4.224708481], hlinex(stroke: 0.25pt), [1.3.6.1....5208], [69.63901724], [-140.9445859], [876.3744957], [5.786347814], ), caption: [Annotations des nodules détectés dans le dataset Luna16], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) ==== Dataset TRPMLN. La création du jeu de données _*TRPMLN*_ implique plusieurs étapes. Initialement, un environnement virtuel Python est établi et activé, suivi par l'installation des packages Python nécessaires à partir d'un fichier _requirements.txt_. Un fichier de configuration pour _pylidc_ est ensuite généré, qui spécifie le chemin vers le jeu de données LIDC-IDRI. Le jeu de données _LIDC-IDRI_ est par la suite interrogé en utilisant _pylidc_, en filtrant les scans avec une épaisseur de tranche supérieure à 3 mm et un espacement de pixels supérieur à 1 mm. Pour chaque scan dans le jeu de données filtré, les annotations sont regroupées en nodules. Un score moyen de malignité est calculé pour chaque nodule sur la base des scores fournis par différents experts. Si ce score moyen est de 3 ou plus, le nodule est classé comme cancéreux ; sinon, il est considéré comme normal. Les données pour chaque nodule sont enregistrées, y compris le nom du nodule (qui indique s'il est cancéreux ou non) et l'objet d'annotation. Ces données sont utilisées pour créer un fichier CSV avec deux colonnes : "roi_name" (le nom du nodule) et "cancer" (indiquant s'il est cancéreux ou non). Pour chaque ligne de données, une région d'intérêt (ROI) est extraite du volume du scan en fonction de la boîte englobante de l'annotation. La ROI est normalisée à une plage de 0 à 255 pour les images en 8 bits et sauvegardée en tant qu'image _TIFF_ dans un répertoire spécifié. Pour gérer l'utilisation de la mémoire, le _garbage collector_ de Python est invoqué toutes les 10 itérations pour nettoyer la mémoire inutilisée. Le jeu de données _TRPMLN_ final comprend des images _TIFF_ de nodules et un fichier CSV contenant des informations sur ces nodules. Ce jeu de données peut être utilisé pour entraîner des modÚles d'apprentissage profond pour classer les nodules malins. Ces étapes sont démontrées dans l'ANNEXE 2. === Développement des l'algorithmes de détection des nodules. // nombres de nodules de enteaitenment de test? AprÚs avoir préparé les images de scans CT, l'ensemble de données (_LUNA16_ ou _TRPMLN_) a été divisé en ensembles d'entraînement et de test. L'ensemble d'entraînement comprenait 67% des données, tandis que l'ensemble de test comprenait les 33% restants. Deux modÚles ont été entraînés sur l'ensemble d'entraînement et évalués sur l'ensemble de test : un modÚle _CNN_ et un modÚle _ResNet50_. Les performances des modÚles ont été mesurées en utilisant l'exactitude, la précision, la sensibilité et le "F1-score". La construction des algorithmes de détection des nodules a été divisée en plusieurs étapes impératives. À leur base, les algorithmes reposaient sur un modÚle de réseau neuronal convolutif (_CNN_) et un modÚle _ResNet50_, chargés d'identifier les nodules à partir d'images de scans CT #cite("lin2017feature"). Le modÚle _CNN_ était utilisé pour détecter la présence de nodules pulmonaires ou de lésions pulmonaires, tandis que le modÚle _ResNet50_ était utilisé pour classification des nodules selon l'approximation du risque de cancer, malin ou non malin. ==== Model 1: Detection de type de Nodule. #images( filename:"images/model2.png", caption:[ La structure du modÚle. ], width: 90% // ref: ) Utilisant le dataset _LUNA16_, qui contient des images de nodules et de lésions pulmonaires, nous avons expérimenté différentes combinaisons de couches et de filtres pour trouver la meilleure architecture pour notre problÚme. Nous avons trouvé que le meilleur modÚle pour nous était conçu comme suit : #figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [*Stage*], [*Output*], [*Param*], [Conv2D], [(None, 64, 64, 64)], [4160], hlinex(stroke: 0.25pt), [Conv2D], [(None, 64, 64, 64)], [16448], hlinex(stroke: 0.25pt), [MaxPooling2D], [(None, 8, 8, 64)], [0], [Conv2D], [(None, 8, 8, 64)], [16448], hlinex(stroke: 0.25pt), [Conv2D], [(None, 8, 8, 64)], [16448], hlinex(stroke: 0.25pt), [MaxPooling2D], [(None, 4, 4, 64)], [0], [Conv2D], [(None, 4, 4, 64)], [16448], hlinex(stroke: 0.25pt), [Conv2D], [(None, 4, 4, 64)], [16448], hlinex(stroke: 0.25pt), [Conv2D], [(None, 4, 4, 64)], [262208], hlinex(stroke: 0.25pt), [MaxPooling2D], [(None, 2, 2, 64)], [0], [GlobalAveragePooling2], [(None, 64)], [0], hlinex(stroke: 0.25pt), [Flatten], [(None, 64)], [0], hlinex(stroke: 0.25pt), [Dense], [(None, 2)], [130], colspanx(3)[*Total params: 348,738*] ), caption: [Architecture du modÚle CNN.], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) Pour entraîner le modÚle, l'optimiseur _Adam_#cite("kingma2014adam") a été utilisé avec un taux d'apprentissage de $0,001$, et la fonction de perte _d'entropie croisée binaire_. Cette fonction de perte mesure la divergence entre la probabilité prédite par le modÚle et la vérité terrain pour chaque image. Elle est adaptée aux problÚmes de classification binaire, comme celui de détecter la présence ou l'absence de nodules. L'entropie croisée binaire pénalise les prédictions erronées plus fortement que les prédictions correctes, ce qui encourage le modÚle à apprendre à distinguer les nodules des non-nodules avec une grande confiance. L'entraînement du modÚle s'est étendu sur 100 époques, 6691 nodules ont été utilisés, dont 4165 de classe 0 et 2526 de classe 1. Les nodules recadrés détectés sont de taille 64 × 64 × 1. ==== Model 2: Détection de nodule à risque de cancer. #images( filename:"images/structure_resnet.png", caption:[ Un aperçu de ResNET. Notre approche extrait d’abord plusieurs patchs de nodules pour capturer le large éventail de variabilité des nodules à partir des images CT d’entrée. Enfin, notre approche applique un classificateur pour étiqueter la malignité du nodule d’entrée. ], width: 90% // ref: ) Nous développons aussi un modÚle pour _*approximer la probabilité de risque de malignité des nodules pulmonaires*_ à partir d'images CT scan, basé sur l'ensemble de données qui a été créé(_TRPMLN_) en se basant sur le dataset original *LIDC-IDRI* et en nous appuyant sur les annotations de quatre radiologues experts. Nous avons expérimenté différentes combinaisons de couches et de filtres pour trouver la meilleure architecture pour notre problÚme. Nous avons trouvé que le meilleur modÚle pour nous était conçu comme suit : #figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [*Layer type*], [*Output Shape*], [*Param*], [InputLayer], [(None, 64, 64, 1)], [0], hlinex(stroke: 0.25pt), [Concatenate], [(None, 64, 64, 3)], [0], hlinex(stroke: 0.25pt), [UpSampling2D], [(None, 192, 192, 3)], [0], hlinex(stroke: 0.25pt), [ZeroPadding2D], [(None, 198, 198, 3)], [0], hlinex(stroke: 0.25pt), [ResNet], [-], [23587712], hlinex(stroke: 0.25pt), [GlobalAveragePooling2D],[(None, 2048)], [0], hlinex(stroke: 0.25pt), [Flatten], [(None, 2048)], [0], hlinex(stroke: 0.25pt), [Dense], [(None, 2)], [4098], hlinex(stroke: 0.25pt), colspanx(3)[*Total params: $23591810$*] ), caption: [Architecture du modÚle ResNET.], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) Les performances de classification des nodules du systÚme conçu ont été évaluées sur _TRPMLN_. Pour la formation à la classification, 1568 nodules ont été utilisés, dont 801 de classe 0 et 767 de classe 1. Les nodules recadrés détectés sont de taille 64 × 64 × 1. Entraînés sur 118 époques, un taux d'apprentissage de 0,001 a été utilisé, et comme optimiseur on a utilisé Adam et la fonction de perte d'entropie croisée binaire. == Résultats. === Évaluation des performances du modÚle. Nous avons évalué le succÚs du modÚles à travers son *exactitude*#footnote("exactitude: \"accuracy\" en Anglais.") sur les ensembles de données d'entraînement et de validation. L'*exactitude* du modÚle sur les données d'entraînement et de validation a été documentée à chaque étape du processus d'apprentissage #cite("SetioTBBBC0DFGG16"). Le terme *exactitude* fait référence à la capacité du modÚle à prévoir correctement les résultats sur les données d'entraînement, tandis que l'*exactitude de validation* signifie la capacité du modÚle à généraliser ses prédictions à de nouvelles données inédites, c'est-à-dire les données de validation. === Métriques d'évaluation : Précision, Sensibilité et "F1-Score". La performance du modÚle peut a été évaluée à partir de _la matrice de confusion_, qui permet de calculer des métriques comme la *précision*, la *sensibilité (recall)* et le *F1-Score*, en plus de l’*exactitude*. Ces mesures fournissent un aperçu plus large des performances du modÚle, notamment quand il y a un déséquilibre des classes. // #linebreak() #let VP="VP" #let FP="FP" #let FN="FN" - La *précision* représente la fraction des prédictions positives correctes (plus précisément, lorsque le modÚle identifie correctement un nodule) sur toutes les prévisions positives faites par le modÚle. Une précision élevée indique un faible taux de faux positifs du modÚle. $ "précision" = (VP) / (VP + FP) $ // &= 652/(652+90) \ // &= 87.8% // $ // #images( // filename:"images/pre_recall2.png", // caption:[ // Précision et sensibilité (« recall »). La précision compte la proportion d'items pertinents parmi les items sélectionnés alors que la sensibilité compte la proportion d'items pertinents sélectionnés parmi tous les items pertinents sélectionnables. // ], // width: 60% // // ref: // ) - La *Sensibilité (Recall)*, synonyme de sensibilité ou de taux de vrais positifs, est le rapport des prédictions positives correctes à tous les positifs réels. Une sensibilité élevée indique que le modÚle a correctement identifié la majorité des cas positifs réels. $ "sensibilité" = (VP) / (VP + FN) $ // $ \ // &= 652/(652+199) \ // &= 76.6% // $ - Le *F1-score* est la moyenne harmonique de la précision et de la sensibilité, fournissant une seule mesure qui équilibre ces métriques. - $ F_1 &= (2 VP)/(2VP + FP + FN) $ // $ \ // &= (2 times 252)/(2 times 256 + 90 + 199) \ // &= 81.8% // $ ==== Performances du modÚle 1 sur LUNA16 en utilisant CNN #images( filename:"images/class2.svg", caption:[ Évolution des précisions d’entraînement et de validation de model 1 au cours de l’apprentissage. ], width: 100% // ref: ) En examinant les valeurs d'*exactitude* et d'*exactitude de validation* tout au long des étapes d'apprentissage, il est indiqué que le modÚle acquiert des connaissances, comme on peut le voir à travers l'amélioration progressive des exactitudes d'entraînement et de validation. Le modÚle commence avec des exactitudes relativement plus faibles, autour de $64%$, avant d'augmenter à plus de 89% et de terminer avec un score de 87% à la fin de l'entraînement. Cela démontre la capacité raffinée du modÚle à catégoriser correctement un ratio considérable de cas. #block()[ #set text(9pt, style: "italic") #grid( columns: (1fr, 2fr), rows: (auto), gutter: 3pt, figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [], [*Prédiction\ négative*], [*Prédiction\ positive*], // Model 1 [*Réel\ Négatif*], [$771$ VN], [ $51$ FP], hlinex(stroke: 0.25pt), [*Réel\ Positif*], [$113$ FN], [$404$ VP], )+text(size: 2pt," "), caption: [La matrice de confusion.], kind: "tabl", supplement: [#text(weight: "bold","Table")], ), /* -------------------------*/ figure( v(8mm)+ tablex( columns: 4, align: center + horizon, auto-vlines: false, repeat-header: false, // MODEL 1 [], [*Précision*], [ *Sensibilité \ (Recall)*], [*F1-score*], [*Model\ CNN*], [$88.79%$], [$75.23%$], [$81.14%$], )+text(size: 12pt," "), caption: [Précision, sensibilité et "F1-score" du modÚle 1], kind: "tabl", supplement: [#text(weight: "bold","Table")], ), ) ] ==== Performances du modÚle 2 sur TRPMLN en utilisant RESNET. #images( filename:"images/resnet_model6.png", caption:[ Évolution des précisions d’entraînement et de validation de model 2 au cours de l’apprentissage. ], // height: 50%, width: 80% // ref: ) Le modÚle commence avec une exactitude d'environ 68,66 % à la premiÚre époque et s'améliore progressivement. À la 60Úme époque, le modÚle atteint une précision d'entraînement de 100% et la maintient pendant plusieurs époques. La exactitude de validation commence à environ 50,63 % et fluctue tout au long du processus de formation, atteignant un pic d'environ 69,43 % mais ne se rapprochant jamais de la précision d'entraînement. Cela suggÚre que le modÚle a trÚs bien appris les données d'entraînement, mais qu'il présente un surapprentissage. #block()[ #set text(9pt, style: "italic") #grid( columns: (1fr, 2fr), rows: (auto), gutter: 3pt, figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [], [*Prédiction\ négative*], [*Prédiction\ positive*], // Model 2 [*Réel\ Négatif*], [$119$ VN], [ $40$ FP], hlinex(stroke: 0.25pt), [*Réel\ Positif*], [$70$ FN], [$85$ VP], )+text(size: 2pt," "), caption: [La matrice de confusion.], kind: "tabl", supplement: [#text(weight: "bold","Table")], ), /* -------------------------*/ figure( v(8mm)+ tablex( columns: 4, align: center + horizon, auto-vlines: false, repeat-header: false, // MODEL 2 [], [*Précision*], [ *Sensibilité \ (Recall)*], [*F1-score*], [*Model\ ResNET*], [68.00$%$], [$54.83%$], [$60.71%$], )+text(size: 12pt," "), caption: [Précision, sensibilité et "F1-score" du modÚle 2], kind: "tabl", supplement: [#text(weight: "bold","Table")], ), ) ] == Discussion. Dans les deux modÚles, nous avons un overfitting et des fluctuations de précision. - *Overfitting* : la exactitude de l'entraînement atteint 100 %, ce qui est un signe clair de surajustement, surtout par rapport à la exactitude de validation qui est bien inférieure. Le surajustement signifie que le modÚle a trop bien appris les données d'entraînement, y compris leur bruit et leurs valeurs aberrantes, ce qui le rend peu performant sur les données invisibles. - *Fluctuations de la exactitude de la validation* : la exactitude de la validation fluctue beaucoup, ce qui peut suggérer que le modÚle est instable ou que l'ensemble de validation n'est peut-être pas suffisamment représentatif. #figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [], [*Précision*], [ *Sensibilité (Recall)*], [*Song et al.* #cite("Song2017")], [$82%$], [$83%$], hlinex(stroke: 0.25pt), [*Nibali et al.* #cite("Nibali2017")],[$89%$], [$91%$], hlinex(stroke: 0.25pt), [*Zhao et al.* #cite("Zhao2018")], [$82%$], [$$], hlinex(stroke: 0.25pt), [*Nos modÚles*], [$88.79%$], [$75.25%$], ), caption: [Comparaison avec d'autres études dans la tâche de classification des nodules ou des lésions.], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) Comparaison avec nos résultats, notre modÚle de classification de nodule ou lésion est performant de maniÚre compétente dans l'identification des deux classes. En général, le modÚle a performé de maniÚre impressionnante en termes de précision, de sensibilité et de "F1-score". #figure( tablex( columns: 3, align: center + horizon, auto-vlines: false, repeat-header: false, [*Models*], [*Accuracy (%)*], [ *Year*], [*Multi-scale CNN* #cite("Shen2015")], [86.84], [2015], hlinex(stroke: 0.25pt), [*Nodule level 2D CNN* #cite("Lai2016")], [87.30], [2016], hlinex(stroke: 0.25pt), [*Slice level 2D CNN* #cite("Lai2016")], [86.70], [2016], hlinex(stroke: 0.25pt), [*Multi-crop CNN* #cite("Shen2017")], [87.14], [2017], hlinex(stroke: 0.25pt), [*Vanilla 3D CNN* #cite("Lai2016")], [87.40], [2016], hlinex(stroke: 0.25pt), [*Deep 3D DPN* #cite("Zhu2016")], [88.74], [2017], hlinex(stroke: 0.25pt), [*Deep 3D DPN + GBM* #cite("Zhu2016")], [90.44], [2017], hlinex(stroke: 0.25pt), [*3D MixNet* #cite("Nasrullah2019I")], [88.83], [2019], hlinex(stroke: 0.25pt), [*3D MixNet + GBM* #cite("Nasrullah2019I")], [90.57], [2019], hlinex(stroke: 0.25pt), [*3D CMixNet + GBM* #cite("Nasrullah2019")], [91.13], [2019], hlinex(stroke: 0.25pt), [*3D CMixNet + GBM + Biomarkers* #cite("Nasrullah2019")],[94.17], [2019], hlinex(stroke: 0.25pt), [*Our Model ResNET*], [69,43], [2023] ), // Accuracy comparison of nodule classification on public dataset. caption: [Comparaison avec d'autres études dans le cadre de la classification des nodules malins ou bénins #cite("Song2017", "Nibali2017", "Zhao2018").], kind: "tabl", supplement: [#text(weight: "bold","Table")], ) Mais la comparaison de notre modÚle de classification de nodule ou de lésion avec d'autres modÚles n'est pas performante de maniÚre compétitive, lorsque l'on veut approximer la détection des nodules malins. Plusieurs facteurs peuvent expliquer pourquoi le modÚle a tendance à identifier la classe 0 plutÃŽt que la classe 1. L'une des stratégies pourrait être de renforcer la présence de la classe 1, ce qui pourrait aider le modÚle à mieux distinguer la classe dominante et à améliorer légÚrement sa performance pour cette classe. De plus, la détection des nodules peut être une tâche plus complexe que celle des non-nodules. Les nodules sont souvent de petite taille, flous ou masqués par d'autres structures pulmonaires, ce qui peut compliquer leur détection. Ainsi, l'exploration d'autres techniques d'optimisation du modÚle pourrait être bénéfique pour atténuer le biais du modÚle en faveur de la classe 0. En outre, les variations de caractéristiques entre les classes peuvent également entraîner des taux de détection différents. Des analyses plus approfondies, comme un examen détaillé des caractéristiques des données d'entrée, pourraient aider à comprendre précisément pourquoi ces différences de performances sont observées. L'utilisation de techniques de prétraitement des images, comme la normalisation, pourrait améliorer la qualité et la diversité des données d'entrée. Pour résoudre ce problÚme, une stratégie d'entraînement raffinée pour notre modÚle est nécessaire, ainsi qu'un indicateur de performance plus robuste que la simple précision. Les solutions potentielles pourraient inclure : - L'application de techniques spécifiques pour accroître le nombre d'échantillons malins dans notre ensemble de données. - L'utilisation de techniques d'équilibrage des classes pour obtenir une distribution équilibrée des classes dans notre ensemble de données. Dans notre travail ultérieur, nous visons à incorporer certaines de ces solutions et nous nous attendons à améliorer les performances de notre modÚle par rapport à la classification des nodules pulmonaires, pour maîtriser la classification des sous-types de nodules, tels que solides, non-solides, partiellement solides, pérfissuraux, calcifiés et spiculés. Différents traitements sont nécessaires pour différents types de nodules, ce qui rend leur détection précise encore plus pertinente pour un traitement réussi. == Conclusion. Nous avons utilisé le Deep-Learning pour détecter et classifier les nodules pulmonaires dans l'ensemble de données _LUNA16_ et _TRPMLN_. Les modÚles ont affronté des défis liés à la diversité des nodules en termes de taille, de forme et d'emplacement, ainsi qu'à une distribution inégale dans l'ensemble de données. Malgré ces difficultés, ils ont performé de maniÚre satisfaisante, produisant des scores élevés, un bon sensibilité et un _F1-score_ convaincant pour les nodules, qu'ils soient nodule ou lesion. Ils ont également performé de maniÚre passable, produisant des scores passables pour la sensibilité et un _F1-score_ convaincant pour les nodules, qu'ils soient bénins ou malins. En plus de cela, nous avons également formé un modÚle pour classer les nodules comme probablement normaux ou anormaux. Ce modÚle a également été confronté à des défis similaires en termes de diversité des nodules et de distribution inégale dans l'ensemble de données. Les modÚles ont montré un léger avantage dans l'identification des non-nodules, probablement en raison de la limitation du nombre de classe 1 dans l'ensemble de données. Les résultats de notre étude soulignent que le Deep-Learning est efficace pour la détection et la classification des nodules pulmonaires. Il a le potentiel pour faciliter le diagnostic précoce du cancer du poumon, ce qui peut améliorer les chances de survie et l'efficacité du traitement. Nous cherchons à améliorer nos modÚles pour perfectionner leur performance, en particulier dans la détection des malignités des nodules pulmonaires. Pour cela, des recherches supplémentaires sont nécessaires. #finchapiter
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/MEC/project1/project.typ
typst
MIT License
#import "@preview/klaro-ifsc-sj:0.1.0": report #import "@preview/codelst:2.0.1": sourcecode #show heading: set block(below: 1.5em) #show par: set block(spacing: 1.5em) #set text(font: "Arial", size: 12pt) #set highlight( fill: rgb("#c1c7c3"), stroke: rgb("#6b6a6a"), extent: 2pt, radius: 0.2em, ) #show: doc => report( title: "Análise de Desempenho de Modulações Digitais", subtitle: "Sistemas de Comunicação I", authors: ("<NAME>",), date: "29 de Julho de 2024", doc, )
https://github.com/Myriad-Dreamin/shiroa
https://raw.githubusercontent.com/Myriad-Dreamin/shiroa/main/packages/shiroa/summary.typ
typst
Apache License 2.0
#import "utils.typ": _store-content #import "meta-and-state.typ": book-meta-state #import "supports-link.typ": link2page, cross-link-path-label /// Show template in [book.typ](https://myriad-dreamin.github.io/shiroa/format/book.html) /// /// Example: /// ```typ /// #show book /// ``` #let book(content) = { [#metadata(toml("typst.toml")) <shiroa-internal-package-meta>] // #let sidebar-gen(node) = { // node // } // #sidebar-gen(converted) // #get-book-meta() content } /// Book metadata in [book.typ](https://myriad-dreamin.github.io/shiroa/format/book.html) /// /// - title (str): The title of the book. /// - authors (array | str): The author(s) of the book. /// - description (str): A description for the book, which is added as meta information in the html <head> of each page. /// - repository (str): The github repository for the book. /// - repository-edit (str): The github repository editing template for the book. /// Example: `https://github.com/Me/Book/edit/main/path/to/book/{path}` /// - language: The main language of the book, which is used as a language attribute /// <html lang="en"> for example. /// Example: `en`, `zh`, `fr`, etc. /// - summary: Content summary of the book. Please see [Book Metadata's Summary Field](https://myriad-dreamin.github.io/shiroa/format/book-meta.html#label-summary%20%20(required)%20content) for details. #let book-meta( title: "", description: "", repository: "", repository-edit: "", authors: (), // array of string language: "", // default "en" summary: none, ) = [ #let raw-meta = ( kind: "book", title: title, description: description, repository: repository, repository_edit: repository-edit, authors: authors, language: language, summary: summary, ); #let meta = { import "summary-internal.typ" let meta = summary-internal._convert-summary(metadata(raw-meta)) meta.at("summary") = summary-internal._numbering-sections(meta.at("summary")) meta } #book-meta-state.update(meta) #metadata(meta) <shiroa-book-meta> #metadata(raw-meta) <shiroa-raw-book-meta> ] /// Build metadata in [book.typ](https://myriad-dreamin.github.io/shiroa/format/book.html) /// /// - dest-dir: The directory to put the rendered book in. By default this is `book/` in the book's root directory. This can overridden with the `--dest-dir` CLI option. #let build-meta( dest-dir: "", ) = [ #let meta = ( "dest-dir": dest-dir, ) #metadata(meta) <shiroa-build-meta> ] /// Represents a chapter in the book /// link: path relative (from summary.typ) to the chapter /// title: title of the chapter /// section: manually specify the section number of the chapter /// /// Example: /// ```typ /// #chapter("chapter1.typ")["Chapter 1"] /// #chapter("chapter2.typ", section: "1.2")["Chapter 1.2"] /// ``` #let chapter(link, title, section: auto) = metadata(( kind: "chapter", link: link, section: section, title: _store-content(title), )) /// Represents a prefix/suffix chapter in the book /// /// Example: /// ```typ /// #prefix-chapter("chapter-pre.typ")["Title of Prefix Chapter"] /// #prefix-chapter("chapter-pre2.typ")["Title of Prefix Chapter 2"] /// // other chapters /// #suffix-chapter("chapter-suf.typ")["Title of Suffix Chapter"] /// ``` #let prefix-chapter(link, title) = chapter(link, title, section: none) /// Represents a prefix/suffix chapter in the book /// /// Example: /// ```typ /// #prefix-chapter("chapter-pre.typ")["Title of Prefix Chapter"] /// #prefix-chapter("chapter-pre2.typ")["Title of Prefix Chapter 2"] /// // other chapters /// #suffix-chapter("chapter-suf.typ")["Title of Suffix Chapter"] /// ``` #let suffix-chapter = prefix-chapter /// Represents a divider in the summary sidebar #let divider = metadata(( kind: "divider", )) #let external-book(spec: none) = { place( hide[ #spec ], ) } #let visit-summary(x, visit) = { if x.at("kind") == "chapter" { let v = none let link = x.at("link") if link != none { let chapter-content = visit.at("inc")(link) if chapter-content.children.len() > 0 { let t = chapter-content.children.at(0) if t.func() == [].func() and t.children.len() == 0 { chapter-content = chapter-content.children.slice(1).sum() } } if "children" in chapter-content.fields() and chapter-content.children.len() > 0 { let t = chapter-content.children.at(0) if t.func() == parbreak { chapter-content = chapter-content.children.slice(1).sum() } } show: it => { let abs-link = cross-link-path-label("/" + link) locate(loc => { link2page.update(it => { it.insert(abs-link, loc.page()) it }) }) it } visit.at("chapter")(chapter-content) } if "sub" in x { x.sub.map(it => visit-summary(it, visit)).sum() } } else if x.at("kind") == "part" { // todo: more than plain text visit.at("part")(x.at("title").at("content")) } else { // repr(x) } }
https://github.com/ludwig-austermann/typst-din-5008-letter
https://raw.githubusercontent.com/ludwig-austermann/typst-din-5008-letter/main/examples/envelope_ex.typ
typst
MIT License
#import "../letter.typ": envelope, helpers, letter-styling #import envelope: envelope, envelope-styling #let address-field = helpers.address-field([recipient name\ recipient address], return-information: [return information\ further information], styling: letter-styling()) #envelope( envelope-format: "DL", sender-zone: pad(1cm)[sender name\ sender address], frank-zone: pad(1cm)[frank zone], read-zone: pad(y: 1cm, address-field), encoding-zone: pad(5mm)[encoding zone], debug: true )
https://github.com/Walker-00/cs-eik
https://raw.githubusercontent.com/Walker-00/cs-eik/rust/pages/cs_intro.typ
typst
Do What The F*ck You Want To Public License
#import "structure.typ": * #show link: underline #show: text_style #align(center, [= စာအုပ် မိတ်ဆက်]) == ဒီစာအုပ်က ဘာအတလက်လဲ ဒီစာအုပ် ကတော့ ကျလန်တော် နဲ့ ဒီစာအုပ်ရဲ့ Contributors တလေသိတဲ့ Computer Science နဲ့ ပတ်သက်တဲ့ အကဌောင်သတလေကို ရေသထာသတာပဲဖဌစ်ပါတယ်။ ကျလန်တော်တို့ သိတာတလေရေသတဲ့အတလက် မမဟန်ရင်လည်သ မမဟန်နိုင်သလို မဟာသလည်သမဟာသနိုင်ပါတယ်။ အကယ်လို့ အမဟာသပဌင်ချင်တယ် ကိုယ်သိတာလေသတလေထည့်ရေသပဌီသ Contributors (Co-Author) credit လိုချင်ရင်တော့ ဒီစာအုပ် project ရဲ့ #link("https://github.com/Walker-00/cs-eik")[Github Repo] ကို fork လုပ်ပဌီသတော့ဖဌစ်ဖဌစ် issue ဖလင့်ပဌီသ အကဌံပေသတာဖဌစ်ဖဌစ် လုပ်လို့ရပါတယ်။ ကျလန်တော်တို့ရဲ့ Main ရည်ရလယ်ချက်က Computer Science ကိုဘာ Background မဟ မရဟိတဲ့ သူကနေစပဌီသ စိတ်ပါဝင်စာသတဲ့ ဘယ်သူပဲဖဌစ်ဖဌစ် ဘာတန်ဖိုသမဟ ပေသစရာမလိုပဲ အလကာသ လေ့လာနိုင်ဖို့ အတလက်ရည်ရလယ်ပါတယ်။ == Authors တလေရဲ့ အသိပေသချက် ဒီစာအုပ်က စစချင်သတော့ အရမ်သပဌည့်စုံမဟာ မဟုတ်သလို ကိုယ်သိချင်တဲ့ အကဌောင်သအရာတလေ ကိုယ်သိပဌီသသာသ အကဌောင်သအရာတလေလည်သ စစချင်သ မပါနိုင်သေသပါဘူသ။ ကျလန်တော်လည်သ အလုပ်တစ်ဖက် သင်တန်သတစ်ဖက်နဲ့ လုပ်နေရတာကဌောင့်ပါ။ ဒါပေမဲ့ လိုတာတလေကို နည်သနည်သစီဖဌည့်ဖဌည့်ပဌီသ အဆင်ပဌေလောက်တဲ့ အချိန်ကျရင် edition တစ်ခုချင်သစီ ထုတ်ပေသသလာသမဟာပါ။ == License and Code Of Conduct ဒီ project ရဲ့ license ကိုတော့ #link("http://www.wtfpl.net/")[WTFPL] သုံသထာသပါတယ်။ License အရ ဘာမဆိုလုပ်လို့ရတယ်ဆိုပေမဲ့။ Non-Profit Sharing အတလက်ပဲ ခလင့်ပဌုပါတယ်။ ပဌန်ရောင်သတာမျိုသ မလုပ်ဖို့ ခလင့်ပန်ပါတယ်။ အကယ်၍ တစ်ယောက်ယောက်က ရောင်သခဲ့ရင်လည်သ။ ဒီစာအုပ်ဟာ Online Book PDF file အနေနဲ့ အလကာသဖတ်လို့လည်သ ရသလို၊ ကိုယ်တိုင် သိသလောက်ဝင်ရေသလို့ရတယ် ဆိုတာ အသိပေသပါရစေ။ ပဌန်ရောင်သပေမဲ့ profit ထဲက 25%+ လောက်လိုအပ်တဲ့ နေရာတလေကို ပဌန်ပဌီသ Donate လုပ်ပေသရင် ကောင်သပါမယ်ဗျ။ #pagebreak() #align(center, [= Computer Science မိတ်ဆက်]) \ == Computer Science ဆိုတာဘာလဲ *Computer* ဆိုတာက user က ပေသတဲ့ ညလဟန်ကဌာသချက်တလေအတိုင်သ အတိအကျလုပ်ဆောင်ပဌီသ\ ပဌဿနာတလေ ဖဌေရဟင်သပေသရတဲ့ စက်ပစ္စည်သဖဌစ်ပါတယ်။ အသေသစိတ်နဲ့ အမျိုသအစာသတလေကိုတော့ Computer အတလက်သီသသန့်အပိုင်သမဟာ ဆက်ရဟင်သပဌပေသပါမယ်။ *Science* ဆိုတာကတော့ မဌန်မာလိုဆို သိပ္ပံဖဌစ်ပဌီသ အရာရာတိုင်သကို လေ့လာတဲ့ နယ်ပယ်ဖဌစ်ပါတယ်။တစ်ကယ်ဆို Science နဲ့တင် အဓိပ္ပါယ်ကပဌီသပဌီ\ ဆိုပေမဲ့လည်သ တစ်ခါတစ်လေ သူ့နောက်မဟာ * Engineering* ပါလာတတ်ပါတယ်။ တစ်ကယ်လည်သ ပါသင့်တယ်လို့ထင်ပါတယ်။ ဘာလို့လဲဆိုတော့ Engineering ဆိုတာက Science က လေ့လာလို့ရလာတဲ့ အချက်အလက်တလေကို သုံသပဌီသ အပဌင်လောကရဲ့ ပဌဿနာတလေကို ဖဌေရဟင်သတဲ့ နယ်ပယ်ပါ။ ဆိုတော့ အတိုခေါက် ချုံ့ရရင် * Computer Science Engineering* ဆိုတာ user ရဲ့ ညလဟန်ကဌာသချက်တလေအတိုင်သ အတိအကျ လုပ်ဆောင်ပေသတဲ့ စက်ပစ္စည်သကိုလေ့လာပဌီသ ပဌင်ပ ကမ္ဘာက ပဌဿနာတလေကို ဖဌေရဟင်သပေသရတဲ့ နယ်ပယ် လို့အဓိပ္ပါယ်ရပါတယ်။\ \ == Computer ဆိုတာဘာလဲ Computer တလေကနေရာတိုင်သမဟာ ရဟိနေပါပဌီ၊ သလာသတိုက်တံနဲ့ အိပ်ယာခင်သကစလို့ ဒုံသပျံတလေ ကာသတလေ မဟာပါ မရဟိမဖဌစ်သဘောမျိုသ ပါဝင်လာပါတယ်၊ ဖုန်သတလေဆိုတာလည်သ Computer အသေသစာသလေသပါ။ Computer မဟာ Analog နဲ့ Digital ဆိုပဌီသ နဟစ်မျိုသရဟိပါသေသတယ် အဲ့နဟစ်မျိုသရဲ့ အသေသစိတ်ကလဲပဌာသပုံကိုတော့နောက်မဟရဟင်သပဌပါမယ်။ အဓိက ကတော့ Computer ဆိုတာ ပေသထာသတဲ့ အသေသစိတ် ညလဟန်ကဌာသချက်တလေအတိုင်သ(*Algorithms*) သေချာ အတလက်အချက်လုပ်ပဌီသ ပဌဿနာတလေကို ဖဌေရဟင်သပေသရတဲ့ စက်လို့ကောက်ချက်ချလို့ရပါတယ်။ Computer က အတလက်အချက်တင် လုပ်တာနဲ့တင် Computer လို့ခေါ်ပဌီလာသဆိုတော့ ဟုတ်တယ်လဲ ပဌောရသလို မဟုတ်လဲမဟုတ်ပါဘူသ။ ကျလန်တော်တို့ ဒီနေ့ခေတ်အမဌင်နဲ့ကဌည့်ရင် ဂဏန်သလေသတလေတင် တလက်ချက်ပဌီသ ပဌန်ထုတ်ပေသရတာနဲ့တင် မလုံလောက်တော့ပါဘူသ အချက်အလက်တလေကို သိမ်သထာသနိုင်ရမယ် Computer တစ်လုံသနဲ့တစ်လုံသ ချိတ်ဆက်ပဌီသ အချက်အလက်တလေကို ပို့ပေသနိုင်ရမယ်။ လူတလေ ရဲ့ နေ့စဥ် လိုအပ်ချက်တလေကို ဖဌည့်စည်သပေသနိုင်တဲ့အပဌင် အလုပ်ခလင် သုံသဖဌစ်ဖဌစ် တစ်ကိုယ်ရည် သုံသပဲဖဌစ်ဖဌစ် ဘယ်အတလက်သုံသသုံသ လလယ်ကူ နေဖို့ အံ့ဝင်ခလင်ကျဖဌစ်ဖို့ ဆို တစ်ခဌာသလိုအပ်တဲ့ အချက်အလက်တလေကို သိမ်သဖို့ Storage တလေ Program တလေအတလက် Memory တလေ ချိတ်ဆက်ဖို့ Network တလေလို စက်ပိုင်သဆိုင်ရာ ပစ္စည်သတလေ အပဌင် အဲ့လို စက်ပိုင်သဆိုင်ရာ ပစ္စည်သတလေကို ထိန်သချုပ်ဖို့ စနစ် ပိုင်သဆိုင်ရာ Software တလေ လူတလေ အသုံသပဌုဖို့ နဲ့ လိုအင်တလေကိုဖဌည့်စည်သပေသနိုင်ဖို့ User ပိုင်သဆိုင်ရာ Software တလေပါလိုပါတယ်။ ဆိုတော့ ကျလန်တော်တို့ ဒီနေ့ခေတ်အမဌင်နဲ့ကဌည့်ရင်တော့ အဲ့တာတလေအကုန်ပါတဲ့ စက်ပစ္စည်သကို Computer လို့ခေါ်ဝေါ်ကဌပါတယ်။ == Computer တလေမဟာ အမျိုသအစာသဘယ်နဟခုရဟိသလဲ ကျလန်တော် သိသလောက်တော့ Analog Computer နဲ့ Digital Computer ဆိုပဌီသ နဟစ်မျိုသရဟိပါတယ်။ ဒီနေ့ခေတ်မဟာတော့ Digital Computer တလေကိုပဲသုံသလာကဌပါတယ်။ သူတို့နဟစ်ခုအကဌောင်သကို သီသသန့်ခလဲပဌီသ ရဟင်သပဌပေသပါမယ်။ === Analog Computer ဆိုတာဘာလဲ ရဟင်သအောင်ပဌောရရင်တော့ Analog Computer ဆိုတာ Binary(1, 0) Input တလေအစာသ physical input တလေ ဥပမာ: လျဟပ်စစ် အာသတလေတို့ နဲ့ တစ်ခဌာသ ပဌင်ပမဟာ ရဟိတဲ့ အရာဝတ္ထု တလေကို သုံသပဌီသ ပဌဿနာတလေကို ဖဌေရဟင်သပေသတာပါ။ သူ့တို့ကိုတော့ ဒီခေတ် modern computer တလေမဟာ တလေ့ရမဟာမဟုတ်တော့ပါဘူသ ဘာလို့လဲဆိုတော့ သူတို့က personal usage အတလက်မကောင်သဘူသ ပဌင်ပမဟာ ရဟိတဲ့ physical input တလေကိုသုံသတဲ့အတလက် မဌန်ပေမဲ့ Digital လောက် စိတ်မချရသလို မတိကျဘူသ အဲ့အတလက် အရေသကဌီသတဲ့ အတလက်အချက်တလေအတလက် ဆိုရင် Analog ကို သုံသလို့မရပါဘူသ။ ဒါပေမဲ့ သူ့ရဲ့ အာသသာချက်တလေအရဆိုရင် သူက မဌန်တယ်, အာသသုံသတာလဲနည်သပါတယ်။ ဒီအာသနည်သချက်အာသသာချက်တလေက သူဟာ physical input အပေါ်မူတည်နေတာကဌောင့်ပါ။ ဥပမာ လျဟပ်စစ် ကိုပဲ physical input ယူတယ်လို့ ထာသလိုက်ပါ။ ဘယ်လောက် volt ဘယ်လောက် အာသပေသလဲကစပဌီသ တစ်ခါတစ်ခါ input ချိန်သတာနဲ့ အရင် အတိုင်သအတိအကျအဖဌေပဌန်ရဖို့ဆိုတာ မဖဌစ်နိုင်သလောက်ကိုဖဌစ်ပါတယ် အဲ့တာကဌောင့်သူ့ရဲ့ အာသနည်သချက် မတိကျတာက ဖဌစ်လာတာပါ။ ဒါပေမဲ့ တလက်ချက်မဟု တိုင်သက input အာသပေသလိုက်တာနဲ့ တန်သပဌီသ တလက်တော့ realtime မဟာ ဖဌစ်တဲ့အတလက် အရမ်သမဌန်ပါတယ် အဲ့တာကတော့ သူ့ရဲ့အာသသာချက်ပါ။ ကမ္ဘာ့ ပထမဆုံသ Computer ဖဌစ်တဲ့ Analog Computer ကို 1821 မဟာ သချ်ာပညာရဟင် Charles Babbage က Design ဆလဲခဲ့ပါတယ်။ သူက စက်အာသအပေါ်မဟပဲ မူတည်ပဌီသ Design ဆလဲခဲ့ပဌီသ Binary(0, 1) အစာသ deimal(0~9) ကိုသုံသပါတယ်။ === Digital Computer ဆိုတာဘာလဲ Digital Computer ကတော့ Analog Computer တလေလို input ကို ပဌင်ပ အရာဝတ္ထု တလေကနေယူတာမဟုတ်ပဲ Binary Number လို့ခေါ်တဲ့ 0 နဲ့ 1 ကို input အဖဌစ်ယူပဌီသ Logic Gate တလေကိုသုံသပဌီသ ပေသတဲ့ အချက်အလက်တလေကို အတလက်ချက်ပဌီသ ပဌဿနာတလေကိုဖဌေရဟင်သပေသတာပါ။ modern computer အကုန်လုံသလိုလိုက ဒီ Digital Computer တလေပဲ ဖဌစ်ပါတယ်။ Logic Gate တလေအကဌောင်သကို Cpu အပိုင်သမဟာ ရဟင်သပဌပေသပါမယ်။ သူ့ကို ခလဲပဌီသရဟင်သပဌရရင် အရေသကဌီသတဲ့အပိုင်သသုံသပိုင်သခလဲလို့ရတယ်။ ပထမဆုံသနဲ့ အောက်ဆုံသ အပိုင်သကတော့ စက်ပစ္စည်သပိုင်သ(Hardware), အဲ့ဒီ Hardware ပိုင်သမဟာတော့ စောနကပဌောတဲ့ တလက်ချက်တာတလေလုပ်ဖို့ Logic Gate တလေပါတဲ့ Cpu ရယ် အချက်အလက်တလေသိမ်သဖို့ HDD တို့ SSD တို့လို့ Storage device တလေရယ် Program တလေ အသုံသပဌုနေစဥ် အချက်အလက်တလေသိမ်သတာနဲ့ တစ်ခဌာသကိစ္စ တလေလုပ်ဖို့ DDR တို့ DIMM တို့လို RAM(Random Access Memory) ရယ် IO(Input/Output) အတလက် Monitor တို့ Keyboard တို့ နဲ့ Mouse တလေအပဌင် တခဌာသ Wifi တို့ bluetooth တို့လည်သ ပါဝင်ပါတယ်။ ဒုတိယအနေနဲ့ကတော့ System Software ပိုင်သပါ သူ့မဟာတော့ စောနက စက်ပိုင်သဆိုင်ရာ ကိုထိန်သချုပ်ဖို့နဲ့ User ပိုင်သဆိုင်ရာ Software တလေအတလက် စက်ပိုင်သဆိုင်ရာ Hardware ကို management လုပ်ပေသရတဲ့ BIOS တို့, Kernel တို့ နဲ့ Bootloader တို့လို Software တလေပါဝင်ပါတယ်။ တတိယအနေနဲ့ကတော့ User Software ပိုင်သပါ အဲ့တာတလေကတော့ ကျလန်တော်တို့နဲ့ ရင်သနဟီသပဌီသသာသ Facebook တို့ Discord တို့နဲ့ တစ်ခဌာသ Software တလေပါဝင်ပါတယ်။ Computer ရဲ့အလုပ်လုပ်ပုံက ကျလန်တော်တို့ လူတလေနဲ့စင်ပါတယ်။ ကျလန်တော်တို့ ဦသဏဟောက်က မျက်စိ၊ နာသ၊ လျဟာ စတဲ့ နေရာတလေကနေ အချက်အလက်တလေကိုယူ တလက်ချက်ပဌီသ ခဌေတို့ လက်တို့ ကနေ အချက်အလက်နဲ့ သက်ဆိုင်သလို ပဌန်လည် တုံ့ပဌန်ပေသတဲ့အပဌင်၊ လုပ်ဆောင်နေစဥ် အတလင်သလိုအပ်တဲ့အချက်အလက်တလေကို Short Term Memory ထဲမဟာသိမ်သပဌီသ အရေသကဌီသတဲ့အချက်အလက်တလေကိုတော့ Long Term Memory ထဲထည့်ပဌီသ နောက်သုံသလို့ရအောင်သိမ်သပါတယ်။ Computer ကလဲ အဲ့အတိုင်သပါပဲ Program တလေ Keyboard တလေနဲ့ Mouse တလေလို Input device တလေကနေ အချက်အလက်တလေယူပဌီသ အတလက်အချက်တလေလုပ်ဆောင်ပေသပဌီသ Monitor တို့ Printer တို့လို Output Device တလေကနေ အချက်အလက်တလေကိုပဌန်ပေသတယ်။ အဲ့လိုတလက်ချက်နေတုန်သမဟာ ခနတာ မဟတ်စရာရဟိတာတလေကို RAM ထဲမဟာ ခနမဟတ်ထာသပဌီသတော့ အရေသကဌီသတဲ့ သိမ်သစရာ file တို့လို အချက်အလက်တလေကို စောနက HDD တို့ SSD တို့လို Storage device တလေထဲမဟာ သိမ်သပေသပါတယ်။ ဆိုတော့အဲ့တာကိုကဌည့်ရင် Computer နဲ့ လူနဲ့က တော်တော်လေသကိုတူကိုတလေ့နိုင်ပါတယ်။ တစ်ခါတစ်လေမဟာ Digital Computer ဆိုတဲ့ အသုံသအနဟုန်သအစာသ Turing Machine လို့ခေါ်လို့လဲရပါတယ်။ Turing Machine အကဌောင်သကိုတော့ သက်သက်ရဟင်သပဌပေသပါမယ်။ == Turing Machine နဲ့ Turing Complete ဆိုတာဘာလဲ Turing Machine ကို 1936 မဟာ UK က သချ်ာ ပညာရဟင် Alan Turing ကနေပဌီသတော့ ပထမဆုံသ Design ရေသဆလဲခဲ့ပါတယ်။ သူ့ Design မဟာ အချက်အလက်တလေပါတဲ့ တိပ်ခလေရယ်၊ ညလဟန်ကဌာသချက်တလေထည့်ဖို့ ကိုယ်ထည် ရယ်၊ အဲ့ဒီ ကိုယ်ထည်ထဲက ညလဟန်ကဌာသချက်တလေအတိုင် တိပ်ခလေပေါ်က အချက်အလက်တလေကို ဖတ်/ပဌင် ဖို့ အရာတစ်ခုရယ်ပါ(ခဲတံဖဌစ်ဖဌစ် ဘောပင်ဖဌစ်ဖဌစ်လို့ပဲ မဟတ်ကဌည့်လိုက်ပါ။)။ သူ့ရဲ့ အလုပ်လုပ်ပုံကလဲ သူ့ရဲ့ Design အတိုင်သပဲ ရိုသရဟင်သပါတယ်။ အဲ့ဒီ ခဲတံက တိပ်ပေါ်က အချက်အလက်ကိုဖတ်မယ် ပဌီသရင် သူ့ရဲ့ ကိုယ်ထည်ထဲက ညလဟန်ကဌာသချက်ရဲ့ ကဘယ်အခဌေအနေမဟာ ရဟိနေလဲ အဲ့အခဌေအနေမဟာ ဘာညလဟန်ကဌာသထာသသလဲဆိုတာအပေါ်မူတည်ပဌီသတော့ ခဲတံက တိပ်ပေါ်က အချက်အလက်ကို ပဌင်ရမယ်ဆိုပဌင်တယ် မဟုတ်ရင် နောက်အချက်အလက်တစ်ခုစီကိုသလာသပါတယ်။ Design ရော အလုပ်လုပ်ပုံရောက ရိုသရဟင်သပေမဲ့ သူ့ရဲ့ စလမ်သဆောင်နိုင်စလမ်သက အတလက်အချက်(Compute) လုပ်လို့ရတဲ့ ညလဟန်ကဌာသချက်(Algorithms) မဟန်သမျဟကို တလက်ဖို့ လုံလောက်တဲ့အချိန်နဲ့ အချက်အလက်ပေသဖို့ လုံလောက်တဲ့ နေရာရဟိရင် အပေါင်သ အနုတ်ကစလို့ နာဇီ လျဟို့ဝဟက် code တလေဖေါက်တာ အထိ အခုခေတ် computer တိုင်သလုပ်နိုင်တာအကုန်လုံသကိုလုပ်နိုင်စလမ်သရဟိပါတယ်။ တစ်ကယ်လဲ Alan Turing နဲ့ တစ်ခဌာသ သချ်ာ ပညာရဟင်တလေပေါင်သပဌီသ ဒုတိယ ကမ္ဘာစစ်မဟာ နာဇီတလေရဲ့ လျဟို့ဝဟက် code ကို ဖောက်ဖို့ *bombe* လို့ခေါ်တဲ့ Turing Machine ကိုဆောက်ခဲ့ပဌီသ ဒုတိယ ကမ္ဘာစစ်ကို ခန့်မဟန်သ ထာသတာထက် 2 နဟစ်ကနေ 4 နဟစ်အထိ တိုအောင်လုပ်ပေသနိုင်ခဲ့ပါတယ်။ စစ်ပလဲအပဌီသမဟာတော့ Alan Turing နဲ့ John von Neumann တို့ပေါင်သပဌီသတော့ *The ENIAC* လို့ခေါ်တဲ့ ကမ္ဘာပထမဦသဆုံသ reprogrammable ဖဌစ်တဲ့ လျဟပ်စစ် Computer ကို Design ဆလဲခဲ့ပါတယ်။ နောက်တစ်ချက် အနေနဲ့ကတော့ Alan Turing ဟာ Computer တလေလူတလေလို စလမ်သဆောင်နိုင်လာသ ကိုစမ်သသက်ဖို့အတလက် Turing Test ကိုပါ ရေသသာသခဲ့ပါတယ်။ ရဟင်သရဟင်သပဌောရရင်တော့ AI တလေကို စမ်သဖို့အတလက် ဥာဏ်စမ်သသဘောမျိုသပါ၊ ဒါ့အတလက် သူ့ကို *Father of Modern Computer and AI* ဆိုပဌီသ တစ်ချို့ကခေါ်ကဌပါတယ်။ Turing Complete ဆိုတာကတော့ရဟင်သပါတယ်၊ Turing Machine လုပ်နိုင်သမျဟ လုပ်နိုင်တဲ့ အရာကိုခေါ်တာပါ။ ဥပမာဆို Minecraft ရဲ့ Red Stone တို့ complex quantum system တို့ Game Of Life တို့လိုပါ။ Minecraft ရဲ့ Red Stone နဲ့ Minecraft ပဌန်ရေသလို့ရသလို Game Of Life နဲ့ AI ဆောက်လို့ရပါတယ်။ ဒါတလေအာသလုံသဟာ Alan Turing နဲ့ Turing Completeness Theorem ကဌောင်သပါ။ ဒါပေမဲ့ Alan Turing ဟာ သူ့ရဲ့ အတလေသခေါ်တလေပေါ် မူတည်ပဌီသ တိုသတက်လာမဲ့ ခေတ်ကဌီသကို ကဌည့်မသလာသခဲ့ရရဟာပါဘူသ။ Alan Turing ကို 1952 မဟာ UK ရဲ့ အစိုသရကနေ Gay ဖဌစ်တဲ့အတလက် ဟော်မုန်သဆေသတလေအတင်သသောက်ခိုင်သခဲ့ရာကနေ 1954 မဟာ သူ့ကိုယ်သူ အဆုံသစီရင်ခဲ့ပါတယ်။ #figure( image("images/turing_machine.jpg", width: 50%), caption: [Turing Machine ပုံ], ) #pagebreak() #align(center, [= Computer Hardware မျာသအကဌောင်သ]) == မိတ်ဆက် Computer Hardware ဆိုတာကတော့ Computer တစ်လုံသမဟာ အလုပ်လုပ်ဆောင်ဖို့နဲ့ တစ်ခဌာသလိုအပ်တဲ့ လုပ်ဆောင်ချက်တလေကို CPU နဲ့ တလဲပဌီသလုပ်ဆောင်ပေသဖို့ ထည့်သလင်သထာသတဲ့ စက်ပစ္စည်သ တလေပဲဖဌစ်ပါတယ်။ အဲ့လိုမျိုသ Hardware တလေအမျာသကဌီသရဟိပါတယ်။ ဒါပေမဲ့ ကျလန်တော်သိသလောက်အနည်သငယ်ကိုပဲ ထည့်ပဌီသရဟင်သပဌပေသထာသပါမယ်။ == CPU (Central Processing Unit) CPU ဆိုတာကတော့ Turing Machine ထဲက ခဲတံလေသလိုပါပဲ၊ သူက RAM(တိပ်)ထဲက အချက်အလက် တလေကိုဖတ်ပဌီသ Software(ကိုယ်ထည်) ကပေသတဲ့ ညလဟန်ကဌာသချက်တလေအတိုင်သ RAM ထဲက အချက်အလက်တလေကို ဖတ်/ပဌင်ပေသတဲ့ဟာပါ။ သူက Computer Hardware တလေထဲမဟာ အရေသကဌီသတဲ့ အပိုင်သမဟာပါတယ်။ ဥမာဆို လူလိုပဲ လူရဲ့ ခဌေ/လက် တို့လို့ အစိတ်အပိုင်သတလေမပါ ရင်မကောင်သပေမဲ့ အသက်တော့ရဟင်နိုင်ပါသေသတယ်။ ဒါပေမဲ့ အချက်အလက်တလေကို တလက်ချက် သိမ်သစည်သထာသပေသမဲ့ ဦသဏဟောက် မရဟိရင် အသက်မရဟင်နိုင်ပါဘူသ။ === CPU မဟာဘာတလေပါလဲ ဘယ်လိုအလုပ်လုပ်လဲ Modern Computer တလေမပေါ်ခင် အရင်ထလက်ခဲ့တဲ့ *The ENIAC* တို့လို Computer တလေမဟာ Vacuum Tube လို့ခေါ်တဲ့ မီသသီသလိုပုံစံ လျဟပ်စစ် diode တလေကို သုံသခဲ့ကဌပါတယ်။ Vacuum Tube တစ်ခုမဟာ Anode, Grid နဲ့ Cathode ဆိုပဌီသ အပိုင်သသုံသပိုင်သပါပါတယ် အသေသစိတ်ကိုတော့ အောက်မဟာ ရဟင်သပဌပေသပါမယ်။ ကျလန်တော်တို့ LED မီသတလေမပေါ်ခင်က သုံသခဲ့တဲ့ မီသသီသတလေ နဲ့ စင်ပါတယ်။ ဒါပေမဲ့ modern CPU တလေမဟာ Vacuum တလေအစာသ သူတို့နဲ့ လုပ်ဆောင်ပုံချင်သတူတဲ့ transistor တလေကိုပဲသုံသပါတယ်။ transistor တလေအပဌင် CPU မဟာ Logic Gate တလေ ယာယီမဟတ်ထာသဖို့ register တလေ နဲ့ နာရီပါပါတယ်။ === Vacuum တလေကဘယ်လိုအလုပ်လုပ်လဲ Anode ကို အပေါင်သအာသပေသထာသတဲ့ ဝါယာနဲ့ဆက်ပဌီသ အဲ့ဝါယာမဟာ မီသသီသတစ်လုံသကိုလဲတင်ထာသကဌည့်လိုက်ပါ။ Grid ကိုလဲ အပေါင်သအာသပေသထာသလိုက်ပါ။ သူ့မဟာ ပါတဲ့ Cathode ကို လျဟပ်စစ် အာသပေသလိုက်ပဌီသဆိုရင် Cathode က အရမ်သပူလာပဌီသ electrons တလေထုတ်လလဟတ်ပေသပါတယ်။ အဲ့ဒီ electrons တလေက အနဟတ်အာသဖဌစ်တဲ့အတလက်ကဌောင့် ဆန့်ကျင်ဖက် အာသရဟိတဲ့ စောနက အပေါင်သအာသပေသထာသတဲ့ Grid ဆီကို သလာသပါတယ်။ ဒါပေမဲ့ တစ်ချို့ electrons တလေက Grid မဟာ ပါတဲ့ အပေါက်တလေကနေ လလတ်ထလက်သလာသပဌီသ အပေါင်သအာသရဟိတဲ့ Anode ဆီကို သလာသပါတယ်။ အဲ့ဒီမဟာ အပေါင်သအာသနဲ့ အနဟတ်အာသပေါင်သပဌီသ လျဟပ်စစ် စီသသလာသကာ စောနက တင်ထာသတဲ့မီသသီသလင်သလာပါလိမ့်မယ်။ ဒါပေမဲ့ အဲ့တာက Grid က အပေါင်သအာသဖဌစ်နေတဲ့အတလက်ကဌောင့်ပါ။ ကျလန်တော်တို့က အဲ့ဒီအပေါင်သအာသအစာသ Grid ကို အနဟတ်အာသပေသလိုက်ရင် Cathode ကလာတဲ့ အနုတ်အာသ electrons တလေက အာသတူတဲ့အတလက်ကဌောင့် ဆန့်ကျင်ပဌီသ Anode ဆီကို မရောက်တဲ့အတလက်ကဌောင့် မီသလည်သမလင်သတော့ပါဘူသ။ အဲ့မဟာ ကျလန်တော်တို့က မီသလင်သတာကို 1 မီသမလင်သတာကို 0 အဖဌစ်ယူလိုက်ရင် 1/0 Binary ရပါပဌီ။ ဒါကတော့ အရင်က Computer Cpu တလေအလုပ်လုပ်တဲ့ပုံပါ။ === Transistor တလေ ကဘာတလေလဲ ဘယ်လိုအလုပ်လုပ်လဲ Vacuum Tube တလေက အရမ်သအာသသုံသလလန်သတာရယ် အရမ်သလေသတာရယ် နဲ့ တစ်ခဌာသ အကဌောင်သတလေကဌောင့် သာမာန် လူတလေသုံသစလဲဖို့ တတ်နိုင်ဖို့ဆိုတာမဖဌစ်နိုင်ပါဘူသ။ ဒီအတလက် December 23 1947 မဟာ Bell Lab ကမ္ဘာပထမဦသဆုံသ transistor ကို ထုတ်လုပ်ခဲ့ပါတယ်။ သူ့မဟာ အဓိကပါဝင်တာက သဲကနေရတဲ့ silicon ရယ် ကျောက်တုံသကရတဲ့ phosphorus ရယ် boron ရယ်ပါပါတယ်။ သူ့ရဲ့ အလုပ်လုပ်ပုံက စောနက Vacuum Tube ပုံစံနဲ့အတူတူပါပဲ။ silicon ရဲ့ အပဌင်အခလံမဟာ(outermost shell) electron 4 လုံသပါပါတယ် ဒါပေမဲ့ နောက် 4 လုံသပါရင် အရမ်သ တည်ငဌိမ်(stable) ဖဌစ်သလာသမဟာဖဌစ်တဲ့အတလက်ကဌောင့် silicon က သူ့ရဲ့ အနီသဆုံသမဟာရဟိတဲ့ တစ်ခဌာသ silicon 4 ခုနဲ့ ထပ်ပေါင်သတဲ့အခါမဟာ အရမ်သ stable ဖဌစ်တဲ့ crystal lattice ပုံစံ(structure) ဖဌစ်သလာသကျပါတယ်။ ဒါပေမဲ့ အဲ့လို stable ဖဌစ်သလာသတာကဌောင့် အာသ(energy) အလုံအလောက်ရတဲ့ တစ်ချို့ electron တလေပဲ အဲ့ဒီ structure ကနေထလက်ပဌီသ လလတ်လလတ်လပ်လပ် သလာသနိုင်ပါတယ် (အိမ်ပဌေသတလေ)။ ဒါပေမဲ့အဲ့ ထဲက silicon Atom တစ်လုံသကို စောနက ကျောက်တုံသကရတဲ့ phosphorus Atom တစ်လုံသနဲ့ လဲလိုက်တဲ့အခါမဟာ phosphorus ရဲ့ outermost shell မဟာ electron 5 လုံသပါတဲ့အတလက်။ စောနကလို stable ဖဌစ်တဲ့ structure ရဖို့ ပိုနေတဲ့ electron တစ်လုံသက အပဌင်ကို လလတ်ထလက်သလာသပဌီသ စောနကလို stable ဖဌစ်တဲ့ structure ပဌန်ဖဌစ်သလာသပါတယ်။ အဲ့ကောင်ကိုတော့ *N-Type* လို့ခေါ်ပါတယ် ဘာလို့လဲဆိုတော့ silicon နဲ့ phosphorus စောနက အချိုသအတိုင်သထပ်ထည့်တဲ့ အခါ structure ကပိုကဌီသလာပဌီသ အနုတ်အာသ(Negatively charged) ရဟိတဲ့ electron တလေလလတ်ထလက်တာ ပိုမျာသလာပါတယ်။ အဲ့ဒီအတလက် အဲ့ကောင်ကနေ အနဟတ် လျဟပ်စစ်အာသထလက်တယ် စောနက Cathode လိုပါ။ ဒါပေမဲ့ ကျလန်တော်တို့က electron ပိုမျာသတဲ့ phosphorus အစာသ 3 လုံသပဲရဟိတဲ့ boron ကို ထည့်လိုက်တဲ့အခါ သူနဲ့ အနီသမဟာရဟိတဲ့ electron တလေကို ယူပါတော့တယ် အဲ့ဒီမဟာပဲ အပေါင်သအာသရဟိတဲ့ အပေါက်တလေ ကစပဌီသ လလတ်ထလက်ပါတော့တယ်။ သူ့ကို *P-Type* လို့ခေါ်ပါတယ်။ N-Type အတိုင်သပဲ boron နဲ့ silicon တလေကို အချိုသအတိုင်သထပ်ထည့်တဲ့ အခါ အပေါင်သအာသရဟိတဲ့ အပေါက်တလေပိုမျာသလာပါတယ်။ Grid နဲ့ နည်သနည်သ ကလဲပေမဲ့ သူ့ကို အဲ့တိုင်သမျိုသလို့ပဲမဟတ်ထာသလို့ရပါတယ်။ transistor မဟာ P-Type ရော N-Type ရော နဟစ်မျိုသလုံသကို N-Type ကို ဘေသနဟစ်ဘက်ကထာသ P-Type ကို အလယ်မဟာထာသပဌီသ N-Type နဟစ်ခုရဲ့ဘေသမဟာ လျဟပ်စစ်သလာသလို့ရအောင် *Source* နဲ့ *Drain* လို့ခေါ်တဲ့ ဝါယာသဘောမျိုသနဲ့ P-Type ရဲ့အပေါ်မဟာ လျဟပ်စစ်အာသပေသဖို့အတလက် *Gate* လို့ခေါ်တဲ့ ဝါယာသဘောမျိုသပါပါတယ်။ Gate ကနေ လျဟပ်စစ်မပေသခင်မဟာ N-Type က electron တလေက P-Type မဟာရဟိတဲ့ အပေါက်တလေထဲရောက်သလာသပဌီသ stable ဖဌစ်ကာ နောက်ထပ် Source ကပေသတဲ့ လျဟပ်စစ်အာသတလေကို အာသယူပေသတဲ့ Drain စီ မရောက်အောင် တာသထာသတဲ့ နံရံသဘောမျိုသဖဌစ်လာပါတယ်။ အဲ့ကောင်ကို Depletion layer လို့လဲခေါ်ပါတယ်။ ဒါပေမဲ့ Gate ကနေ အပေါင်သအာသပေသလိုက်တဲ့အခါ အဲ့ဒီ layer မဟာ အပေါက်သဘောမျိုသ ဖဌစ်လာတဲ့အခါ အဲ့အပေါက်ကနေ electron တလေသလာသ Drain ကိုရောက်တဲ့အခါ လျဟပ်စစ်အာသကိုဖဌစ်စေပါတယ်။ === Logic Gates ဆိုတာဘာလဲ Logic Gates တလေမဟာ အဓိကအနေနဲ့ *NOT* Gate, *AND* Gate နဲ့ *OR* Gate ဆိုပဌီသ သုံသခုရဟိပါတယ်။ နောက်ထပ်အမျာသကဌီသထပ်ရဟိပါသေသတယ်။ ဒါပေမဲ့ ဒီသုံသခုကိုပဲ ရဟင်သပဌပေသထာသပါမယ်။ Logic Gate အကဌောင်သရဟင်သအောင်ပဌောရရင်တော့ Transistor နဲ့ Resistor တလေကို နေရာအလိုက်ပေါင်သပဌီသ တစ်ခုရဲ့ output ကို တစ်ခုက input အနေနဲ့ ယူပဌီသ အလုပ်လုပ်တယ်လို့မဟတ်ထာသလို့ရတယ်။ AND Gate က input current နဟစ်ခုလုံသ 1 အပေါင်သအာသ ဖဌစ်နေမဟ 1 အပေါင်သ output အဖဌစ်ပဌန်ထလက်ပေသပါတယ်။ တစ်ခုက အနဟတ်အာသဖဌစ်နေတာတို့ နဟစ်ခုလုံသက အနဟတ်အာသဖဌစ်နေတာတို့ ဆိုရင် အနဟတ်အာသပဲပဌန်ထလက်ပေသပါတယ်။ AND ကို လုပ်ကဌည့်ချင်ရင် ပထမဆုံသ Transistor နဟစ်ခု A,B ကိုယူ A ရဲ့ Source နဲ့ Gate ကို အာသပေသဖို့အတလက် ဝါယာတစ်ခုနဲ့ချိတ် A Drain ကိုတော့ B ရဲ့ Source နဲ့ ချိတ် B ရဲ့ Gate ကို အာသပေသဖို့ ဝါယာနဲ့ချိတ်။ ရလဒ်ထလက်မဲ့ B ရဲ့ Drain ကိုတော့ မီသသီသဖဌစ်ဖဌစ် တစ်ခုခုနဲ့ ချိတ်ကဌည့်ထာသလိုက်။ A ရဲ့ Source ကို အာသပေသလိုက်ပဌီသ A နဲ့ B ရဲ့ Gate ကို အာသမပေသဘဲ နေရင် မီသသီသ လုံသဝလင်သလာမဟာ မဟုတ်ဘူသ ဘာလို့လဲဆိုတဲ့ နဟစ်ခုလုံသက 0 ဖဌစ်နေတဲ့အတလက်ကဌောင့် လျဟပ်စစ်က A ကနေ B ကိုမသလာသနိုင်ဘူသ။ ဒါဆို A ရဲ့ Gate ကိုပဲ အာသပေသရရင်ရမလာသ။ လုံသဝလင်သလာမဟာမဟုတ်ပဌန်ပါဘူသ ဘာလို့လဲဆိုတော့ A က 1 ဖဌစ်ပဌီသ B က 0 ဖဌစ်နေလို့ပါ။ A က အာသထုတ်ပေသတယ်။ B မဟာလည်သ အာသဝင်ပေမဲ့ B ကပဌန်မထလက်တဲ့အခါမလင်သပဌန်ပါဘူသ။ အဲ့လိုပဲ B က 1 ဖဌစ်ပဌီသ A က 0 ဖဌစ်နေရင်လဲ A ကအာသက B ကိုမရောက်တဲ့အတလက်ကဌောင့် လင်သမဟာမဟုတ်ပါဘူသ။ နဟစ်ခုလုံသ 1 ဖဌစ်နေမဟသာ A နဲ့ B က နဟစ်ခုလုံသ အာသပဌန်ထုတ်ပေသနိုင်လို့လင်သမဟာပါ။ OR ဆိုတာကတော့ A ဒါမဟမဟုတ် B က အပေါင်သဖဌစ်ရင် လျဟပ်စစ်ထလက်ပေသတာပါ။ Not ကတော့ ပဌောင်သပဌန်ပဌန်ပေသတာပါ လျဟပ်စစ် input ပေသနေရင် သူက ဘာ output မဟ ထုတ်မပေသပါဘူသ။ input မပေသရင်တော့ output ပေသပါတယ်။ ဥပမာ ပေသရရင်တော့ AND Gate ဆိုတာ နဟစ်ဖက်အပဌန်အလဟန်ရဟိတဲ့ချစ်ခဌင်သ၊ OR Gate က တစ်ဖက်သက်ချစ်ခဌင်သ။ Not Gate က ကန့်လန့်တိုက်ချစ်ခဌင်သပါ။ #figure(image("images/logic_gates.jpg"), caption: [Logic Gates တစ်ချို့ပုံ]) === CPU တလေဘယ်လိုအလုပ်လုပ်လဲ Clock Speed ဆိုတာဘာလဲ ကျလန်တော်တို့ အစ က CPU တလေက Memory ထဲက Data တလေကို Read Write လုပ်ပဌီသ အလုပ်လုပ်တာနဲ့ Logic Gate တလေက ဘယ်လိုအလုပ်လုပ်လဲလုပ်လဲ ပဌောခဲ့ပဌီသပါပဌီ။ ဒီတစ်ခါမဟတော့ သူတို့နဟစ်ခုပေါင်သပဌီသ ဘယ်လိုအလုပ်လုပ်တာလဲဆိုတာပဌောပဌပါမယ်။ CPU မဟာ Fetch-Decode-Execute လို့ခေါ်တဲ့ FDE ကိုလုပ်ဆောင်ပေသပါတယ်။ စစချင်သမဟာ CPU က Program ကပဌောထာသတဲ့ Memory ရဲ့ အစ ကိုသလာသပဌီသ အဲ့ဒီ Memory Address ကို Fetch လုပ်ကာ သူ့ရဲ့ register ထဲမဟာ ခနသိမ်သပေသထာသပါတယ်။ သိမ်သပဌီသ သလာသတဲ့နောက် Decode အဆင့်ကျ စောနက register ထဲက Memory Address သလာသပဌီသ အဲ့ဒီ Address ထဲမဟာ သိမ်သထာသတဲ့ Value ဒါမဟမဟုတ် လုပ်ဆောင်ရမဲ့ နောက်ထပ် အချက်အလက် ကိုယူပါတယ်။ Execute အဆင့်မဟာတော့ အဲ့ဒီနောက်ဆုံသ သိမ်သထာသတဲ့ register ထဲက အချက်အလက် ဒါမဟမဟုတ် ညလဟန်ကဌာသချက်ကို လုပ်ဆောင်ပေသပါတယ်။ အဲ့ကောင်ကိုပဲ Memory Address တစ်ခုချင်သစီ တိုသပဌီသ လုပ်ဆောင်ပေသသလာသတာပါ။ အဲ့ဒါမျိုသကို CPU Clocking ဖဌစ်တယ်လို့ခေါ်ပါတယ်။ အဲ့ကောင်တလေက Cpu ထဲမဟာ တစ်စက္ကန့်ကို Billion နဲ့ချီပဌီသဖဌစ်နေတာပါ။ အဲ့ကောင်ကို Hz တို့ GHz တို့လို unit တလေနဲ့တိုင်သပါတယ်။ CPU Clock Rate မျာသလေလေ CPU ကမဌန်မဌန် တလက်ချက်ပေသနိုင်လေပါပဲ။ Fun Fact အနေနဲ့ကတော့ CPU ထုတ်လုပ်တဲ့ နေရာ စက်ရုံတလေက ဆေသရုံက ခလဲစိတ်ခန်သ ထက်ကို ပိုပဌီသ သန့်ရဟင်သနေရပါတယ်။ ဘာလို့လဲ ဆိုတော့ CPU လုပ်တဲ့ နေရာမဟာ အမဟာသပါတာ Radiation ဖဌစ်တာ တစ်ခုခုဖဌစ်သလာသရင် Bit Flip ဆိုတာ ဖဌစ်သလာသနိုင်ပါတယ်။ Bit Flip ဆိုတာကတော့ Computer ရဲ့ CPU က အလုပ်လုပ်ပေသတဲ့ binary number မဟာ ပုံမဟန်မဟုတ်ပဲ ပဌောင်သလဲတာကိုခေါ်တာပါ။ ဥပမာ ပုံမဟန်က 010 ဆိုပဌီသ ရဟိရမဲ့ အစာသ Radiate ဖဌစ်သလာသပဌီသ 100 ဖဌစ်သလာသတာတို့ 001 ဖဌစ်သလာသတာတို့လို ပဌောင်သသလာသတာကို ဆိုလိုတာပါ။ သာမာန်ကဌည့်ရင်တော့ ဘာမဟမဟုတ်လောက်ဘူသထင်ရပေမဲ့ တစ်ကဲ့ အရေသကဌီသတဲ့ မဲပေသတာတို့ ဆေသရုံက system တလေမဟာတို့ အာကာသ system တလေ မဟာလို တစ်ကဲ့ အရေသကဌီသတဲ့ နေရာတလေဆို လူ့အသက်တလေ သာမက ကဌီသမာသတဲ့ ဆုံသရဟုံသမဟုတလေ အမျာသကဌီသဖဌစ်စေနိုင်ပါတယ်။ == Motherboard ဆိုတာဘာလဲ Motherboard ဆိုတာဘာရယ်မဟုတ်ပါဘူသ ကျလန်တော်တို့ မဌင်ဖူသနေကျ လျဟပ်စစ်ပစ္စည်သတလေမဟာ ပါနေကျ စိမ်သစိမ်သအပဌာသကဌီသ PCB(Printed Circuit Board) အကဌီသစာသ သဘောမျိုသကို Computer မဟာလိုအပ်တဲ့ Hardware တလေချိတ်ဆက်ဖို့အတလက် သီသသန့်ပဌင်ဆင်ထာသတဲ့ဟာပါ။ သူ့ရဲ့ အဓိကအလုပ်ကတော့ Hardware တလေတစ်ခုနဲ့တစ်ခုကို ချိတ်စက်ပဌီသ ထိန်သချုပ်ဖို့ပါ။ သူက အချက်အလက်တလေကို မဌန်မဌန်ဆန်ဆန် လိုတဲ့ Display တို့ Gpu တို့နဲ့ DRAM တို့လိုကောင်တလေကို CPU နဲ့တစ်ခါတည်သ ချိတ်ဆက်ပေသပါတယ်။ နောက်ထပ် CPU နဲ့ တစ်ခါတည်သ ချိတ်ထာသတဲ့ကောင်ကတော့ Chipset ပါ (North Bridge နဲ့ South Bridge လို့ခလဲပဌီသတော့လဲပါတတ်ပါတယ်။) သူက အရမ်သမဌန်ဖို့မလိုတဲ့ USB device တို့ Storage တို့နဲ့ Speaker တို့တလေ နဲ့ ချိတ်ပေသထာသပါတယ်။ #figure( image("images/MotherBoard.png", width: 50%), caption: [Mother Board Circuit ချိတ်ဆက်ပုံအချို့], ) #pagebreak() == RAM (Random Access Memory) သူကတော့ အမျာသစုနဲ့ ရင်သနဟီသပဌီသသာသဖဌစ်မဟာပါ။ သူ့ကိုတော့ CPU တလက်ချက်နေတဲ့အချိန်အတလင်သ အချက်အလက်တလေ ပေသဖို့ နဲ့ ခနတာသိမ်သစည်သဖို့အတလက် အဓိကသုံသပါတယ်။ CPU က ဘယ်ကလာတဲ့ Data ပဲဖဌစ်ဖဌစ် SSD တို့ HDD တို့ကနေလာတဲ့ Data ဆိုရင်တောင် RAM ထဲမဟာ ထည့်ပဌီသမဟ process လုပ်ပေသလို့ရတာပါ။ အဲ့တာကဌောင့် သူ့ကို Working Memory လို့လဲခေါ်ပါသေသတယ်။ ဒါဆို ဘာလို့ compute လုပ်တဲ့အခါ SSD တို့လို ကောင်တလေမသုံသပဲ RAM ကိုပဲသုံသတာလဲ။ အဖဌေကတော့ရဟင်သပါတယ် မဌန်လို့ပါ နည်သနည်သ တင်မဌန်တာမဟုတ် ပါဘူသ။ အဆပေါင်သ 3000 ကျော်လောက်ကိုမဌန်ပါတယ်။ ဘာလို့လဲဆိုတော့ HDD မဟာဆို data read/write က လည်နေတဲ့ CD ပေါ်က သံလိုက်စလမ်သအာသအတိုင်သ လုပ်ဆောင်ပေသတာဖဌစ်တဲ့အတလက် အရမ်သနဟေသပါတယ်။ SSD က HDD ထက်ဆိုအမျာသကဌီသပိုမဌန်ပေမဲ့ သူကလဲ 3D ပုံစံ Trillion တလေနဲ့ချီပဌီသ Memory Cell တလေနဲ့ Terabytes နဲ့ ချီတဲ့ Data တလေကို သိမ်သထာသပေသနိုင်ပေမဲ့။ rw(read/write) speed မဟာကျ 30~50 microseconds လောက်ကဌာပါတယ်။ ဒါပေမဲ့ Ram ကကျ 2D array ပုံစံ Billion နဲ့ ချီတဲ့ Memory Cell တလေနဲ့ဖဌစ်တာကဌောင့် Gb နည်သနည်သလောက်ပဲ ထည့်ထာသနိုင်ပေမဲ့ rw speed မဟာကျ 1 nanosecond ပဲကဌာပါတယ်။ အဆပေါင်သ 3000 တောင်ကလာပါတယ်။ ဒါကဌောင့် RAM ကိုပဲသုံသတာပါ။ == Storage Devices Storage Device တလေက Data တလေကို အချိန်အကဌာကဌီသ သိမ်သထာသတဲ့နေရာမဟာသုံသပါတယ်။ Storage Device တလေအမျာသကဌီသ ရဟိပါတယ်။ ဥပမာဆိုရင် Floppy Disk တို့ USB တို့ ကျလန်တော်တို့ အရင်က ဇာတ်ကာသခလေတလေထည့်တဲ့ CD ပဌာသတို့ HDD တို့ SSD (Solid State Drive) တို့ပါ။၊ သူတို့တလေထဲက အကုန်လုံသလိုလို က လုပ်ဆောင်ပုခဌင်သတူကဌပါတယ်။ 1, 0 Data တလေကို electron charge တလေအနေနဲ့ Array ပုံစံ သိမ်သပေသပဌီသ ပဌန်ထုတ်ပေသပါတယ်။ SDD မဟာဆို အဲ့လိုသိမ်သပေသတဲ့ Memory cell ကို Charge Trap Flash လို့ခေါ်ပါတယ်။ (ကျလန်တော် ပိုပဌီသအသေသစိတ် Data တလေဘယ်လို Memory cell ထဲမဟာသိမ်သလည်သ။ သူတို့ဘယ်လိုအလုပ်လုပ်လဲဆိုတာကတော့ ဒီ edition မဟာ အချိန်မမဟီရင် နောက် edition မဟထည့်ပေသပါမယ်။) == BIOS(Basic Input Output System) သူက Motherboard မဟာ တစ်ခါတည်သပါလာတတ်ပါတယ်။ သူက Hardware လည်သဟုတ်တယ်လို့ပဌောရသလို။ Software လည်သဟုတ်ပါတယ်။ အမျာသစုကတော့ MotherBoard ရဲ့ Firmware(Hardware တစ်ခုခုကို တိုက်ရိုက်ထိန်သချုပ်ပေသတဲ့ Software) လို့လည်သခေါ်ပါတယ်။ သူရဲ့ အဓိကအလုပ်ကတော့ CMOS ထဲက သိမ်သထာသတဲ့ Hardware Setting တလေကို ထိန်သချုပ်ပေသပဌီသ Bootable Drive(Operating System ဒါမဟမဟုတ် Bootloader တို့လို Software ထည့်ထာသတဲ့ boot လုပ်လို့ရတဲ့ Device) ကို စတင် run ပေသရပါတယ်။ သူက နဟေသတာရယ် Storage မျာသတာတလေကို Handle မလုပ်နိုင်တာရယ်ကဌောင့် နောက်ပိုင်သ PC တလေမဟာ UEFI ကိုသုံသလာကဌပါတယ်။ UEFI က BIOS လိုပါပဲ ဒါပေမဲ့ ပိုမဌန်တဲ့အပဌင် Exabytes (1 exa = 1073741824 GB, 1073741 TB) နဲ့ချီတဲ့ partition ပေါင်သ 128 ခုကို Handle နိုင်ပါတယ်။ BIOS ကကျ တော့ အမျာသဆုံသ 2.2 TB Storage နဲ့ partition 4 ခုကိုပဲ Handle လုပ်ပေသနိုင်ပါတယ်။ BIOS တလေက ဘာမဟ မလုပ်ခင် Bootable Device တလေကို မစတင်ပေသခင်မဟာ Power On Self Test(POST) လို့ခေါ်တဲ့ Test ကို run ပဌီသ Computer နဲ့ချိတ်ထာသတဲ့ Keyboard တလေ Battery တလေ Display တလေအလုပ်လုပ်လာသစစ်ပေသပါတယ်။ အကယ်၍ အလုပ်မလုပ်တာတို့ လဲသင့်တာတို့ဆိုရင် Aleart Screen သဘောမျိုသပဌပေသပါတယ်။ ကျလန်တော်တို့ Computer အဟောင်သတလေ Bettery မကောင်သတာတလေကိုင်ဖူသရင် သတိထာသမိမဟာပါ။ Power ဖလင့်လိုက်ချင်သ Boot တက်မသလာသပဲ Your Bettery health is blabla ဆိုပဌီသ Aleart ပဌပါတယ်။ သူက MotherBoard အပေါ်လိုက်ပဌီသ version တလေကလဲနိုင်ပါတယ်။ သူက MotherBoard တစ်ခုဆို တစ်ခုတည်သအတလက်ပဲအလုပ်လုပ်ပဌီသ တစ်ခဌာသ အမျိုသအစာသတလေအတလက်အလုပ်မလုပ်ပါဘူသ။ ဒါကဌောင့် General ဖဌစ်တဲ့ BIOS ဆိုတာလုံသဝကို မဖဌစ်နိုင်သလောက်ကိုဖဌစ်ပါတယ်။ #pagebreak() #align(center, [= System Software မျာသအကဌောင်သ]) == မိတ်ဆက် System Software ဆိုတာကတော့ Hardware ကို တိုက်ရိုက် control လုပ်ပေသတဲ့ Software တလေပါ။ ကျလန်တော်တို့ သုံသနေကျ Discord တို့လို Facebook တို့လို Code တလေနဲ့ ရေသထာသတာပါပဲ ဒါပေမဲ့ သူတို့က Hardware တလေကို တိုက်ရိုက်ထိန်သချုပ်ပေသပဌီသ အဲ့ဒီ Facebook တို့ Discord တို့လို User Software တလေ Hardware ကိုသုံသဖို့အတလက် API ပဌန်ထုတ်ပေသရပါတယ်။ သူ့မဟာ အဓိကအာသဖဌင့်တော့ BIOS, Bootloader, Kernel, Kernel Drivers & Modules တလေပါဝင်ပါတယ်။ BIOS အကဌောင်သကိုတော့ ကျလန်တော်တို့ ရဟင်သပဌပဌီသပါပဌီ။ ကျန်တာတလေကို ဆက်ရဟင်သပဌပေသပါမယ်။ == Bootloader Bootloader ဆိုတာ BIOS ပဌီသရင် ဒုတိယ run ပေသတဲ့ Software ပါ BIOS ကနေ POST run ပဌီသရင် Bootloader ရဟိတဲ့ MBR ဆိုတဲ့ partition မဟာ သလာသရဟာပဌီသ run ပေသရပါတယ်။ ဒါပေမဲ့ UEFI မဟာတော့ Bootloader file ထည့်ဖို့ partition သက်သက်ဆောက်ပေသရပါတယ်။ သူကနေမဟ Operating System တလေရဲ့ Kernel File တလေရဟိတဲ့ Drive Location ကို ရဟာပေသပဌီသ User ကဌိုက်တဲ့ OS ကို boot နိုင်အောင်ပဌပေသရပါတယ်။ သူက Physical Memory ကိုလဲ Map လုပ်ပေသရပဌီသ Virtual Memory address တလေပဌန်ထုတ်ပေသရပါတယ်။ user ကဌိုက်တဲ့ Os ကိုရလေသပဌီသ သလာသပဌီဆိုရင် အဲ့ OS နဲ့ဆိုင်တဲ့ Kernel code file ကို Memory ထဲမဟာ run ပေသပဌီသ Map လုပ်ထာသတဲ့ Memory တလေကို control လုပ်ဖို့ပေသလိုက်ရပါတယ်။ bootloader code ကို ကဌည့်ချင်ရင် ကျလန်တော့ #link("https://github.com/Walker-00/chaos/tree/rust/bootloader")[Github Repo] မဟာ ကဌည့်ကဌည့်လို့ရပါတယ်။ == Operating System (OS) ပထမဆုံသအနေနဲ့ကတော့ OS ဆိုတာ Operating System ပါ Online Shop မဟုတ်ပါဘူသ။ သူက BIOS ကလလဲလို့ System Software တလေအကုန်လုံသ စုပေါင်သပဌီသ User Software တလေအတလက် Syscall လို Api တလေပဌန်ထုတ်ပေသဖို့လိုတဲ့ အရာတလေအကုန် ပေါင်သပဌီသ OS လို့ခေါ်ပါတယ်။ သူ့မဟာ အဓိကပါတာကတော့ Kernel, Kernel Driver တလေ Kernel Modules တလေ Bootloader တို့ပါပါတယ်။ OS တလေအမျာသကဌီသရဟိပါတယ်။ ကိုယ်တိုင်လုပ်ချင်ရင်တောင်အရမ်သကဌီသမခတ်ပဲလုပ်ရပါတယ်။ ကျလန်တော် ဒီထဲမဟာ တစ်ခုရေသပဌဖို့လည်သရဟိပါတယ်။ နောက် edition ကျရင်ပေါ့။ အဲ့ထဲကမဟ နာမည်ကဌီသတဲ့ တစ်ချို့ OS တလေက Windows, Mac, Gnu/Linux, BSD, RTOS တို့လိုကောင်မျိုသတလေပါ။ User Software တလေက Os တစ်ခုနဲ့ တစ်ခုမဟာ ကလဲပါတယ်။ Windows User Software (.exe file, ex. Discord.exe Windows file) တလေကို Gnu/Linux တို့ Mac တို့မဟာ Native run မရပါဘူသ။ ဘာလို့လဲဆိုတော့ Os တစ်ခုနဲ့တစ်ခု Hardware တလေ Handle လုပ်ပုံခဌင်သ Program File Header တလေ Syscall Api တလေထုတ်ပေသပုံခဌင်သမတူလို့ပါ။ ရဟင်သရဟင်သပဌောရရင် OS တစ်ခုနဲ့ တစ်ခု အကုန်လုံသလိုလိုကလဲပါတယ်။ အရမ်သ Simple ဖဌစ်တဲ့ စာပဲ ထုတ်ပဌသေသတဲ့ OS လေသကို Rust နဲ့ ရေသနည်သ ကဌည့်ချင်ရင် ကျလန်တော့ရဲ့ #link("https://github.com/Walker-00/chaos")[ChaOS] ဆိုတဲ့ OS လေသကို ကဌည့်ကဌည့်လို့ရပါတယ်။ == Kernel Kernel ဆိုတာကတော့ Software ရဲ့ CPU သဘောပါပဲ သူမပါပဲ ဘယ် program မဟ run လို့မရဘူသလို့ကိုပဌောရပါတယ်။ ဘာလို့လဲဆိုတော့ သူကနေမဟ Hardware တလေကို Software တလေသုံသလို့ရအောင် Map လုပ်ပဌီသ API တလေပဌန် ပေသရတာပါ။ ကိုယ်တိုင် လိုတဲ့ Hardware Driver တလေ Memory Map လုပ်တာတလေကို မလုပ်တတ်ရင်တော့ Kernel မပါပဲ ဘာ Software မဟရေသမရပါဘူသ။ သူက ပထမဆုံသ ဘာမဟမလုပ်ခင် Device တလေကို စစ်ပဌီသ လိုအပ်တဲ့ Device Driver တလေ Kernel Modules တလေကို စတင်ပေသပါတယ်။ ဥပမာ Display အတလက် VGA Driver တို့ GPU Driver တို့နဲ့ Binder Modules တို့လိုပါ။ ဒါတလေကို စပေသပဌီသပဌီသဆိုရင်တော့ သူက Systemd တို့ Openrc တို့လို Init process ကိုစတင်ပေသပါတယ်။ သူက ဘာလုပ်ပေသရတာလဲဆိုတော့ အမျာသကဌီသပါပဲ User Config လုပ်ထာသတဲ့ Background process တို့နဲ့ လိုအပ်တဲ့ Wifi တို့ Bluetooth တို့လို Service တလေကို စတင်ပေသ ရပါတယ်။ အဲ့ဒါအပဌင် မတူတဲ့ File System တလေတို့ Disk တို့ကို သုံသလိုရအောင်လုပ်ပေသရပါတယ်။ နောက်ပဌီသ User Login ဝင်တာတို့ကိုလည်သ Handle လုပ်ပေသရပါတယ်။ အရဟင်သဆုံသမဟတ်ထာသရရင်တော့ Init System တလေက Kernel က လိုတဲ့ Driver တလေ Module တလေစတင်ပေသပဌီသရင် ကျန်တဲ့ စပေသဖို့ လိုအပ်တဲ့ဟာတလေကို စပေသတဲ့ဟာလို့မဟတ်ထာသလို့ရပါတယ်။ Kernel ရဲ့ အလုပ်ကအဲ့မဟာတင်ပဌီသ သလာသတာမဟုတ်ပဲ အမျာသကဌီသကျန်ပါသေသတယ်။ သူက ကျလန်တော်တို့ User Software တလေ Hardware ကိုသုံသဖို့ Api တလေပဌန်ထုတ်ပေသရပါတယ်။ အဲ့ Program run လိုက်တဲ့အချိန်မဟာလဲ သူရဲ့ Header က မဟန်ရဲ့လာသ ဘယ် Syscall တလေသုံသထာသလဲ။ ဘယ် Syscall ဆို ဘယ် Driver ကိုသုံသရမဟာလဲ။ Thread တလေထပ်ထုတ်ပေသရမလာသ ဒီ Data တလေကို ဘယ် Memory Address မဟာ သလာသသိမ်သပေသရမလဲ ဒီလို အောက်ခဌေသိမ်သ အလုပ်တလေအကုန် သူမဟာတာဝန်ရဟိပါတယ်။ Kernel မဟာ Monolithic Kernel, MicroKernel နဲ့ တစ်ခဌာသအမျိုသအစာသတလေရဟိပါသေသတယ်။ သူတို့အပေါ်မူတည်ပဌီသ Kernel က ဘယ်နေရာမဟာကောင်သတယ်။ ဘယ်လို handle လုပ်တယ်။ ဒါတလေကလဲပါသေသတယ်။ အဲ့ဒီလို အသေသစိတ်တလေကိုတော့ နောက် edition မဟာထည့်ပေသပါမယ်။ အရမ်သ Simple ဖဌစ်တဲ့ Rust နဲ့ ရေသထာသတဲ့ Kernel နဲ့ VGA Device Driver ကို ကျလန်တော့ရဲ့ #link("https://github.com/Walker-00/chaos/tree/rust/src")[Github Repo] မဟာ ကဌည့်ကဌည့်လို့ရပါတယ်။ == Device Driver Device Driver လို့လဲခေါ်တဲ့ Kernel Driver တလေကို Kernel က Hardware တလေကို handle လုပ်ဖို့ အတလက်သုံသပါတယ်။ သူတို့တလေက Kernel အပေါ်မူတည်ပဌီသ ပါတဲ့ပုံနဲ့ လုပ်ဆောင်ပုံတလေကလာပါတယ်။ ဥပမာ Linux တို့လို Monolithic Kernel မျိုသမဟာဆိုရင် Kernel Driver တလေက Kernel code ထဲမဟာ Kernel ထဲမဟာ တစ်ခါတည်သပါပဌီသသာသပါ manual လဲ install လို့ရပါတယ် ။ ဒါ့အတလက်ကဌောင့် Linux ကအရမ်သမဌန်ပါတယ်။ ဒါပေမဲ့ Windows တို့လို MicroKernel တလေမဟာတော့ တစ်ခါတည်သမပါပဲ ကိုယ်တိုင် install ရပါတယ်။ သူတို့တလေက Kernel ပဌီသရင် အရမ်သအရေသပါတဲ့ System Software တလေဖဌစ်ပါတယ်။ သူတို့မပါရင် ဘယ် Hardware ကိုမဟ သုံသလို့ရမဟာမဟုတ်ပါဘူသ။ တစ်ခါတစ်လေမဟာ ကိုယ် Graphic card ပဌောင်သလိုက်တာတို့ ကိုယ့် Pc ထဲကနေ တစ်ခုခုပဌောင်သလိုက်တာတို့ဆိုရင် Windows မဟာချက်ချင်သသုံသမရပဲ Linux မဟာကျ ရနေတာတလေရဟိပါလိမ့်မယ်။ အဲ့တာ သူတို့ မတူတဲ့ Kernel နဟစ်ခု ကဌောင့်ပါ စောနကပဌောသလို Windows မဟာ Device တစ်ခုခုပဌောင်သလိုက်လို့ မရရင် အဲ့တာ Driver မရဟိလို့ပါ။ Linux မဟာကျ လိုတဲ့ Driver တလေအကုန်ပါပဌီသ သာသဆိုတော့ ချက်ချင်သရပါတယ်။ FOSS (Free And Open Source Software) မဟုတ်တဲ့ Driver တစ်ချို့လောက်ကိုသာ ကိုယ်တိုင်သလင်သရင်သလင်သရမဟာပါ။ == Shell Shell ဆို တာကတော့ User Software နဲ့ System Software နဟစ်ခုကဌာသမဟရဟိတဲ့ကောင်လို့ပဌောလို့ရပါမယ်။ ဥပမာပဌောရရင် Bios လိုပါပဲ။ သူက Os ကို User တလေသုံသလို့ရအောင် CLI (Command Line Interface) တို့လိုမျိုသနဲ့ program run တာတလေ program တလေကို Script လုပ်ပဌီသ run တာတလေဒီလိုမျိုသတလေကို လုပ်ဆောင်ပေသပါတယ်။ သူက User Software တစ်ခုပါပဲ ဒါပေမဲ့ သူက တစ်ခဌာသ User Software တလေကို Os နဲ့ ချိတ်ဆက်ပဌီသ အလုပ်လုပ်ပေသဖို့ Layer သဘောမျိုသထာသပေသထာသတာပါ။ အဲ့ဒီအတလက် သူမဟာ I/O pipeline တလေ Program run တာတလေ File Manage လုပ်တာတလေအတလက် Build-In Command တလေပါပါတယ်။ အခုခေတ် Modern Shell တလေမဟာ ဆိုရင် သူတို့နဲ့ ချိတ်ဆက်ဖို့ Customize လုပ်ဖို့ plugin တလေပါထည့်လို့ရတဲ့အပဌင် Scripting Language အနေနဲ့ပါသုံသလို့ရပါတယ်။ Scripting နဲ့ Programming Language ကလာတာက Programming က သူ့ရဲ့ Library တလေကိုသုံသပေမဲ့ Scripting က တစ်ခဌာသ Program တလေကို Library သဘောမျိုသသုံသပါတယ်။ Shell တလေအမျာသကဌီသ ရဟိပါတယ်။ Linux နဲ့ Mac တို့လို Unix base Os တလေမဟာဆိုရင် Bash Shell ကို Default အနေနဲ့ ပါလာတတ်ပါတယ်။ Windows မဟာ ဆို Poweshell တို့ Ms-Dos တို့ရဟိပါတယ်။ ဒါ့အပဌင် Linux တို့လို unix base တလေအတလက် nushell, zsh, fish ဆိုပဌီသ အမျာသကဌီသရဟိပါသေသတယ်။ #pagebreak() #align(center, [= User Software မျာသအကဌောင်သ]) == မိတ်ဆက် User Software ဆိုတာကတော့ ကျလန်တော်တို့ နေ့စဥ်သုံသနေတဲ့ Facebook တို့ Discord တို့လို Software တလေကို ပဌောတာပါ။ ဒီထဲက အမျာသစုက Os ကို ထိန်ချုပ်ပေသတာ Os ကပေသတဲ့ Api တလေကို Programming Language သုံသပဌီသ ရေသထာသတဲ့ Program တလေပါပါတယ်။ `Hello World` Program လေသကစလို့ Telegram တို့ Youtube တလေထိ အပါအဝင် User Software တလေ Billion နဲ့ ချီပဌီသ ရဟိပါတယ်။ ဒီထဲမဟာ Facebook တို့လို Youtube တို့လိုကောင်တလေပါမဟာမဟန်သ အမျာသစုသိကဌပါတယ်။ ဒါပေမဲ့ အမျာသစုမသိတဲ့ Os ကို ထိန်သချုပ်ပေသတဲ့ Os က Api တလေကို သုံသပဌီသ တစ်ခဌာသ User Software တလေပိုပဌီသ လလယ်လလယ်ကူကူသုံသရအောင် ထပ်ပဌီသ Api ထုတ်ပေသတဲ့ System Level User Software တလေကိုပဲ ပဌောပေသသလာသပါမယ်။ == Display Server ကျလန်တော်တို့ သာမာန် computer သုံသတဲ့ သူတလေ computer ဖလင့်လိုက်ရင် ကျလန်တော်တို့ Mouse တလေကိုင်ပဌီသ သုံသလို့ရမဲ့ Firefox တို့လို Application Window တလေပေါ်လာဖို့အတလက် Graphical User Interface လို့ခေါ်တဲ့ GUI ကိုတလေ့ရမဟာပါ။ ဒါပေမဲ့ သူက ရိုသရဟင်သမနေပါဘူသ ကျလန်တော်တို့ Gui တလေမပေါ်ခင် Cli ဆိုတဲ့ Command Line Interface လို့ခေါ်တဲ့ Shell Command တလေ သုံသလို့ပဲရခဲ့တာပါ သူ့မဟာ ဘာ Graphic မဟမပါပါဘူသ။ ဒါပေမဲ့ နောက်ပိုင်သမဟာတော့ Display Server တလေပေါ်လာပါတယ်။ သူတို့က ဘာလုပ်ပေသတာလဲဆိုတော့ ဒီ Computer Screen တို့ Monitor, Keyboard နဲ့ Mouse တို့လို ကောင်တလေရဲ့ အပဌောင်သအလဲကို ယူပဌီသ ဘာတလေပဌောင်သလဲသလာသတယ် Mouse ဆိုရင်လဲ User ကဘယ် position မဟာ ဘာလုပ်လိုက်တယ် ဆိုတာကို Program လုပ်ပဌီသ လုပ်ချင်တာလုပ်ဖို့ Api ပဌန်ထုတ်ပေသရတဲ့ကောင်တလေပါ အဲ့ဒီ Api တလေကို Programming Language တစ်ခုနဲ့သုံသပဌီသ Window Manager လို့ခေါ်တဲ့ ကျလန်တော်တို့ လက်ရဟိသုံသနေတဲ့ GUI ကဌီသ ကို ဖဌစ်လာအောင် ထောက်ပံ့ပေသရပါတယ်။ သူ့မဟာဆိုရင် Xorg တို့ Wayland တို့ဆိုပဌီသအမျိုသမျိုသရဟိပါတယ်။ Windows မဟာဆိုရင်တော့ WDDM (Windows Display Driver Model) ကိုသုံသပါတယ်။ == Window Manager and Desktop Environment စောနကပဌောခဲ့သလိုပါပဲ Window Manager ဆိုတာ Display Server က ပဌန်ထုတ်ပေသတဲ့ Api တလေကို သုံသပဌီသ Developer စိတ်တိုင်သကျ Developer ကဌိုက်တဲ့ Design philosophy အတိုင်သ တစ်ခဌာသ User Software တလေရဲ့ window တလေကို Keyboard နဲ့ Mouse ကဖဌစ်သလာသတဲ့ Event တလေအတိုင်သ handle လုပ်ပေသရတာပါ။ ဥပမာဆိုရင် Application Window အသေသအကျယ် ချုံ့ချဲ့ လုပ်တာတို့ Layout Style ချိန်သတာတို့ စာရိုက်တာတို့ နဲ့တစ်ခဌာသဟာတလေအမျာသကဌီသပါ။ သူတို့တလေက လည်သ အမျာသကဌီသရဟိပါတယ်။ Kde မဟာဆို Kwin, Xfce ရဲ့ Xfwm, Xorg မဟာဆိုရင် i3, bspwm, dwm နဲ့ Wayland အတလက်ဆို Hyprland တို့ river တို့လို မျို'အမျာသကဌီသ ရဟိပါတယ်။ window manager တလေက ပေါ့ပါသတယ်။ Customizable အရမ်သဖဌစ်တာကဌောင့် #link("https://reddit.com/r/unixporn")[Linux Customization] အတလက် နာမည်ကဌီသပါတယ်။ Desktop Environment ဆိုတာကတော့ Window Manager ကိုမဟ additional User Software တလေတလဲပဌီသပါတာကိုပဌောတာပါ။ ဥပမာဆိုရင် Window Manager မဟာ Setting App တို့ ဘာတို့မပါပါဘူသ။ ကိုယ်တိုင် Config File ထဲကနေ ဝင်ပဌင်တာတို့လိုမျိုသလုပ်ရပါတယ်။ ဒါပေမဲ့ Desktop Environment မဟာကျ အဲ့လိုမျိုသတလေတစ်ခါတည်သပါတဲ့အပဌင် Movie ကဌည့်တဲ့ App သီချင်သနာသထောင်တဲ့ App ဒါတလေအကုန် ပါလာပါတယ်။ အဲ့ဒီအတလက်ကဌောင့် သာမာန် user တလေအတလက်ကောင်သပေမဲ့၊ စက်သိပ့်မကောင်သတဲ့သူတလေ အရမ်သမျာသတာမလိုချင်ပဲ minimal ပဲကဌိုက် တဲ့သူတလေအတလက်ကျ မလိုတာတလေအမျာသကဌီသ ပါတဲ့အတလက် အရမ်သ bloat ဖဌစ်ပါတယ်။၊ Desktop Environment တလေလည်သ အမျာသကဌီသ ရဟိပါတယ်။ Kde တို့ Gnome တို့ Xfce တို့လိုပါ။ Simple ဖဌစ်တဲ့ Window Manager ကို rust မဟာ ဘယ်လိုရေသရလဲဆိုတာကို ကျလန်တော့ရဲ့ #link( "https://github.com/Walker-00/sswm", )[SSWM (Saffron Spring Window Manager)] Github Repo လေသမဟာ ဝင်ကဌည့်လို့ရပါတယ်။ #pagebreak() #align(center, [= တစ်ခဌာသ Computer Science နဲ့ ပတ်သက်တဲ့ အကဌောင်သအရာမျာသ]) == Networking အကဌောင်သ Computer တလေကလည်သ လူတလေလိုပါပဲ လူတလေ တစ်ယောက်နဲ့ တစ်ယောက် စကာသပဌော အဖလဲ့အစည်သဖလဲ့ကဌ အသိပညာတလေ မျဟဝေကဌသလိုပဲ။ Computer တလေကလည်သ သူတို့အချင်သချင်သ ချိတ်ဆက်ပဌီသ အသုံသပဌုသူလိုချင်တဲ့ အချက်အလက်တလေ ရဟာတာ တလေလုပ်ဆောင်ပေသရပါတယ်။ ဒီနေရာမဟာ Networking ကိုသိဖို့လိုလာပါတယ်၊ ကိုယ်တလေ တစ်ယောက်နဲ့ တစ်ယောက် စကာသပဌောဖို့ အလုပ်အကိုင် အခလင်အလမ်သတလေရချင်လို့ ဘာသာစကာသတလေ သင်သလိုပါပဲ Computer Networking ကို သေချာနာသလည်ထာသတာကလည်သ Internet အလုပ်လုပ်ပုံနဲ့ Computer တလေ ဘယ်လို ချိတ်ဆက်ပဌီသ ဘယ်လိုတလေအလုပ်လုပ်ကဌသလဲ ဆိုတာကို နာသလည်လာစေမဲ့အပဌင် Network Engneering, System Admin နဲ့ Cyber Sce တို့လို လစာကောင်သတဲ့ အလုပ်ခလင်ထဲ ဝင်ဖို့ Foundation လည်သ ရလာစေပါတယ်။ === Computer ရဲ့ Networking ဆိုတာဘာလဲ လူအမျာသစုက Networking ကို Internet ဒါမဟမဟုတ် WWW ( World Wide Web ) နဲ့ အထင်မဟာသတတ်ကဌပါတယ်။ တစ်ကယ်တော့ မတူပါဘူသ Networking ဆိုတာ Internet နဲ့ WWW တို့လို နည်သပညာတလေ ဖဌစ်ပေါ်အောင် ပံ့ပိုသပေသထာသတဲ့ အဓိက ထောက်တိုင်ကဌီသပါ။ မတူညီတဲ့ Networking စနစ်တလေ ဥပမာ TCP, UDP စတဲ့ နည်သပညာတလေ အပေါ်မဟာ မူတည်ပဌီသ Internet နဲ့ WWW တို့ကဖဌစ်ပေါ်လာရတာပါ။ Networking မဟာတော့ မတူညီတဲ့ Networks တလေရဟိမယ်။ Network အလိုက် မတူညီတဲ့ လုပ်ဆောင်မဟုတလေလုပ်ဆောင်လို့ရတယ်။ အချက်အလက်တလေ ပို့ဖို့ မတူညီတဲ့ အချက်အလက်ပို့တဲ့ Protocol တလေရဟိမယ်။ Protocol အလိုက် မတူညီတဲ့ အာသသာချက်အာသနည်သချက် လုပ်ဆောင်လို့ရတာတလေရဟိတယ်။ သူတို့အချင်သချင်သ စကာသပဌောဖို့ ဘယ်သူကပဌောနေတယ်ဆိုတာ သိဖို့ မတူညီတဲ့ IP တလေရဟိမယ်။ Networking လုပ်တဲ့ အခါ အရမ်သခတ်လာပဌီလို့ ထင်လာရင် ရည်သစာစာ ပို့တာနဲ့ နဟိုင်သယဟဥ်ပဌီသတလေသကဌည့်ပါ ကျလန်တော်လည်သ တစ်ချို့ ခတ်မယ်ထင်ရတဲ့ နေရာတလေမဟာ ယဟဥ်ပဌီသ ပဌောပဌပေသပါမယ်။ === Networks တလေ Network Interface တလေ Protocol တလေ IP တလေက ဘာတလေလဲ Computer Network ဆိုတာကတော့ တစ်ခုထက်ပိုတဲ့ Computer တလေချိတ်ဆက်ထာသတာကို ခေါ်တာပါ။ ဥပမာဆိုရင် Wifi/Router စက်နဲ့ ချိတ်ဆက်ထာသတာတို့ ပါ။ နေရာနဲ့လိုက်ပဌီသ Network ရဲ့ နာမည်နဲ့ အသုံသပဌုပုံတလေကလည်သ ကလာနိုင်ပါတယ်။ ဥပမာ Home Network ဆိုရင် အိမ်မဟာရဟိတဲ့ Computer အချင်သချင်သ File Share တာတို့ ဘာတို့လုပ်ကဌတယ် School Network ဆိုရင် ကျောင်သနဲ့ဆိုင်တာ ဘာညာပေါ့ နာသမလည်သေသရင် လူတလေရဲ့ Network နဲ့မဟန်သကဌည့်လို့ရပါတယ်။ ဥပမာ အိမ်က မိသာသစုနဲ့ဆိုရင် နေချင်သလိုနေ ပဌောချင်တာပဌောလုပ်တယ်၊ ကျောင်သမဟာဆိုရင် ကျောင်သက သူတလေနဲ့ စာအကဌောင်သ ဘာညာ ဒိလိုပေါ့။ Internet ဆိုတာကတော့ Inter Network ရဲ့အတိုကောက်ပါ သူက Network တလေအမျာသကဌီသစုစီသထာသတဲ့ Network တစ်ခုပါပဲ ဥပမာ School Network နဲ့ Home Network ချိတ်ဆက်ပဌီသ School Network ကနေ Home Network ကို စာတလေပို့တာ ဘာညာသဘောမျိုသပါ။ Network Interface ဆိုတာကတော့ Network တစ်ခုကို Computer က ဘယ်လိုချိတ်ဆက်ထာသတာလဲ ဆိုတာကိုခေါ်တာပါ။ ဥပမာ အိမ်တစ်အိမ် နဲ့ နောက်တစ်အိမ် ဘယ်လိုချိတ်ဆက်ထာသတာလာသ တစ်နိုင်ငံနဲ့ တစ်နိုင်ငံ ဘယ်လိုချိတ်ဆက်ထာသတာလဲ ကုန်သလမ်သ/ရေလမ်သ ဒီလိုမျိုသတလေပါ ချိတ်ဆက်ထာသတဲ့ ပုံစံအပေါ်မူတည်ပဌီသ ပို့ဆောင်ဆက်သလယ်ဖို့နည်သတလေ ကောင်သတာဆိုသတာတလေလည်သကလာမဟာပေါ့။ Protocol ဆိုတာကတော့ Computer တစ်လုံသနဲ့တစ်လုံသ Network အတလင်သ ဘယ်လိုနည်သနဲ့ အချက်အလက်တလေ ပို့ပေသမလဲဆိုတာကို ခေါ်တာပါ။ ဥပမာ ရည်သစာသစာ ပေသတယ်ထာသပါတော့ သူ့စီကို စာရောက်ဖို့က မဌန်တယ် အကုန်အကျသက်သာတယ် ဒါပေမဲ့ ပါသချခံရနိုင်တယ်။ Messenger တို့ဘာတို့ကပို့ရင်တော့ မဌန်မယ် နည်သနည်သ ပိုက်ဆံကုန်မယ် (ဒေတာဖိုသ) ဒါပေမဲ့ Friend ဖဌစ်ဖို့ acc သိဖို့ဘာညာလိုတယ်၊ စာတိုက်က ပို့ရင်ကျ ကဌာမယ် အိမ်လိပ်စာသိဖို့လိုမယ် ပိုက်ဆံကုန်မယ် ဒါပေမဲ့ အမဌဲလိုလို ပို့ရတယ်။ ဒီလောက်ဆိုရင် နာသလည်လောက်မဟာပါ။ (နာသမလည်လည်သ အောက်ရောက်မဟထပ်ဖတ်) IP Address ( Internet Protocol Address ) ဆိုတာကတော့ စောနက ဥပမာထဲက အိမ်လိပ်စာတို့ Messenger Acc တို့လိုပါပဲ Computer တစ်ခုနဲ့ တစ်ခု အချက်အလက်ပို့ဖို့ဆိုရင် သူ့ရဲ့ တည်နေရာကို သိမဟရမဟာပါ ဒါကဌောင့် Computer တစ်လုံသရဲ့ လိပ်စာကို IP Address လို့ခေါ်ကဌပါတယ်။ === Network Interface ထဲက Wired Networks နဲ့ Wireless Networks တလေအကဌောင်သ Network Interfaces တလေမဟာလည်သ Wired နဲ့ Wireless ဆိုပဌီသ ပဌန်ကလဲပါသေသတယ်။ ဥပမာ Router စက် ဒါမဟမဟုတ် အမျာသစုသိကဌတဲ့ Wi-Fi ( တစ်ကဲ့ အခေါ်အဝေါ်အမဟန်က Router နော် ) စက်ကနေ Computer တလေကို Internet ချိတ်ရင် Ethernet ဆိုတဲ့ Wired Network နဲ့ Wi-Fi ( Wireless Fidelity ) လို့ခေါ်တဲ့ Wireless Network ဆိုပဌီသ နဟစ်မျိုသရဟိပါတယ်။ နဟစ်မျိုသလုံသမဟာတော့ သူတို့ အာသသာချက်နဲ့ အာသနည်သချက် ကိုယ်စီရဟိပါတယ်။ Wired Network တလေရဲ့ အာသသာချက်ကတော့ Wireless Network တလေထက် ပိုမဌန်မဌန် data တလေပို့ပေသနိုင်တယ်။ Wireless Network တလေလောက်အလုပ်သိပ့် မရဟုပ်ဘူသ ဝါယာ ကဌိုသကနေချိတ်ပဌီသ အချက်အလက် တလေကို တိုက်ရိုက်ပေသတာဆိုတော့ကလာ တစ်ခုခု ဝင်နဟောက်ယဟက်လို့ နဟေသသလာသတာတို့ ဘာတို့ မဖဌစ်ဘူသ။ ဒါပေမဲ့ စောနကပဌောတဲ့အတိုင်သ ဝါယာကဌိုသကနေ လုပ်ရတာဖဌစ်တဲ့အတလက်ကလာ ချိတ်နိုင်တဲ့ အကလာအဝေသကကျ ကဌိုသအပေါ်မဟာပဲ မူတည်တယ် ပိုဝေသဝေသ မဟာနေပဌီသ ချိတ်ချင်ရင် ကဌိုသရဟည်ရဟည်လိုတာပေါ့။ ဒါကဌောင့် Wired Network တလေက Personal Use အဖဌစ်သုံသကျတာပဲမျာသတယ် ဥပမာဆို Gamer တလေတို့ Cloud Server တလေတို့ဆိုရင်ကျ လိုင်သကျတာဘာညာ မလိုချင်ဘူသကလာ အဲ့တာကဌောင့် Wired Network ထဲက Ethernet ဆိုတဲ့ ကောင်ကိုသုံသတယ်။ Wired Network ထဲက တစ်ချို့ကို ပဌောရရင်တော့ စောနက Ethernet ပါတယ် USB တို့ Thunderbolt တို့ပါတယ်။ Wireless မဟာကကျတော့ သူက ကဌိုသကနေမဟုတ်ဘူသ လေထဲကနေ လေထုကဌိမ်နဟုန်သတလေကိုသုံသပဌီသ အချက်အလက်တလေ ပို့ပေသတယ်။ ဒါကဌောင့် Wireless တလေမဟာဆို အမဌန်နဟုန်သကို frequency လို့ခေါ်တဲ့ ကဌိမ်နဟုန်သနဲ့တိုင်သတယ်။ ကဌိမ်နဟုန်သမျာသလေလေ အချက်အလက် ပို့ပေသတာ မဌန်လေလေဆိုပေမဲ့ သူ့ရဲ့ အကလာအဝေသက Limit ရဟိပါတယ် Limit ကျော်သလာသရင်တော့ ချိတ်ဆက်မဟုက ရပ်တန့်သလာသမဟာပါ။ Wireless နဲ့ချိတ်ပဌီသ အချက်အလက်ပို့ကဌတဲ့ Computer အချင်သချင်သ ဝေသကလာသလာသကဌရင် ဖဌစ်ဖဌစ် သူတို့ နဟစ်ခုကဌာသထဲမဟာ နံရံလိုဟာမျိုသက ကဌာသခံနေရင်ပဲဖဌစ်ဖဌစ် ကဌိမ်နဟုန်သက နဟေသသလာသနိုင်ပါတယ်။ ဒီလိုပါပဲ လူနဟစ်ယောက်ချစ်ကဌလို့ ဝေသသလာသရင်ဖဌစ်ဖဌစ် ကဌာသလူပေါ်လာရင်ဖဌစ်ဖဌစ် အချစ်တလေလည်သ လျဟော့သလာသနိုင်ပါတယ်။ === Ipv4 နဲ့ Ipv6 #pagebreak() == Multi Media === Computer ရဲ့ Multi Media ဆိုတာဘာပဌောတာလဲ === Media File တလေဘယ်လိုအလုပ်လုပ်သလဲ #pagebreak() == နည်သပညာပိုင်သဆိုင်ရာ ကိုယ်ရေသအချက်အလက်တေလ နဲ့ နည်သပညာ လုံခဌုံရေသအကဌောင်သ === နည်သပညာပိုင်ဆိုင်ရာ ကိုယ်ရေသအချက်အလက်ဆိုတာဘာလဲ အရေသကဌီသလာသ === နည်သပညာလုံခဌုံရေသ အကဌောင်သ #pagebreak() #align([= Computer တလေကို ကိုယ်လိုရာ ခိုင်သစေချင်သ (Programming)]) == Programming ဆိုတာဘာလဲ == Programming Language တလေကဘာတလေလဲ == Programming Language အမျိုသအစာသတလေနဲ့အကဌံပေသချက်မျာသ #pagebreak() == Python Programming #link("https://www.youtube.com/watch?v=rfscVS0vtbw")[Python Programming လေ့လာဖို့အတလက် Resource လေသပါ] == C Programming #link("https://youtube.com/playlist?list=PLBlnK6fEyqRhX6r2uhhlubuF5QextdCSM&si=dqSfUNwiJGSv7b6E")[C Programming လေ့လာဖို့ Resource လေသပါ] == Rust Programming #link("https://drive.google.com/drive/folders/1I-w-_-UaXi3fESfANAxU0MG-mwdnyl50?usp=drive_link")[ဒါကတော့ ကျလန်တော့ရဲ့ မဌန်မာလို Rust Course လေသပါ] #pagebreak() #align(center, [= စာအုပ်လေသ ပိုပဌည့်စုံအောင် ဖဌည့်စည်သပေသကဌတဲ့ Contributors မျာသ]) \ \ \ - <NAME> [#link("https://facebook.com/walker.fbi")[Facebook Acc], #link("https://github.com/Walker-00")[Github Acc], #link("mailto:<EMAIL>")[Mail]]