257 lines
6.1 KiB
Plaintext
257 lines
6.1 KiB
Plaintext
%rec: example
|
|
%key: name
|
|
%type: note line
|
|
|
|
name: Default systemd service file
|
|
filename: default.service
|
|
bin: systemd
|
|
usage: mv {{filename}} /usr/lib/systemd/system/
|
|
+ systemctl daemon-reload
|
|
+ systemctl enable --now {{filename}}
|
|
note: Basic systemd service file
|
|
content: [Unit]
|
|
+
|
|
+ Description={{script}}
|
|
+
|
|
+ [Service]
|
|
+
|
|
+ ExecStart=/home/{{user}}/.local/bin/{{script}}.sh
|
|
+
|
|
+ Restart=always
|
|
+
|
|
+ Type=simple
|
|
+
|
|
+ User={{user}}
|
|
+
|
|
+ Group={{group}}
|
|
+
|
|
+ [Install]
|
|
+
|
|
+ WantedBy=multi-user.target
|
|
+
|
|
+ Alias=test.service
|
|
+
|
|
|
|
name: Example sc-im file
|
|
filename: food.sc
|
|
bin: sc-im
|
|
usage: {{bin}} {{filename}}
|
|
note: Basic sc-im example of adding and averaging
|
|
content: # This data file was generated by the Spreadsheet Calculator Improvised (sc-im)
|
|
+ # You almost certainly shouldn't edit it.
|
|
+
|
|
+ newsheet "Food"
|
|
+ movetosheet "Food"
|
|
+ offscr_sc_cols 0
|
|
+ offscr_sc_rows 0
|
|
+ nb_frozen_rows 1
|
|
+ nb_frozen_cols 0
|
|
+ nb_frozen_screenrows 2
|
|
+ nb_frozen_screencols 0
|
|
+ format A 24 1 0
|
|
+ format B 13 2 0
|
|
+ format 0 2
|
|
+ format 4 2
|
|
+ format 10 2
|
|
+ freeze 0
|
|
+ label A0 = "Food by Weight"
|
|
+ leftstring B0 = "No. Meals"
|
|
+ leftstring A1 = "Ajvar"
|
|
+ let A1 = 5
|
|
+ let B1 = A1*$A$10
|
|
+ leftstring A2 = "Apples"
|
|
+ let A2 = 3
|
|
+ let B2 = A2*$A$10
|
|
+ leftstring A3 = "Rocket"
|
|
+ let A3 = 0.2
|
|
+ let B3 = A3*$A$10
|
|
+ leftstring A4 = "Beli Cheese"
|
|
+ let A4 = 1
|
|
+ let B4 = A4*$A$10
|
|
+ leftstring A6 = "Total"
|
|
+ let A6 = @sum(A1:A4)
|
|
+ leftstring B6 = "Total"
|
|
+ let B6 = @sum(B1:B4)
|
|
+ leftstring A7 = "Average"
|
|
+ let A7 = @avg(A1:A4)
|
|
+ leftstring A10 = "Weight of Meal"
|
|
+ let A10 = 0.3
|
|
+ pad 4 A0:A4
|
|
+ pad 2 B0:B4
|
|
+ pad 4 A6:A8
|
|
+ pad 2 B6
|
|
+ pad 4 A10
|
|
+ goto A10
|
|
|
|
name: Example makefile producing html from markdown
|
|
filename: lowdown.mk
|
|
bin: make
|
|
bin: lowdown
|
|
bin: fortune
|
|
usage: {{bin}} -f {{filename}} example
|
|
content: output: all
|
|
+
|
|
+ .PHONY: example
|
|
+ example: html/foot.html html/head.html
|
|
+ mkdir -p articles/
|
|
+ fortune > articles/fort_1.md
|
|
+ fortune > articles/fort_2.md
|
|
+
|
|
+ HTML = $(patsubst articles/%.md,public/%.html,$(wildcard articles/*.md))
|
|
+
|
|
+ $(HTML): public/ articles/ $(wildcard html/*)
|
|
+
|
|
+ html/head.html:
|
|
+ @mkdir $(@D)
|
|
+ echo '<head> Something about CSS probably </head>' > $@
|
|
+ echo '<body>' >> $@
|
|
+
|
|
+ html/foot.html: html/head.html
|
|
+ echo '</body>' >> $@
|
|
+
|
|
+ public/%.html : articles/%.md
|
|
+ cat html/head.html > $@
|
|
+ lowdown $< >> $@
|
|
+ cat html/foot.html >> $@
|
|
+
|
|
+ .PHONY: all
|
|
+ all : $(HTML)
|
|
+
|
|
+ articles/:
|
|
+ mkdir $@
|
|
+
|
|
+ public/:
|
|
+ mkdir $@
|
|
+
|
|
+ clean :
|
|
+ rm -rf public html
|
|
|
|
name: Default makefile
|
|
filename: Makefile
|
|
bin: make
|
|
usage: make
|
|
content: ### Variables
|
|
+
|
|
+ PAGER ?= $(shell command -v mdless bat less | head -1 )
|
|
+ EDITOR ?= vi
|
|
+
|
|
+ requirements += lowdown
|
|
+
|
|
+ ### Dependencies
|
|
+
|
|
+ out: help
|
|
+
|
|
+ ### Patterns
|
|
+
|
|
+
|
|
+ ### Phonies
|
|
+
|
|
+ .PHONY: help
|
|
+ help:
|
|
+ @awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
|
+ sort | \
|
|
+ column -s ':' -t
|
|
+
|
|
+ .PHONY: check
|
|
+ check: ## Check you have the required dependencies
|
|
+ @$(foreach dep, $(requirements), type $(dep) >/dev/null || echo "Install $(dep)." ; )
|
|
+
|
|
+ .PHONY: clean
|
|
+ clean: ## Remove generated files.
|
|
+ $(RM) $(defaults)
|
|
|
|
name: Issues tracker
|
|
filename: Makefile
|
|
bin: make
|
|
content: hdr = @printf "\n\033[37;1;4m%s\033[0m\n"
|
|
+ msg = @printf "\033[37;1m%s\033[0m\n"
|
|
+
|
|
+ issues = $(wildcard open/*) $(wildcard closed/*)
|
|
+
|
|
+ number_of_issues != echo $(issues) | wc -w
|
|
+
|
|
+ name = open/issue_$(number_of_issues).md
|
|
+
|
|
+ last_modified != ls -t open/* 2>/dev/null | head -1
|
|
+ ifndef last_modified
|
|
+ setup:
|
|
+ @mkdir open closed
|
|
+ @git init
|
|
+ @echo '---' > open/issue_1.md
|
|
+ @echo 'title: Setup git' >> open/issue_1.md
|
|
+ @echo 'priority: high' >> open/issue_1.md
|
|
+ @printf 'responsible: ' >> open/issue_1.md
|
|
+ @git config user.name >> open/issue_1.md
|
|
+ @echo '---' >> open/issue_1.md
|
|
+ @echo 'Push to a remote repository' >> open/issue_1.md
|
|
+ @git add $(MAKEFILE_LIST) open/issue_1.md
|
|
+ @git commit -m'Init the git!'
|
|
+ $(info Check issue 1)
|
|
+ $(info Run make again)
|
|
+ endif
|
|
+
|
|
+ open_issues = $(wildcard open/*)
|
|
+ closed_issues = $(patsubst open/%, closed/%, $(open_issues))
|
|
+
|
|
+ EDITOR ?= vi
|
|
+
|
|
+ close_issue_command = @git commit --message "Close $$(basename -s .md $(last_modified) | tr '_' ' ')"
|
|
+
|
|
+ random_helper = $(shell git shortlog -se | sort -R | head -1 | cut -d '<' -f2 | tr -d '>')
|
|
+
|
|
+ contact = Get outside help
|
|
+ ifeq ($(MAKECMDGOALS),help)
|
|
+ contact = Email $(random_helper)
|
|
+ endif
|
|
+
|
|
+ help:
|
|
+ @printf "\033[36m%s\t\033[0m %s\n" "help" "$(contact)"
|
|
+ @printf "\033[36m%s\t" "done"
|
|
+ @printf "\033[0m %s " "Close $$(basename -s .md $(last_modified) | tr '_' ' ')"
|
|
+ @printf "\033[0m %s\n" "[$$(grep -Pom1 'title: \K.*' $(last_modified))]"
|
|
+ @awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
|
+ column -s ':' -t
|
|
+
|
|
+ $(closed_issues): closed/%.md: open/%.md
|
|
+ @git add $<
|
|
+ @git mv $< $@
|
|
+ $(close_issue_command)
|
|
+
|
|
+ .PHONY: issue
|
|
+ issue: $(name) ## Make an issue
|
|
+ $(name):
|
|
+ @echo '---' > $(name)
|
|
+ @read -p 'Title? ' title && echo title: $$title >> $@
|
|
+ @echo priority: low >> $@
|
|
+ @echo responsible: $(shell git config user.name) >> $@
|
|
+ @echo '---' >> $@
|
|
+ @printf '\n\n' >> $@
|
|
+ @$(EDITOR) +7 $@
|
|
+ @git add $@
|
|
+ @git commit --quiet --message "$$(grep -Pom1 'title: \K.*' $@)"
|
|
+ $(info Commit created, remember to push!)
|
|
+
|
|
+ .PHONY: done
|
|
+ done:
|
|
+ $(info Closing $(shell basename -s .md $(last_modified) | tr '_' ' '))
|
|
+ @git add $(last_modified)
|
|
+ @git mv $(last_modified) closed/
|
|
+ $(close_issue_command)
|
|
+
|
|
+ .PHONY: stats
|
|
+ stats: ## Summarise issue
|
|
+ $(hdr) "Priorities"
|
|
+ $(msg) "$$(head -n 7 $(wildcard open/*) | sort | grep -Po 'priority: \K.*' | uniq -c)"
|
|
+ $(msg) "$$(ls closed/ | wc -l) closed"
|
|
+ $(hdr) "Holders"
|
|
+ $(msg) "$$(head -n 7 $(wildcard open/*) | grep -Po 'responsible: \K.*' | tr [:upper:] [:lower:] | sort | uniq -c)"
|
|
+
|
|
+ .PHONY: rundown
|
|
+ rundown: ## Summarize events
|
|
+ @printf "\033[33;5m# %s\033[0m\n" "Outstanding Calamities"
|
|
+ @$(foreach bug, $(wildcard open/*.md), \
|
|
+ a="$$(lowdown -X responsible $(bug))" && \
|
|
+ n="$$(echo $(bug) | cut -d_ -f2 | cut -d. -f1)" && \
|
|
+ t="$$(lowdown -X title $(bug))" && echo "$$n: $$t ($$a)" ;\
|
|
+ )
|