This commit is contained in:
7 files changed
+247
No files matched your search
@@ -0,0 +1,77 @@
|
|||||||
|
name: Build 1sem PDFs & update latest
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Typst
|
||||||
|
uses: typst-community/setup-typst@v4
|
||||||
|
|
||||||
|
- name: Compile 1sem PDFs
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
shopt -s nullglob
|
||||||
|
files=(1sem/*.typ)
|
||||||
|
if [ ${#files[@]} -eq 0 ]; then
|
||||||
|
echo "No .typ files found in 1sem/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
for f in "${files[@]}"; do
|
||||||
|
name="$(basename "$f" .typ)"
|
||||||
|
echo "Compiling $f -> dist/${name}.pdf"
|
||||||
|
typst compile --root . "$f" "dist/${name}.pdf"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Update latest tag
|
||||||
|
run: |
|
||||||
|
git tag -f latest "${GITHUB_SHA}"
|
||||||
|
git push -f origin refs/tags/latest
|
||||||
|
|
||||||
|
- name: Recreate latest release and upload PDFs
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
API="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}"
|
||||||
|
AUTH="Authorization: token ${GITEA_TOKEN}"
|
||||||
|
|
||||||
|
# Delete existing 'latest' release if present
|
||||||
|
existing_id=$(curl -fsS -H "$AUTH" "${API}/releases/tags/latest" | jq -r '.id // empty' || true)
|
||||||
|
if [ -n "${existing_id}" ]; then
|
||||||
|
curl -fsS -X DELETE -H "$AUTH" "${API}/releases/${existing_id}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create new 'latest' release pointing to current commit
|
||||||
|
payload=$(jq -n \
|
||||||
|
--arg tag "latest" \
|
||||||
|
--arg sha "${GITHUB_SHA}" \
|
||||||
|
--arg name "latest" \
|
||||||
|
--arg body "Автосборка PDF из \`1sem/\` для коммита \`${GITHUB_SHA:0:7}\`" \
|
||||||
|
'{tag_name: $tag, target_commitish: $sha, name: $name, body: $body, draft: false, prerelease: false}')
|
||||||
|
|
||||||
|
release_id=$(curl -fsS -X POST \
|
||||||
|
-H "$AUTH" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$payload" \
|
||||||
|
"${API}/releases" | jq -r '.id')
|
||||||
|
|
||||||
|
# Upload all compiled PDFs as release assets
|
||||||
|
for pdf in dist/*.pdf; do
|
||||||
|
filename="$(basename "$pdf")"
|
||||||
|
echo "Uploading ${filename}..."
|
||||||
|
curl -fsS -X POST \
|
||||||
|
-H "$AUTH" \
|
||||||
|
-F "attachment=@${pdf}" \
|
||||||
|
"${API}/releases/${release_id}/assets?name=${filename}" > /dev/null
|
||||||
|
done
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#import "../template.typ": *
|
||||||
|
#show: exam-notes.with(subject: "Алгоритмы и структуры данных")
|
||||||
|
|
||||||
|
#ticket(1, "Асимптотика и мастер-теорема")
|
||||||
|
|
||||||
|
#definition(title: $bigO(g(n))$)[
|
||||||
|
Функция $f(n) in bigO(g(n))$, если найдутся $c > 0$ и $n_0 in NN$ такие, что
|
||||||
|
$0 <= f(n) <= c dot g(n)$ для всех $n >= n_0$.
|
||||||
|
]
|
||||||
|
|
||||||
|
#theorem(title: "Мастер-теорема")[
|
||||||
|
Для $T(n) = a T(n / b) + f(n)$ при $a >= 1, b > 1$...
|
||||||
|
]
|
||||||
|
|
||||||
|
#proof[
|
||||||
|
Раскрываем дерево рекурсии высоты $log_b n$...
|
||||||
|
]
|
||||||
|
|
||||||
|
#remark[
|
||||||
|
Не забыть на устном уточнить условие регулярности для 3-го случая.
|
||||||
|
]
|
||||||
|
|
||||||
|
== Пример кода
|
||||||
|
```cpp
|
||||||
|
int binary_search(const std::vector<int>& a, int target) {
|
||||||
|
int l = -1, r = static_cast<int>(a.size());
|
||||||
|
while (r - l > 1) {
|
||||||
|
int m = l + (r - l) / 2;
|
||||||
|
(a[m] < target ? l : r) = m;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#import "../template.typ": *
|
||||||
|
#show: exam-notes.with(subject: "Аналитическая геометрия")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#import "../template.typ": *
|
||||||
|
#show: exam-notes.with(subject: "Дискретная математика")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#import "../template.typ": *
|
||||||
|
#show: exam-notes.with(subject: "Введение в математический анализ")
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
SUBJECTS := matan angem diskra algo
|
||||||
|
PDFS := $(addsuffix .pdf, $(SUBJECTS))
|
||||||
|
|
||||||
|
.PHONY: all clean watch-%
|
||||||
|
|
||||||
|
all: $(PDFS)
|
||||||
|
|
||||||
|
%.pdf: %.typ template.typ
|
||||||
|
typst compile $< $@
|
||||||
|
|
||||||
|
watch-%: %.typ
|
||||||
|
typst watch $< $*.pdf
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PDFS)
|
||||||
|
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
#let NN = $bb(N)$
|
||||||
|
#let ZZ = $bb(Z)$
|
||||||
|
#let QQ = $bb(Q)$
|
||||||
|
#let RR = $bb(R)$
|
||||||
|
#let CC = $bb(C)$
|
||||||
|
#let eps = $epsilon$
|
||||||
|
#let norm(x) = $lr(||#x||)$
|
||||||
|
#let inner(a, b) = $lr(angle.l #a, #b angle.r)$
|
||||||
|
#let bigO(x) = $cal(O)(#x)$
|
||||||
|
|
||||||
|
#let callout(label, accent, bg, title: none, body) = block(
|
||||||
|
width: 100%,
|
||||||
|
fill: bg,
|
||||||
|
stroke: (left: 2.5pt + accent),
|
||||||
|
inset: (x: 10pt, y: 8pt),
|
||||||
|
radius: (right: 3pt),
|
||||||
|
breakable: true,
|
||||||
|
)[
|
||||||
|
#text(weight: "bold", fill: accent)[
|
||||||
|
#label#if title != none [ (#title)]#"."
|
||||||
|
]
|
||||||
|
#h(0.35em)
|
||||||
|
#body
|
||||||
|
]
|
||||||
|
|
||||||
|
#let definition(title: none, body) = callout(
|
||||||
|
"Определение", rgb("#2563eb"), rgb("#eff6ff"), title: title, body
|
||||||
|
)
|
||||||
|
#let theorem(title: none, body) = callout(
|
||||||
|
"Теорема", rgb("#b91c1c"), rgb("#fef2f2"), title: title, body
|
||||||
|
)
|
||||||
|
#let lemma(title: none, body) = callout(
|
||||||
|
"Лемма", rgb("#7c3aed"), rgb("#f5f3ff"), title: title, body
|
||||||
|
)
|
||||||
|
#let remark(title: none, body) = callout(
|
||||||
|
"Замечание", rgb("#475569"), rgb("#f8fafc"), title: title, body
|
||||||
|
)
|
||||||
|
|
||||||
|
#let proof(body) = block(width: 100%, breakable: true, above: 0.6em, below: 0.9em)[
|
||||||
|
#emph[Доказательство.] #body #h(1fr) #box(width: 0.55em, height: 0.55em, stroke: 0.65pt)
|
||||||
|
]
|
||||||
|
|
||||||
|
#let ticket(num, title, new-page: false) = {
|
||||||
|
if new-page { pagebreak(weak: true) }
|
||||||
|
heading(level: 1)[Билет #num. #title]
|
||||||
|
}
|
||||||
|
|
||||||
|
#let exam-notes(
|
||||||
|
subject: "Предмет",
|
||||||
|
semester: "МФТИ ВШПИ · 1 семестр, осень 2026",
|
||||||
|
show-outline: true,
|
||||||
|
body,
|
||||||
|
) = {
|
||||||
|
set document(title: subject)
|
||||||
|
set page(
|
||||||
|
paper: "a4",
|
||||||
|
margin: (x: 1.8cm, y: 2cm),
|
||||||
|
numbering: "1 / 1",
|
||||||
|
header: context {
|
||||||
|
if counter(page).get().first() > 1 [
|
||||||
|
#set text(size: 8.5pt, fill: luma(120))
|
||||||
|
#subject #h(1fr) #semester
|
||||||
|
#v(-0.6em)
|
||||||
|
#line(length: 100%, stroke: 0.4pt + luma(200))
|
||||||
|
]
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
set text(lang: "ru", size: 10.5pt)
|
||||||
|
set par(justify: true, leading: 0.62em)
|
||||||
|
set heading(numbering: none)
|
||||||
|
set list(indent: 0.8em)
|
||||||
|
set enum(indent: 0.8em)
|
||||||
|
|
||||||
|
show math.equation.where(block: true): set block(breakable: true)
|
||||||
|
|
||||||
|
show heading.where(level: 1): it => {
|
||||||
|
v(1.2em, weak: true)
|
||||||
|
block(
|
||||||
|
width: 100%,
|
||||||
|
below: 0.7em,
|
||||||
|
stroke: (bottom: 0.8pt + luma(160)),
|
||||||
|
inset: (bottom: 4pt),
|
||||||
|
)[
|
||||||
|
#text(size: 13pt, weight: "bold")[#it.body]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
show heading.where(level: 2): it => {
|
||||||
|
v(0.8em, weak: true)
|
||||||
|
text(size: 11pt, weight: "bold", fill: luma(50))[#it.body]
|
||||||
|
v(0.3em, weak: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
show raw.where(block: true): block.with(
|
||||||
|
width: 100%,
|
||||||
|
fill: luma(247),
|
||||||
|
stroke: 0.5pt + luma(220),
|
||||||
|
inset: 8pt,
|
||||||
|
radius: 3pt,
|
||||||
|
breakable: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
align(center)[
|
||||||
|
#text(size: 18pt, weight: "bold")[#subject] \
|
||||||
|
#v(0.2em)
|
||||||
|
#text(size: 10pt, fill: luma(110))[#semester]
|
||||||
|
]
|
||||||
|
v(0.8em)
|
||||||
|
|
||||||
|
if show-outline {
|
||||||
|
outline(title: [Содержание билетов], depth: 1, indent: auto)
|
||||||
|
pagebreak()
|
||||||
|
}
|
||||||
|
|
||||||
|
body
|
||||||
|
}
|
||||||
Reference in new issue
Block a user