some build stuff

This commit is contained in:
2018-05-02 13:46:39 +02:00
parent 17d1d5e3d7
commit 958e97a666
14 changed files with 162 additions and 0 deletions

26
Makefile Normal file
View File

@ -0,0 +1,26 @@
POSTS = $(shell find ./posts -mindepth 1 -type d)
.PHONY: all
all:
$(MAKE) posts
$(MAKE) index
.PHONY: posts
posts:
for d in $(POSTS); do (echo $$d; cd $$d; $(MAKE) -f ../../m4/posts.mk); done
.PHONY: clean
clean:
for d in $(POSTS); do (cd $$d; $(MAKE) -f ../../m4/posts.mk cleanposts); done
-rm -f toc.inc
-rm -f abstracts.inc
-rm -f index.html
.PHONY: index
index:
-rm -f toc.inc
-rm -f abstracts.inc
for d in $(POSTS); do (cd $$d; m4 -D URL=$$d/article.html ../../m4/macros.m4 article.m4 ../../m4/indexTOCEntry.m4) >> toc.inc; done
for d in $(POSTS); do (cd $$d; m4 -D URL=$$d/article.html ../../m4/macros.m4 article.m4 ../../m4/indexAbstractsEntry.m4) >> abstracts.inc; done
m4 ./m4/macros.m4 index.m4 > index.html

9
index.m4 Normal file
View File

@ -0,0 +1,9 @@
HEADER
<ul>
include(`toc.inc')
</ul>
include(`abstracts.inc')
FOOTER

View File

@ -0,0 +1,5 @@
<p>
<h3>TITLE</h3>
ABSTRACT<br/>
<a ref="URL">read more</a>
</p>

1
m4/indexTOCEntry.m4 Normal file
View File

@ -0,0 +1 @@
<li><a ref="URL">TITLE</a></li>

12
m4/macros.m4 Normal file
View File

@ -0,0 +1,12 @@
define(`HEADER', `
<html>
<head>
<title>my homepage</title>
</head>
<body>
')
define(`FOOTER', `
</body>
</html>
')
define(`ABSTRACT', `')

0
m4/mkfile.mk Normal file
View File

3
m4/post.m4 Normal file
View File

@ -0,0 +1,3 @@
HEADER
CONTENT
FOOTER

8
m4/posts.mk Normal file
View File

@ -0,0 +1,8 @@
include ../../m4/mkfile.mk
article.html: ../../m4/macros.m4 ../../m4/post.m4 article.m4
m4 ../../m4/macros.m4 article.m4 ../../m4/post.m4 > article.html
.PHONY: cleanposts
cleanposts:
-rm -f article.html

View File

@ -0,0 +1,41 @@
define(`TITLE', `A Web-controlled Picture Frame')
define(`ABSTRACT', `A father-and-son weekend project with an Arduino, a stepper motor and a couple of family photos.')
define(`CONTENT', `
<h2>Ingredients:</h2>
<ul>
<li><span style="line-height:14px;">an Arduino Ethernet board</span></li>
<li>a small stepper motor</li>
<li>a double full-H-bridge to drive the stepper</li>
<li>a reflexion sensor with LED and photo transistor</li>
<li>some plywood</li>
<li>four photos of your loved ones</li>
<li>a black self-adhesive plastic film</li>
<li>the <a href="http://code.google.com/p/webduino/" target="_blank">webduino library</a> from the Arduino homepage</li>
<li>the <a href="http://www.arduino.cc/playground/Code/Metro" target="_blank">Metro library</a> from the Arduino homepage</li>
</ul>
<a href="http://a385e-5.de/wp-content/uploads/2013/06/Foto-2.jpg"><img class="alignnone size-medium wp-image-20" alt="Foto 2" src="http://a385e-5.de/wp-content/uploads/2013/06/Foto-2-224x300.jpg" width="224" height="300" /></a>
&nbsp;
The Arduino drives via the double full-H-bridge the stepper to turn 90° three times, 15 minutes between each turn. The fourth time, to complete the 360° full turnaround, its drives the stepper until ...
<a href="http://a385e-5.de/wp-content/uploads/2013/06/Foto-4.jpg"><img class="alignnone size-medium wp-image-24" alt="Foto 4" src="http://a385e-5.de/wp-content/uploads/2013/06/Foto-4-224x300.jpg" width="224" height="300" /></a>
&nbsp;
the white mark arrives of the reflexion light sensor.
This mark and the photos on the other side of the round piece of plywood have to be adjusted carefully, that way, that one photo appear in a window in the frontside of the wooden box.
<a href="http://a385e-5.de/wp-content/uploads/2013/06/Foto-3.jpg"><img class="alignnone size-medium wp-image-22" alt="Foto 3" src="http://a385e-5.de/wp-content/uploads/2013/06/Foto-3-224x300.jpg" width="224" height="300" /></a>
&nbsp;
(Consider the photos of your loved ones where you see colored rectangles above.)
That's it. Code is here <a href="http://files.a385e-5.de/files/Bilderrahmen-0.9.tar.gz">http://files.a385e-5.de/files/Bilderrahmen-0.9.tar.gz</a>
&nbsp;
&nbsp;
')

View File

@ -0,0 +1,45 @@
define(`TITLE', `Children Protection for Postfix-based EMail-Server')
define(`CONTENT', `
This small tool implements a whitelist on a Postfix mail-server. It prevents certain recipient addresses (your kids ones) from receiving mail from any not whitelisted address. Any mail from not whitelisted senders is redirected to a delegate (a parent).
Code is here <a href="http://files.a385e-5.de/files/ChildProt-0.9.tar.gz">http://files.a385e-5.de/files/ChildProt-0.9.tar.gz</a>
Configure it by adding this line into the <em>master.cf</em> of the Postfix installation:
<pre>childprot unix  -       n       n       -       25      spawn user=mail argv=/opt/sbin/ChildProt</pre>
and this to the <em>main.cf</em>:
<pre class="brush: text; gutter: false">smtpd_recipient_restrictions =
  [...]
  check_policy_service unix:private/childprot
  [...]</pre>
The restricted recipients and the whitelists are stored in an SQLite3 database:
<pre class="brush: sql; gutter: false">CREATE TABLE child_address_t (
child INTEGER REFERENCES child_t(id),
address TEXT
);
CREATE TABLE child_t (
id INTEGER PRIMARY KEY,
name TEXT,
delegate TEXT
);
CREATE TABLE whitelist_t (
child INTEGER REFERENCES child_t(id),
address TEXT
);
CREATE VIEW child_v AS
SELECT c.id as id,
c.delegate as delegate,
ca.address as address
FROM child_t c,
child_address_t ca
WHERE c.id = ca.child;</pre>
Restricted persons together with their delegates are added to the table <em>child_t</em>, multiple addresses can be assigned to those persons in <em>child_address_t</em>. Whitelists per person are maintained in <em>whitelist_t</em>.
The tool is querying the view <em>child_v</em>.
&nbsp;
&nbsp;
')

4
tmp/1.m4 Normal file
View File

@ -0,0 +1,4 @@
divert(`1')
Text 1
divert

4
tmp/2.m4 Normal file
View File

@ -0,0 +1,4 @@
divert(`1')
Text 2
divert

1
tmp/e.m4 Normal file
View File

@ -0,0 +1 @@
MODEL

3
tmp/out.m4 Normal file
View File

@ -0,0 +1,3 @@
HEADER
undivert(`1')
FOOTER