manbytesgnu_site

Source files for manbytesgnu.org
git clone git://holbrook.no/manbytesgnu_site.git
Log | Files | Refs

commit 5c3a9bedfe38e2b6ecef524e59984fb7dc681ac6
parent d103667080444dc3ca78ca16bdb833ee282a91a5
Author: nolash <dev@holbrook.no>
Date:   Tue, 20 Apr 2021 20:52:56 +0200

Start templating, add plugin

Diffstat:
MMakefile | 4++--
Mcontent/20210418_keccak.rst | 64+++++++++++++++++++++++++++++++++++++++++++++++++++-------------
Acontent/20210419_docker_python.rst | 139+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/20210420_docker_offline.rst | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/code/docker-offline-python/Dockerfile.localpip | 3+++
Acontent/code/docker-offline-python/Dockerfile.pythonarch | 4++++
Acontent/code/docker-offline-python/pep503.sh | 27+++++++++++++++++++++++++++
Acontent/code/docker-offline/Dockerfile.archbase | 4++++
Acontent/code/keccak-benchmarks/keccak-tiny/wrap.py | 19+++++++++++++++++++
Acontent/pages/identities.rst | 16++++++++++++++++
Acontent/pages/projects.rst | 20++++++++++++++++++++
Alash/static/css/style.css | 16++++++++++++++++
Alash/static/css/syntax.css | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alash/templates/article.html | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alash/templates/base.html | 41+++++++++++++++++++++++++++++++++++++++++
Alash/templates/index.html | 19+++++++++++++++++++
Mpelicanconf.py | 8++++++--
Mpublishconf.py | 3+--
18 files changed, 610 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile @@ -61,7 +61,7 @@ serve-global: "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER) devserver: - "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) + "$(PELICAN)" -lr "$(INPUTDIR)" -t ./lash -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) devserver-global: $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 @@ -70,7 +70,7 @@ publish: "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS) local: - "$(PELICAN)" "$(INPUTDIR)" -o "$(LOCALDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS) + "$(PELICAN)" "$(INPUTDIR)" -o "$(LOCALDIR)" -s "$(CONFFILE)" $(PELICANOPTS) diff --git a/content/20210418_keccak.rst b/content/20210418_keccak.rst @@ -5,11 +5,11 @@ In search of a slim KECCAK dependency :modified: 2021-04-18 19:48 :category: Code :author: Louis Holbrook -:tags: crypto,hash,keccak,python,c +:tags: crypto,hash,keccak,sha3,python,c :slug: keccak-benchmarks :summary: Compare performance and sizes of alternative KECCAK SHA3 implementations :lang: en -:status: draft +:status: published Implementations =============== @@ -17,7 +17,8 @@ Implementations XKCP ---- -- Location: https://github.com/xkcp/xkcp +- Site: https://keccak.team/keccak_specs_summary.html +- Code: https://github.com/xkcp/xkcp - Git hash: c438ee7b2736726f629da11b7012cffcf6b84fef @@ -33,16 +34,16 @@ XKCP keccak_tiny ----------- -- Location: https://github.com/coruus/keccak-tiny +- Code: https://github.com/coruus/keccak-tiny - Git hash: 64b6647514212b76ae7bca0dea9b7b197d1d8186 Needed to export `hash` function symbol, and add to header file. -tiny_sha3 +tiny_sha3 --------- -- Location: https://github.com/mjosaarinen/tiny_sha3 +- Code [1]_: https://github.com/mjosaarinen/tiny_sha3 - Git hash: dcbb3192047c2a721f5f851db591871d428036a9 Had to change "padding" value in ``sha3.c`` @@ -60,7 +61,7 @@ Had to change "padding" value in ``sha3.c`` libkeccak --------- -- Location: https://github.com/maandree/libkeccak +- Code: https://github.com/maandree/libkeccak - Git hash: 718b1a6ea1c44bcf15e55d3c265310e1cd9211fa .. code-block:: bench.c @@ -97,18 +98,17 @@ Results - Executable size: 50152 - Archive size: 78680 -============== ============== =============== +============== =============== =============== Implementation Execution time Executable size -============== ============== =============== -XKCP 0.041101298 37768 +============== =============== =============== +XKCP **0.041101298** 37768 keccak-tiny 0.046095483 49400 -tiny_sha3 [1]_ 0.080156921 16577 +tiny_sha3 0.080156921 **16577** libkeccak 0.200222898 50152 -============== ============== =============== +============== =============== =============== .. [1] Author claims it is not suited for production - Python ====== @@ -137,3 +137,41 @@ Added to ``CompactFIPS202.py``: 100 0.066636149 1000 0.64519725 + +Wrapping keccak_tiny +-------------------- + +Implementing ``XKCP`` in Python means creating two classes for the state and sponge structs. ``keccak_tiny`` is much simpler because it is merely a function call with a couple of char buffers. But with ctypes ends up being very slow, too. [2]_ + +.. include:: code/keccak-benchmarks/keccak-tiny/wrap.py + :code: python + :number-lines: 0 + +:: + + $ gcc -L. -D"memset_s(W,WL,V,OL)=memset(W,V,OL)" -shared keccak-tiny.c -o libkeccaktiny.so + $ LD_LIBRARY_PATH=. python wrap.py + 0.95114457 + 41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d + + + +Compare with ``pysha3``: + + +.. code-block:: python + + import sha3 + h = sha3.keccak_256() + h.update(b'foo') + b = h.digest() + +:: + + 0.162829927 + + +.. + + .. [2] for some reason when on battery; 1.74030088 + diff --git a/content/20210419_docker_python.rst b/content/20210419_docker_python.rst @@ -0,0 +1,139 @@ +Offline Docker - Part II +######################## + +:date: 2021-04-19 17:35 +:modified: 2021-04-18 19:48 +:category: Offlining +:author: Louis Holbrook +:tags: docker,python,devops +:slug: docker-offline-python +:summary: How to not be forced being online when forced to use docker +:lang: en +:status: published + + +Local python repository +======================= + +.. include:: code/docker-offline-python/pep503.sh + :code: bash + +.. code-block:: bash + + $ pip download faker + Collecting faker + Downloading Faker-8.1.0-py3-none-any.whl (1.2 MB) + |████████████████████████████████| 1.2 MB 173 kB/s + Collecting python-dateutil>=2.4 + Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) + |████████████████████████████████| 227 kB 732 kB/s + Collecting six>=1.5 + Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) + Collecting text-unidecode==1.3 + Using cached text_unidecode-1.3-py2.py3-none-any.whl (78 kB) + Saved ./Faker-8.1.0-py3-none-any.whl + Saved ./python_dateutil-2.8.1-py2.py3-none-any.whl + Saved ./six-1.15.0-py2.py3-none-any.whl + Saved ./text_unidecode-1.3-py2.py3-none-any.whl + Successfully downloaded faker python-dateutil six text-unidecode + $ ls + Faker-8.1.0-py3-none-any.whl python_dateutil-2.8.1-py2.py3-none-any.whl six-1.15.0-py2.py3-none-any.whl text_unidecode-1.3-py2.py3-none-any.whl + $ python -m RangeHTTPServer + +.. code-block:: bash + + $ python -m venv .venv + $ . .venv/bin/activate + (.venv) $ pip install --index http://localhost:8000 faker + Looking in indexes: http://localhost:8000 + ERROR: Could not find a version that satisfies the requirement faker (from versions: none) + ERROR: No matching distribution found for faker + +.. code-block:: bash + + $ sh /home/lash/bin/shell/pep503.sh . packages + $ mkdir packages + $ bash /home/lash/bin/shell/pep503.sh . packages + mkdir: created directory 'packages/text-unidecode' + './text_unidecode-1.3-py2.py3-none-any.whl' -> 'packages/text-unidecode/text_unidecode-1.3-py2.py3-none-any.whl' + mkdir: created directory 'packages/six' + './six-1.15.0-py2.py3-none-any.whl' -> 'packages/six/six-1.15.0-py2.py3-none-any.whl' + mkdir: created directory 'packages/python-dateutil' + './python_dateutil-2.8.1-py2.py3-none-any.whl' -> 'packages/python-dateutil/python_dateutil-2.8.1-py2.py3-none-any.whl' + mkdir: created directory 'packages/faker' + './Faker-8.1.0-py3-none-any.whl' -> 'packages/faker/Faker-8.1.0-py3-none-any.whl' + $ find packages/ -type f + packages/faker/Faker-8.1.0-py3-none-any.whl + packages/python-dateutil/python_dateutil-2.8.1-py2.py3-none-any.whl + packages/six/six-1.15.0-py2.py3-none-any.whl + packages/text-unidecode/text_unidecode-1.3-py2.py3-none-any.whl + k $ python -m RangeHTTPServer + +.. code-block:: bash + + $ pip install --index http://localhost:8000/packages faker + Looking in indexes: http://localhost:8000/packages + Collecting faker + Downloading http://localhost:8000/packages/faker/Faker-8.1.0-py3-none-any.whl (1.2 MB) + |████████████████████████████████| 1.2 MB 129.5 MB/s + Collecting python-dateutil>=2.4 + Downloading http://localhost:8000/packages/python-dateutil/python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) + |████████████████████████████████| 227 kB 128.3 MB/s + Collecting text-unidecode==1.3 + Downloading http://localhost:8000/packages/text-unidecode/text_unidecode-1.3-py2.py3-none-any.whl (78 kB) + |████████████████████████████████| 78 kB 151.9 MB/s + Collecting six>=1.5 + Downloading http://localhost:8000/packages/six/six-1.15.0-py2.py3-none-any.whl (10 kB) + Installing collected packages: six, python-dateutil, text-unidecode, faker + Successfully installed faker-8.1.0 python-dateutil-2.8.1 six-1.15.0 text-unidecode-1.3 + + +Docker networking +================= + +Moved files to Apache. + +Using Archlinux with python + +.. include:: code/docker-offline-python/Dockerfile.pythonarch + :code: docker + +.. include:: code/docker-offline-python/Dockerfile.localpip + :code: docker + +With network turned off. + +.. code-block:: bash + + $ docker build . + Sending build context to Docker daemon 3.072kB + Step 1/2 : FROM pythonarch + ---> 881c5d055056 + Step 2/2 : RUN pip install --index http://localhost/python hexathon + ---> Running in 6df44ab92324 + WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. + Looking in indexes: http://localhost/python + WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fdb21779250>: Failed to establish a new connection: [Errno 111] Connection refused')': /python/hexathon/ + ^C + $ docker build --network host . + Sending build context to Docker daemon 3.072kB + Step 1/2 : FROM pythonarch + ---> 881c5d055056 + Step 2/2 : RUN pip install --index http://localhost/python hexathon + ---> Running in 2c10ffcdf3ad + WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. + Looking in indexes: http://localhost/python + Collecting hexathon + Downloading http://localhost/python/hexathon/hexathon-0.0.1a7-py3-none-any.whl (14 kB) + Installing collected packages: hexathon + Successfully installed hexathon-0.0.1a7 + Removing intermediate container 2c10ffcdf3ad + ---> 1ba83bb8e111 + Successfully built 1ba83bb8e111 + +.. code-block:: docker + + [...] + + RUN pip install --index http://10.1.3.1/python --trusted-host 10.1.3.1 pip setuptools-markdown wheel + diff --git a/content/20210420_docker_offline.rst b/content/20210420_docker_offline.rst @@ -0,0 +1,98 @@ +Offline Docker - Part I +####################### + +:date: 2021-04-20 10:11 +:modified: 2021-04-20 10:11 +:category: Offlining +:author: Louis Holbrook +:tags: docker,networking,iptables,iproute +:slug: docker-offline +:summary: How to not be forced being online when forced to use docker +:lang: en +:status: published + + +.. include:: code/docker-offline/Dockerfile.archbase + :code: docker + +Bring up a virtual interface + +.. code-block:: bash + + $ ip link add foo type dummy + +Find the subnet of the network + +.. code-block:: bash + + $ docker network inspect no-internet + +Look for the config property: + +.. code-block:: bash + + "Config": [ + { + "Subnet": "10.1.1.0/24", + "Gateway": "10.1.1.1" + } + ] + +Set up dummy interface in a different subnet. + +.. code-block:: bash + + $ ip addr add 10.1.2.1/24 dev foo + +Find the bridge used by the docker container. Look for an ip address that matches the gateway of the docker network config. + +.. code-block:: bash + + $ ip addr ls + 17: br-d4ddb68f9938: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default + link/ether 02:42:9c:1a:58:d2 brd ff:ff:ff:ff:ff:ff + inet 10.1.1.1/24 brd 10.1.1.255 scope global br-d4ddb68f9938 + valid_lft forever preferred_lft forever + inet6 fe80::42:9cff:fe1a:58d2/64 scope link + valid_lft forever preferred_lft forever + [...] + 7614: foo: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-496e528b928c state UNKNOWN group default qlen 1000 + link/ether 1a:50:53:2b:96:98 brd ff:ff:ff:ff:ff:ff + inet 10.1.3.1/24 scope global foo + valid_lft forever preferred_lft forever + inet6 fe80::1850:53ff:fe2b:9698/64 scope link + valid_lft forever preferred_lft forever + +Add the virtual interface to the bridge. This makes the request pass the iptables rules added by Docker. + +.. code-block:: bash + + $ ip link set foo master br-d4ddb68f9938 + +Depending on your general iptables rules may have to explicitly allow inbound traffic, e.g. + +.. code-block:: bash + + $ iptables -I INPUT 1 --source br-d4ddb68f9938 --destination 10.1.2.1/24 -j ACCEPT + +Now a port on device `foo` should be reachable from the docker container. Let's use socat to check. + +On local host: + +.. code-block:: bash + + $ socat TCP4-LISTEN:8000,bind=10.1.2.1,reuseaddr - + +Start the docker container with shell prompt + +.. code-block:: bash + + $ docker run --network no-internet -it archbase /bin/bash + +The moment of truth + +.. code-block:: bash + + $ echo bar | socat - TCP4:10.1.2.1:8000 + +Apache listens on all interfaces. Restart after create dummy interface, and webcontent is instantly available. diff --git a/content/code/docker-offline-python/Dockerfile.localpip b/content/code/docker-offline-python/Dockerfile.localpip @@ -0,0 +1,3 @@ +FROM pythonarch + +RUN pip install --index http://localhost/python hexathon diff --git a/content/code/docker-offline-python/Dockerfile.pythonarch b/content/code/docker-offline-python/Dockerfile.pythonarch @@ -0,0 +1,4 @@ +FROM archlinux:latest + +RUN pacman -Sy && \ + pacman -S --noconfirm python python-pip diff --git a/content/code/docker-offline-python/pep503.sh b/content/code/docker-offline-python/pep503.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env + +s=$1 +d=$2 +if [ -z $d ]; then + >&2 echo "usage: pep503.sh <source_dir> <dest_dir>" + exit 1 +fi + +for df in `find $s -name "*.whl" -type f`; do + f=`basename $df` + pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` + mkdir -v $d/$pd + cp -v $df $d/$pd/ +done +for df in `find $s -name "*.tar.gz" -type f`; do + f=`basename $df` + pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` + mkdir -v $d/$pd + cp -v $df $d/$pd/ +done +for df in `find $s -name "*.zip" -type f`; do + f=`basename $df` + pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` + mkdir -v $d/$pd + cp -v $df $d/$pd/ +done diff --git a/content/code/docker-offline/Dockerfile.archbase b/content/code/docker-offline/Dockerfile.archbase @@ -0,0 +1,4 @@ +FROM archlinux:latest + +RUN pacman -Sy && \ + pacman -S --noconfirm gnu-netcat socat inetutils iproute2 curl diff --git a/content/code/keccak-benchmarks/keccak-tiny/wrap.py b/content/code/keccak-benchmarks/keccak-tiny/wrap.py @@ -0,0 +1,19 @@ +import ctypes +import sys +import time + +libkeccak = ctypes.CDLL('libkeccaktiny.so') + +buf = ctypes.pointer((ctypes.c_char * 256)()) +data = ctypes.create_string_buffer(b'foo') + +for i in range(10000): + libkeccak.hash(buf, 32, data, 3, 200-64, 1) + +start_time = time.clock_gettime_ns(time.CLOCK_PROCESS_CPUTIME_ID) +for i in range(100000): + libkeccak.hash(buf, 32, data, 3, 200-64, 1) +end_time = time.clock_gettime_ns(time.CLOCK_PROCESS_CPUTIME_ID) + +print((end_time - start_time) / (10**9)) +print(buf.contents.value.hex()) diff --git a/content/pages/identities.rst b/content/pages/identities.rst @@ -0,0 +1,16 @@ +Identities +########## + +:title: Identities +:author: Louis Holbrook + + +Keys +==== + +PGP (personal) + ``59A844A4 84AC1125 3D3A3E9D CDCBD24D D1D0E001`` +PGP (code signing) + ``0826EDA1 702D1E87 C6E28751 21D2E7BB 88C2A746`` +TOX + ``70459C0568A64737F127CA1505FA0485FBB69831C7BD6AC269E369285C7F2E0282283B2AFCD0`` diff --git a/content/pages/projects.rst b/content/pages/projects.rst @@ -0,0 +1,20 @@ +Projects +######## + +:title: Projects +:author: Louis Holbrook + +Active +====== + +Logwarrior + +Hiatus +====== + +Benford generator + +Abandoned +========= + +libswarm diff --git a/lash/static/css/style.css b/lash/static/css/style.css @@ -0,0 +1,16 @@ +.body { + width: 100%; +} + +nav#menu li { + display: inline-block; +} + +ol { + list-style-type: none; +} + +div.highlight, pre.code { + background-color: #bbb; + padding: 10px; +} diff --git a/lash/static/css/syntax.css b/lash/static/css/syntax.css @@ -0,0 +1,73 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.hll { background-color: #ffffcc } +.c { color: #408080; font-style: italic } /* Comment */ +.err { border: 1px solid #FF0000 } /* Error */ +.k { color: #008000; font-weight: bold } /* Keyword */ +.o { color: #666666 } /* Operator */ +.ch { color: #408080; font-style: italic } /* Comment.Hashbang */ +.cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.cp { color: #BC7A00 } /* Comment.Preproc */ +.cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ +.c1 { color: #408080; font-style: italic } /* Comment.Single */ +.cs { color: #408080; font-style: italic } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #888888 } /* Generic.Output */ +.gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0044DD } /* Generic.Traceback */ +.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #008000 } /* Keyword.Pseudo */ +.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #B00040 } /* Keyword.Type */ +.m { color: #666666 } /* Literal.Number */ +.s { color: #BA2121 } /* Literal.String */ +.na { color: #7D9029 } /* Name.Attribute */ +.nb { color: #008000 } /* Name.Builtin */ +.nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.no { color: #880000 } /* Name.Constant */ +.nd { color: #AA22FF } /* Name.Decorator */ +.ni { color: #999999; font-weight: bold } /* Name.Entity */ +.ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.nf { color: #0000FF } /* Name.Function */ +.nl { color: #A0A000 } /* Name.Label */ +.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.nt { color: #008000; font-weight: bold } /* Name.Tag */ +.nv { color: #19177C } /* Name.Variable */ +.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mb { color: #666666 } /* Literal.Number.Bin */ +.mf { color: #666666 } /* Literal.Number.Float */ +.mh { color: #666666 } /* Literal.Number.Hex */ +.mi { color: #666666 } /* Literal.Number.Integer */ +.mo { color: #666666 } /* Literal.Number.Oct */ +.sa { color: #BA2121 } /* Literal.String.Affix */ +.sb { color: #BA2121 } /* Literal.String.Backtick */ +.sc { color: #BA2121 } /* Literal.String.Char */ +.dl { color: #BA2121 } /* Literal.String.Delimiter */ +.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #BA2121 } /* Literal.String.Double */ +.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.sh { color: #BA2121 } /* Literal.String.Heredoc */ +.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.sx { color: #008000 } /* Literal.String.Other */ +.sr { color: #BB6688 } /* Literal.String.Regex */ +.s1 { color: #BA2121 } /* Literal.String.Single */ +.ss { color: #19177C } /* Literal.String.Symbol */ +.bp { color: #008000 } /* Name.Builtin.Pseudo */ +.fm { color: #0000FF } /* Name.Function.Magic */ +.vc { color: #19177C } /* Name.Variable.Class */ +.vg { color: #19177C } /* Name.Variable.Global */ +.vi { color: #19177C } /* Name.Variable.Instance */ +.vm { color: #19177C } /* Name.Variable.Magic */ +.il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/lash/templates/article.html b/lash/templates/article.html @@ -0,0 +1,71 @@ +{% extends "base.html" %} + +{% block html_lang %}{{ article.lang }}{% endblock %} + +{% block title %}{{ SITENAME }} - {{ article.title|striptags }}{% endblock %} + +{% block head %} + {{ super() }} + {% if article.description %} + <meta name="description" content="{{article.description}}" /> + {% endif %} +{% endblock %} + +{% block content %} +<section id="content" class="body"> + <header> + <h2 class="entry-title"> + <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" + title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> + + + <div class="category"> + Posted +<time class="published" datetime="{{ article.date.isoformat() }}"> + {{ article.locale_date }} + </time> +in <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a> +{% for tag in article.tags %} + <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> + {% endfor %} + </div> + + <ul> + {% if article.prev_article %} + <li> + Previous: <a href="{{ SITEURL }}/{{ article.prev_article.url}}"> + {{ article.prev_article.title }} + </a> + </li> + {% endif %} + {% if article.next_article %} + <li> + Next: <a href="{{ SITEURL }}/{{ article.next_article.url}}"> + {{ article.next_article.title }} + </a> + </li> + {% endif %} + </ul> +<div class="tags"> + + </div> + <hr/> + </header> + <div class="entry-content"> + {{ article.content }} + </div><!-- /.entry-content --> + <footer class="meta"> + {% if article.tags %} + <hr/> + <div class="tags"> + Tags: + {% for tag in article.tags %} + <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> + {% endfor %} + </div> + {% endif %} + + </footer> + +</section> +{% endblock %} diff --git a/lash/templates/base.html b/lash/templates/base.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html lang="{% block html_lang %}{{ DEFAULT_LANG }}{% endblock html_lang %}"> +<head> + {% block head %} + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/style.css" /> + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/syntax.css" /> + <title>{% block title %}{{ SITENAME }}{% endblock title %}</title> + <meta charset="utf-8" /> + <meta name="generator" content="Pelican" /> + {% endblock head %} +</head> + +<body id="index" class="home"> + + <header id="banner" class="body"> + <h1><a href="{{ SITEURL }}/">{{ SITENAME }}{% if SITESUBTITLE %} <strong>{{ SITESUBTITLE }}</strong>{% endif %}</a></h1> + </header> + <nav id="menu"><ul> + {% for title, link in MENUITEMS %} + <li><a href="{{ link }}">{{ title }}</a></li> + {% endfor %} + {% if DISPLAY_PAGES_ON_MENU %} + {% for p in pages %} + <li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li> + {% endfor %} + {% endif %} + {% if DISPLAY_CATEGORIES_ON_MENU %} + {% for cat, null in categories %} + <li{% if cat == category %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li> + {% endfor %} + {% endif %} + </ul></nav><!-- /#menu --> + {% block content %} + {% endblock %} + <footer id="contentinfo" class="body"> + <address id="about" class="vcard body"> + Powered by <a href="https://getpelican.com/">Pelican</a>. + </address><!-- /#about --> + </footer><!-- /#contentinfo --> +</body> +</html> diff --git a/lash/templates/index.html b/lash/templates/index.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% block content %} +<section id="content"> +{% block content_title %} +<h2>All articles</h2> +{% endblock %} + +<ol id="post-list"> +{% for article in articles_page.object_list %} + <li><article class="hentry"> + <header> <h2 class="entry-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> </header> + </article></li> +{% endfor %} +</ol><!-- /#posts-list --> +{% if articles_page.has_other_pages() %} + {% include 'pagination.html' %} +{% endif %} +</section><!-- /#content --> +{% endblock content %} diff --git a/pelicanconf.py b/pelicanconf.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- # AUTHOR = 'Louis Holbrook' -SITENAME = 'Louis Holbrook' -SITEURL = 'https://holbrook.no' +SITENAME = 'Man Bytes Dog' +SITEURL = '' PATH = 'content' @@ -32,3 +32,7 @@ DEFAULT_PAGINATION = 10 # Uncomment following line if you want document-relative URLs when developing RELATIVE_URLS = True + +DISPLAY_CATEGORIES_ON_MENU = True + +PLUGINS = ['pelican.plugins.neighbors'] diff --git a/publishconf.py b/publishconf.py @@ -21,4 +21,4 @@ DELETE_OUTPUT_DIRECTORY = True # Following items are often useful when publishing #DISQUS_SITENAME = "" -#GOOGLE_ANALYTICS = "" -\ No newline at end of file +#GOOGLE_ANALYTICS = ""