/
Makefile
26 lines (17 loc) · 847 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
default: run
update: update-writeups
update-writeups:
ifeq ($(shell uname -s), Darwin)
# use a more recent version of sed from nix
alias sed=~/.local/bin/sed
endif
find _writeups/* -maxdepth 0 -type d -exec rm -rf {} +
cp -r ../sec-writeups/CTFs/* _writeups/
find _writeups/ -type f -exec sed -i 's/\.md)/)/g' {} +
# remove writeups [markdown] (not named index.md) that don't have "solved: true" in the front matter
find _writeups/ -type f -name "*.md" -not -name "index.md" -exec perl -0777 -ne 'if (/^\s*--.*(solved:\s*?true).*---/si) { exit(1) } else { exit(0) }' {} \; -exec rm {} \;
submodules: update-submodules
update-submodules:
git submodule update --init --remote --recursive
run:
docker run --rm -it -v $(shell pwd):/src/site --security-opt label=disable -p4000:4000 gh-pages sh -c "jekyll serve -H 0.0.0.0 -P 4000"