Skip to content

Commit

Permalink
update layouts, blogs
Browse files Browse the repository at this point in the history
  • Loading branch information
livia23k committed Feb 18, 2024
1 parent d829160 commit 53e91b3
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 7 deletions.
11 changes: 11 additions & 0 deletions _includes/read-time.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Calculate the post's reading time, and display the word count in tooltip -->

{% assign words = include.content | strip_html | number_of_words: 'auto' %}

<!-- return element -->
<span>
<em>
{{- words -}}
{{ ' words' }}
</em>
</span>
86 changes: 86 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
layout: compress
---

<!doctype html>

{% include origin-type.html %}

{% include lang.html %}

{% if site.theme_mode %}
{% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %}
{% endif %}

<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}

<body>
{% include sidebar.html lang=lang %}

<div id="main-wrapper" class="d-flex justify-content-center">
<div class="container d-flex flex-column px-xxl-5">
{% include topbar.html lang=lang %}

<div class="row flex-grow-1">
<main aria-label="Main Content" class="col-12 col-lg-11 col-xl-9 px-md-4">
{% if layout.refactor or layout.layout == 'default' %}
{% include refactor-content.html content=content lang=lang %}
{% else %}
{{ content }}
{% endif %}
</main>

<!-- panel -->
<aside aria-label="Panel" id="panel-wrapper" class="col-xl-3 ps-2 mb-5 text-muted">
<div class="access">
{% include_cached update-list.html lang=lang %}
</div>

{% for _include in layout.panel_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} lang=lang %}
{% endfor %}
</aside>
</div>

<div class="row">
<!-- tail -->
<div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 px-md-4">
{% for _include in layout.tail_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} lang=lang %}
{% endfor %}

{% include_cached footer.html lang=lang %}
</div>
</div>

{% include_cached search-results.html lang=lang %}
</div>

<aside aria-label="Scroll to Top">
<button id="back-to-top" type="button" class="btn btn-lg btn-box-shadow">
<i class="fas fa-angle-up"></i>
</button>
</aside>
</div>

<div id="mask"></div>

{% if site.pwa.enabled %}
{% include_cached notification.html lang=lang %}
{% endif %}

<!-- JavaScripts -->

{% include js-selector.html %}

{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}

{% include_cached search-loader.html %}
</body>
</html>
114 changes: 114 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
layout: default
refactor: true
panel_includes:
- toc
tail_includes:
- related-posts
- post-nav
- comments
---

{% include lang.html %}

<article class="px-1">
<header>
<h1 data-toc-skip>{{ page.title }}</h1>

<div class="post-meta text-muted">
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
{% include datetime.html date=page.date tooltip=true lang=lang %}
</span>

<!-- lastmod date -->
{% if page.last_modified_at and page.last_modified_at != page.date %}
<span>
{{ site.data.locales[lang].post.updated }}
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
</span>
{% endif %}

{% if page.image %}
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
{% capture alt %}alt="{{ page.image.alt | xml_escape | default: "Preview Image" }}"{% endcapture %}

{% if page.image.lqip %}
{%- capture lqip -%}lqip="{{ page.image.lqip }}"{%- endcapture -%}
{% endif %}

<div class="mt-3 mb-3">
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip }}>
{%- if page.image.alt -%}
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
{%- endif -%}
</div>
{% endif %}

<div class="d-flex justify-content-between">

<!-- read time -->
{% include read-time.html content=content prompt=true lang=lang %}
</div>
<!-- .d-flex -->
</div>
<!-- .post-meta -->
</header>

<div class="content">
{{ content }}
</div>

<div class="post-tail-wrapper text-muted">
<!-- categories -->
{% if page.categories.size > 0 %}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw me-1"></i>
{% for category in page.categories %}
<a href="{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/">{{ category }}</a>
{%- unless forloop.last -%},{%- endunless -%}
{% endfor %}
</div>
{% endif %}

<!-- tags -->
{% if page.tags.size > 0 %}
<div class="post-tags">
<i class="fa fa-tags fa-fw me-1"></i>
{% for tag in page.tags %}
<a
href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
class="post-tag no-text-decoration"
>
{{- tag -}}
</a>
{% endfor %}
</div>
{% endif %}

<div
class="
post-tail-bottom
d-flex justify-content-between align-items-center mt-5 pb-2
"
>
<div class="license-wrapper">
{% if site.data.locales[lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[lang].copyright.license.link }}">
{{ site.data.locales[lang].copyright.license.name }}
</a>
{% endcapture %}

{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% endif %}
</div>

{% include post-sharing.html lang=lang %}
</div>
<!-- .post-tail-bottom -->
</div>
<!-- div.post-tail-wrapper -->
</article>
49 changes: 49 additions & 0 deletions _layouts/tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: page
# All the Tags of posts.
---

{% assign size_list = '' | split: '' %}
{% assign tag_list = '' | split: '' %}

{% for tag in site.tags %}
{% assign size = tag | last | size %}
{% assign size_list = size_list | push: size %}

{% assign tag_str = tag | first | append: '::' | append: size %}
{% assign tag_list = tag_list | push: tag_str %}
{% endfor %}

{% assign size_list = size_list | sort | reverse %}

{% assign tag_list = tag_list | sort_natural %}

{% assign trending_tags = '' | split: '' %}

{% for size in size_list limit: MAX %}
{% for tag_str in tag_list %}
{% assign tag = tag_str | split: '::' %}
{% assign tag_name = tag | first %}
{% assign tag_size = tag | last | plus: 0 %}
{% if tag_size == size %}
{% unless trending_tags contains tag_name %}
{% assign trending_tags = trending_tags | push: tag_name %}
{% break %}
{% endunless %}
{% endif %}
{% endfor %}
{% endfor %}

<div id="tags" class="d-flex flex-wrap mx-xl-2">

{% if trending_tags.size > 0 %}
{% for t in trending_tags %}
<div>
<a class="tag" href="{{ t | slugify | url_encode | prepend: '/tags/' | append: '/' | relative_url }}">
{{ t -}}
<span class="text-muted">{{ site.tags[t].size }}</span>
</a>
</div>
{% endfor %}
{% endif %}
</div>
23 changes: 23 additions & 0 deletions _posts/life/2024-02-13-silence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Moment | Silence
categories: [Personal, Moments]
tags: [life, moment, jotting]
---

When I was waiting for the shuttle,

sitting at the bench

with my eyes closing,

the wind flies through my face,

crossing my hair.

Time slows its tiks.


<div style="height: 20px;"></div>


Song I was listening in this moment: [Path - Peak Ridge](https://music.apple.com/cn/album/path/1661943066?i=1661943067&l=en-GB)
2 changes: 1 addition & 1 deletion _posts/tech/2023-12-19-graphic-math.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Graphics | Related Math
categories: [Computer Science, Computer Graphics]
tags: [tech, computer graphics, 23winter, 15-662]
tags: [tech, computer graphics, 24spring, 15-662]
img_path: /assets/img/post/2023-12-19-662math/
math: True
---
Expand Down
2 changes: 1 addition & 1 deletion _posts/tech/2023-12-27-games104-arch.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Game Engine | Architecture Glance
categories: [Computer Science, Game Engine]
tags: [tech, game engine, game104, class note]
tags: [tech, game engine, game104, 24spring, class note]
img_path: /assets/img/post/2024-01-05-gearch/
---

Expand Down
86 changes: 86 additions & 0 deletions _posts/tech/2024-01-31-646-openmp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: OpenMP | Notes for OpenMP Programming
categories: [Computer Science, Parallel]
tags: [tech, parallel, library, 24spring, class note]
img_path: /assets/img/post/2024-01-31-opemmp/
---

## Sentences


### #pragma omp parallel

- users are able to define thread works on your own using omp_get_threads(), omp_get_thread_num()

- do nothing if there is no designation

- have implicit barrier (compulsory sync for all threads) at the end of this region


### #pragma omp parallel for

- Iterations split over different threads (Done by OpenMP)

- Iterations are assumed to be independent

- Without an explicit scheduling clause, OpenMP decides how to distribute the iterations based on the implementation's default behavior, which can vary.

- Do not assume iterations to thread mapping

#### num_threads(n)

- assigned n threads for the work

#### shared(j)

- the variable "j" is shared among the outer scope (where the parallel region is defined) and all threads within that parallel region

#### private(k)

- declared a new uninitialized "k" in the parallel for region

- this variable will be discarded at the end of the region

#### firstprivate(k)

- initialize the new "k" in parallel region with the value "k" from the master thread

- so all threads start will the same value.

- the "k" will be discarded after the region.

#### lastprivate(k)

- the "k" in the master thread will get the "k" value from the last operating thread


### #pragma omp single

- have an implicit barrier

- only one of the threads will execute this region

### #pragma omp single **nowait**

- no implicit barrier

### #pragma omp barrier

- explicit barrier

### #pragma omp critical

- one thread execute these code at a time

- all threads should do, but one at a time

### #pragma omp atomic

- similar outcome as critical do

- but lighter and faster

### schedule(type, chunk_size)



Loading

0 comments on commit 53e91b3

Please sign in to comment.