change for markdown support Part I
This commit is contained in:
parent
75d118e740
commit
3b11220b7c
|
@ -0,0 +1,110 @@
|
|||
<!doctype html>
|
||||
{% extends "template.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{{ _date.date() }}
|
||||
<p><h1>Keep It Simple</h1>
|
||||
While studying architecture not only had I so little money that I ate spaghetti and pesto every day, I learned a thing or two about design principles as well. These principles hold true for every product or piece of engineering you plan out. It is the KISS principle. Keep it simple stupid, or to quote a guy Jony Ive is clearly a fan of <a href="#references" style="text-decoration:none">[1]</a>:
|
||||
<blockquote>“Good design is as little design as possible.”<br>— Dieter Rams —</br></blockquote>
|
||||
</p>
|
||||
<p>
|
||||
Let’s expand on it so far that it should be as simple as possible without being outright stupid. To expand even further, a compelling and useful design is not only measurable by the things you can do with it, but even more important are the things you don’t have to do when you use it.
|
||||
</p>
|
||||
<p>
|
||||
As you craft something, you will inevitably communicate with everybody using your product. In proxy, any room, place or inanimate object created by a human speaks to the user. Even on an emotional level. Psychologists or product designers like computer and car designers are no strangers to this. Donald Norman wrote multiple books about it <a rhef="#references" style="text-decoration:none">[2]</a>, <a href="#references" style="text-decoration:none">[3]</a>. Some good reads. Schulz von Thun defined the <a href="http://temp.chpfeiffer.de/Four-sides_model.pdf">four-ears model</a> in which a sender’s message is received on four different levels. These are Factual information, Appeal, Self-revelation and Relationship. This means it is helpful to think about the essence of the aspect you want to craft to communicate clearly and get the message across.
|
||||
|
||||
<img style="float: right", alt="A functional lighter.", src="{{ url_for('static', filename='images/218px-White_BIC_lighter.png') }}">
|
||||
</p>
|
||||
<p>
|
||||
<h2>Pesto Principles</h2>
|
||||
<hr/>
|
||||
What about this website's design principles? First and foremost, how you spent your time is important. Do you really need to wait for more than a few seconds to load a website? Then there should be a plausible reason for that. Should you wait more than 5 seconds to be able to read something a guy is rambling about on his blog? I highly doubt it. The layout should respect you and your time. Network traffic should be minimal.
|
||||
</p>
|
||||
Second, I don’t want your data. No cookies, no statistics about you, no ad tracking of your surfing behavior. That is what you and I won’t have to put up with. You may read my blog, or you don’t. Take it or leave it. But I hope you will learn something by doing it or have a good time at least.
|
||||
<p>
|
||||
There are some points to make this website work and make it accessible. To write entries, I will use plain HTML. For now, it is sufficient. HTML is a nice markup language. Use a <code><lang></code> tag and you got translation accessibility. Another one is the following line, making the layout respond dynamically to different screen sizes. More examples on <a href="https://perfectmotherfuckingwebsite.com">this beautiful website</a>.
|
||||
<pre>
|
||||
<code>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</code>
|
||||
</pre>
|
||||
This will be a blog about computers, for the most part, there will be code examples. Further, I want to keep the stylesheet small and maintainable. Monospaced fonts are not only a dead giveaway about this fact, a solid layout is created via the following line of CSS.
|
||||
<pre>
|
||||
<code>
|
||||
.content{text-align:justify;}
|
||||
</code>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
To keep things in perspective, the date of publication will be the first line in each article. If the content may be of interest to you, knowing the date it was created is beneficial in evaluating its potential usefulness over time.
|
||||
</p>
|
||||
<p>
|
||||
There is no harm in growing something like a website incrementally. You will never miss a feature you never had in the first place. You could aspire to get it if it is conceptually meaningful and makes some sense in the overall picture. But a feature that does not exist needs no maintenance, does not produce any bugs and needs no documentation.
|
||||
<blockquote>“The things you own end up owning you.”<br>— Chuck Palahniuk —</br></blockquote>
|
||||
<h2>Cordial Code</h2>
|
||||
<hr/>
|
||||
The website was created on a Saturday afternoon in Python and Flask framework. Six months down the line, I do not want to put much energy into grasping what I had done this weekend regarding to code structure. I want to put the least amount of time possible into extending and maintaining the framework of the site. It consists of a Python file, a stylesheet, a jinja template and an empty favicon file. The last one exists because I want to avoid any error possible displayed in the network console of the browser. Everything else is content.
|
||||
|
||||
You can find the site as a repository on <a href="https://git.stefan.works">my git</a>.
|
||||
<p>
|
||||
A directory named <code>blog</code> contains all entries released as well as the ones I am working on. Metadata about subdirectories and the corresponding content is gathered inside a <key>:<value> structure. An entry is seen as valid and stored in the dictionary as soon as an index.html file is found. Who knows what might be added in the future. It will be added to a list of values. For now, metadata is solely the date of the blog articles. It is added to the RSS site automatically as well. The code snippet contains the dictionary.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<code>
|
||||
meta_data = {root[len("./templates/blog/"):] :
|
||||
datetime.fromtimestamp(os.path.getmtime(os.path.join(root,"index.html")))
|
||||
for root, dirs, files in os.walk("./templates/blog") if "index.html" in files}
|
||||
</code>
|
||||
</pre>
|
||||
Routes are set by the use of decorators. The landing page is declared in the following snippet. After the dictionary is sorted by date, <a href="https://flask.palletsprojects.com/en/2.0.x/api/#flask.render_template"><code>render_template()</code></a> returns a string. The result will be interpreted by the browser in HTML/CSS format.
|
||||
<pre>
|
||||
<code>
|
||||
@app.route('/')
|
||||
def index(_paths=meta_data):
|
||||
sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
|
||||
return render_template("index.html", _paths=sorted_meta_data)
|
||||
</code>
|
||||
</pre>
|
||||
The main page, like every other page, extends the general jinja template. It contains a list of all articles found.
|
||||
<pre>
|
||||
<code>
|
||||
{% extends "template.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p>Welcome to my website</p>
|
||||
<span class="index">
|
||||
{% for name,_date in _paths.items() %}
|
||||
<p><a href="{{ url_for('blog', blog_item=name) }}">{{ _date.date() }}  {{ name }}</a></p>
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endblock %}
|
||||
</code>
|
||||
</pre>
|
||||
URLs originate from the meta_data dictionary keys. These are the blog entries’ directory names. Flask’s <a href="https://flask.palletsprojects.com/en/2.0.x/api/#flask.url_for" ><code>url_for()</code></a> returns the articles if you want to visit the site. It handles URL encoding as well. This is pretty neat since there are spaces in the names.
|
||||
<pre>
|
||||
<code>
|
||||
@app.route('/blog/<blog_item>/index.html')
|
||||
def blog(blog_item, _date=meta_data):
|
||||
return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
|
||||
</code>
|
||||
</pre>
|
||||
<h2>Digestif</h2>
|
||||
<hr/>
|
||||
Incidentally, this turned out to be not only an opener for my blog but code documentation for myself as well. Maybe, I’ll need to pick it up in six months, who knows….
|
||||
As a closure, at least from my experience, the most feature-rich application seldom reaches its set goals. The one with a clear and precise target, fulfilling its minimal scope, most likely will.
|
||||
<p>
|
||||
<a href="https://www.bonappetit.com/recipe/best-pesto">This is how you make pesto, by the way.</a> Bon Appetit!
|
||||
</p>
|
||||
<p id="references" class="references">
|
||||
<h2>References</h2>
|
||||
<a href="https://www.bookfinder.com/?isbn=9783899555844">[1] Less and More: The Design Ethos of Dieter Rams, 2015, ISBN:9783899555844</a><br>
|
||||
<a href="https://www.bookfinder.com/?isbn=9780465051366">[2] Emotional Design: Why We Love (or Hate) Everyday Things, 2005, ISBN:9780465051366</a>
|
||||
<a href="https://www.bookfinder.com/?isbn=9780465067107">[3] The Design of Everyday Things, 2002, ISBN, 9780465067107</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,179 @@
|
|||
# Keep It Simple
|
||||
|
||||
While studying architecture not only had I so little money that I ate
|
||||
spaghetti and pesto every day, I learned a thing or two about design
|
||||
principles as well. These principles hold true for every product or
|
||||
piece of engineering you plan out. It is the KISS principle. Keep it
|
||||
simple stupid, or to quote a guy Jony Ive is clearly a fan of
|
||||
[[1]](#references){style="text-decoration:none"}:
|
||||
|
||||
> "Good design is as little design as possible."
|
||||
> --- Dieter Rams ---
|
||||
|
||||
Let's expand on it so far that it should be as simple as possible
|
||||
without being outright stupid. To expand even further, a compelling and
|
||||
useful design is not only measurable by the things you can do with it,
|
||||
but even more important are the things you don't have to do when you use
|
||||
it.
|
||||
|
||||
As you craft something, you will inevitably communicate with everybody
|
||||
using your product. In proxy, any room, place or inanimate object
|
||||
created by a human speaks to the user. Even on an emotional level.
|
||||
Psychologists or product designers like computer and car designers are
|
||||
no strangers to this. Donald Norman wrote multiple books about it
|
||||
[[2]]{#references){style="text-decoration:none"},
|
||||
[[3]](#references){style="text-decoration:none"}. Some good reads.
|
||||
Schulz von Thun defined the [four-ears
|
||||
model](http://temp.chpfeiffer.de/Four-sides_model.pdf) in which a
|
||||
sender's message is received on four different levels. These are Factual
|
||||
information, Appeal, Self-revelation and Relationship. This means it is
|
||||
helpful to think about the essence of the aspect you want to craft to
|
||||
communicate clearly and get the message across. ![A functional lighter. >](../../static/images/218px-White_BIC_lighter.png)<style="float: right",=""/>
|
||||
|
||||
## [Pesto Principles](#Pesto Principles)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
What about this website's design principles? First and foremost, how
|
||||
you spent your time is important. Do you really need to wait for more
|
||||
than a few seconds to load a website? Then there should be a plausible
|
||||
reason for that. Should you wait more than 5 seconds to be able to read
|
||||
something a guy is rambling about on his blog? I highly doubt it. The
|
||||
layout should respect you and your time. Network traffic should be
|
||||
minimal.
|
||||
|
||||
Second, I don't want your data. No cookies, no statistics about you, no
|
||||
ad tracking of your surfing behavior. That is what you and I won't have
|
||||
to put up with. You may read my blog, or you don't. Take it or leave it.
|
||||
But I hope you will learn something by doing it or have a good time at
|
||||
least.
|
||||
|
||||
There are some points to make this website work and make it accessible.
|
||||
To write entries, I will use plain HTML. For now, it is sufficient. HTML
|
||||
is a nice markup language. Use a `<lang>` tag and you got translation
|
||||
accessibility. Another one is the following line, making the layout
|
||||
respond dynamically to different screen sizes. More examples on [this
|
||||
beautiful website](https://perfectmotherfuckingwebsite.com).
|
||||
|
||||
```html
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
```
|
||||
|
||||
This will be a blog about computers, for the most part, there will be
|
||||
code examples. Further, I want to keep the stylesheet small and
|
||||
maintainable. Monospaced fonts are not only a dead giveaway about this
|
||||
fact, a solid layout is created via the following line of CSS.
|
||||
|
||||
```css
|
||||
.content{text-align:justify;}
|
||||
```
|
||||
|
||||
To keep things in perspective, the date of publication will be the first
|
||||
line in each article. If the content may be of interest to you, knowing
|
||||
the date it was created is beneficial in evaluating its potential
|
||||
usefulness over time.
|
||||
|
||||
There is no harm in growing something like a website incrementally. You
|
||||
will never miss a feature you never had in the first place. You could
|
||||
aspire to get it if it is conceptually meaningful and makes some sense
|
||||
in the overall picture. But a feature that does not exist needs no
|
||||
maintenance, does not produce any bugs and needs no documentation.
|
||||
|
||||
> "The things you own end up owning you."
|
||||
> --- Chuck Palahniuk ---
|
||||
|
||||
## Cordial Code
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
The website was created on a Saturday afternoon in Python and Flask
|
||||
framework. Six months down the line, I do not want to put much energy
|
||||
into grasping what I had done this weekend regarding to code structure.
|
||||
I want to put the least amount of time possible into extending and
|
||||
maintaining the framework of the site. It consists of a Python file, a
|
||||
stylesheet, a jinja template and an empty favicon file. The last one
|
||||
exists because I want to avoid any error possible displayed in the
|
||||
network console of the browser. Everything else is content. You can find
|
||||
the site as a repository on [my git](https://git.stefan.works).
|
||||
|
||||
A directory named `blog` contains all entries released as well as the
|
||||
ones I am working on. Metadata about subdirectories and the
|
||||
corresponding content is gathered inside a \<key\>:\<value\> structure.
|
||||
An entry is seen as valid and stored in the dictionary as soon as an
|
||||
index.html file is found. Who knows what might be added in the future.
|
||||
It will be added to a list of values. For now, metadata is solely the
|
||||
date of the blog articles. It is added to the RSS site automatically as
|
||||
well. The code snippet contains the dictionary.
|
||||
|
||||
```python
|
||||
meta_data = {root[len("./templates/blog/"):] :
|
||||
datetime.fromtimestamp(os.path.getmtime(os.path.join(root,"index.html")))
|
||||
for root, dirs, files in os.walk("./templates/blog") if "index.html" in files}
|
||||
```
|
||||
|
||||
Routes are set by the use of decorators. The landing page is declared in
|
||||
the following snippet. After the dictionary is sorted by date,
|
||||
[`render_template()`](https://flask.palletsprojects.com/en/2.0.x/api/#flask.render_template)
|
||||
returns a string. The result will be interpreted by the browser in
|
||||
HTML/CSS format.
|
||||
|
||||
```python
|
||||
@app.route('/')
|
||||
def index(_paths=meta_data):
|
||||
sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
|
||||
return render_template("index.html", _paths=sorted_meta_data)
|
||||
```
|
||||
|
||||
The main page, like every other page, extends the general jinja
|
||||
template. It contains a list of all articles found.
|
||||
|
||||
```jinja2
|
||||
{% extends "template.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p>Welcome to my website</p>
|
||||
<span class="index">
|
||||
{% for name,_date in _paths.items() %}
|
||||
<p><a href="{{ url_for('blog', blog_item=name) }}">{{ _date.date() }} {{ name }}</a></p>
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
URLs originate from the meta_data dictionary keys. These are the blog
|
||||
entries' directory names. Flask's
|
||||
[`url_for()`](https://flask.palletsprojects.com/en/2.0.x/api/#flask.url_for)
|
||||
returns the articles if you want to visit the site. It handles URL
|
||||
encoding as well. This is pretty neat since there are spaces in the
|
||||
names.
|
||||
|
||||
```python
|
||||
@app.route('/blog/<blog_item>/index.html')
|
||||
def blog(blog_item, _date=meta_data):
|
||||
return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
|
||||
```
|
||||
|
||||
## Digestif
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Incidentally, this turned out to be not only an opener for my blog but
|
||||
code documentation for myself as well. Maybe, I'll need to pick it up in
|
||||
six months, who knows.... As a closure, at least from my experience, the
|
||||
most feature-rich application seldom reaches its set goals. The one with
|
||||
a clear and precise target, fulfilling its minimal scope, most likely
|
||||
will.
|
||||
|
||||
[This is how you make pesto, by the
|
||||
way.](https://www.bonappetit.com/recipe/best-pesto) Bon Appetit!
|
||||
|
||||
## References
|
||||
|
||||
[[1] Less and More: The Design Ethos of Dieter Rams, 2015,
|
||||
ISBN:9783899555844](https://www.bookfinder.com/?isbn=9783899555844)
|
||||
[[2] Emotional Design: Why We Love (or Hate) Everyday Things, 2005,
|
||||
ISBN:9780465051366](https://www.bookfinder.com/?isbn=9780465051366)
|
||||
[[3] The Design of Everyday Things, 2002, ISBN,
|
||||
9780465067107](https://www.bookfinder.com/?isbn=9780465067107)
|
|
@ -0,0 +1,85 @@
|
|||
<!doctype html>
|
||||
{% extends "template.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{{ _date.date() }}
|
||||
<p><h1>The Joy of One-Liners</h1>
|
||||
There is an engineering idiom which withstands time like no other. As old as the hills but never forgotten. In informational technology relations, one could say it is ancient. Its dawn proclaimed from the shores of Seattle, defeated by an apocalyptic horseman with the melodious name <i>NT</i>. Shot! Point blank into the chest. Buried under the hills of an IT dark age which we call the nineties, dead. But is it? Well, not exactly. There is still life in the old dog. Like Beatrix Kiddo, it one-inch punches itself back to daylight. Coal black as a miner. Topsoil sticks to its beige 1978’s leather jacket, it trickles to the ground with every step taken to the nearest diner. The door opens again. “May I have a glass of water, please?”
|
||||
</p>
|
||||
<p>
|
||||
An art passed down from the ancestors. Its most visible interface: <i>The Shell</i>. Its name: <i>The Unix Philosophy</i>.
|
||||
<p>
|
||||
Coined by Doug McIlroy in the <a href="https://archive.org/details/bstj57-6-1899/mode/2up">Bell System Technical Journal</a> as a foreword to the UNIX Time-Sharing System. There is an even more concise version<a href=#references" style="text-decoration:none">[1]</a> and according to <a href="http://www.catb.org/~esr/writings/taoup/html/ch01s06.html">Eric Steven Raymond</a> this is <a href="#references" style="text-decoration:none">[2]</a>:
|
||||
<blockquote>“This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.”<br>— Doug McIlroy —</br></blockquote>
|
||||
</p>
|
||||
<p>
|
||||
In some way, this is similar to the concept of the on vogue philosophy of microservices everywhere. Services are written to do one thing and do it well. They work together. Also, text is the connecting link between programs, services, and humans. The possibility to read a program’s output as text seems benign, as long as everything is working well. The advantage is interactivity at any time, testability of every component, and debuggability at every step of the process in an on the fly manner. Impromptu, out of reflex like a punch.
|
||||
</p>
|
||||
<h2>Pipe Dreams</h2>
|
||||
<hr/>
|
||||
Mc Ilroy made another very important contribution, which is the Unix pipe. It is the practical implementation of connecting the programs inside the shell. He saw the programs as tools, plugged together via pipes building a <a href="http://www.princeton.edu/~hos/Mahoney/expotape.htm">toolbox</a>. Program A’s <code>stdout</code> is put into the <code>stdin</code> of program B. This leaves us with a single line of chained, well-defined programs to solve a problem that would otherwise be an extensive, multi-line program in any programming language of your choice.
|
||||
</p>
|
||||
Let’s say we’ve got two programs. The first is one is <i>fortune</i>, the fortune cookie program from BSD games, which outputs random quotes as text. The second one is <i>cowsay</i>, which displays various kinds of animals as ASCII art. In order to work in a coherent manner a <code>|</code> is used. The pipe connects the first one to the second one.
|
||||
<p>
|
||||
<pre>
|
||||
<code>
|
||||
❯ fortune | cowsay
|
||||
_________________________________________
|
||||
/ Gil-galad was an Elven-king. Of him the \
|
||||
| harpers sadly sing: the last whose |
|
||||
| realm was fair and free between the |
|
||||
| Mountains and the Sea. |
|
||||
| |
|
||||
| His sword was long, his lance was keen, |
|
||||
| his shining helm afar was seen; the |
|
||||
| countless stars of heaven's field were |
|
||||
| mirrored in his silver shield. |
|
||||
| |
|
||||
| But long ago he rode away, and where he |
|
||||
| dwelleth none can say; for into |
|
||||
| darkness fell his star in Mordor where |
|
||||
| the shadows are. |
|
||||
| |
|
||||
\ -- J. R. R. Tolkien /
|
||||
-----------------------------------------
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
</code>
|
||||
</pre>
|
||||
<p>
|
||||
To mix in some colors pipe everything through lolcat. Try it out!
|
||||
</p>
|
||||
<pre>
|
||||
<code>
|
||||
❯ fortune | cowsay | lolcat
|
||||
</code>
|
||||
</pre>
|
||||
<p>
|
||||
So far so good, let us gain some real-world practice.
|
||||
</p>
|
||||
<h2>Punching Lines — Retire Your Password Generator</h2>
|
||||
<hr/>
|
||||
Have you ever questioned the integrity of your one-click, GUI, proprietary password generator? Is its randomness really as unpredictable as it proclaims? Are you the only one which ends up knowing your generated password? There is a one-liner that ups your opsec instantly. Right from the source of randomness:
|
||||
<pre>
|
||||
<code>
|
||||
❯ head -n 42 /dev/urandom | tr -cd '[:alnum:]' | cut -c-12
|
||||
</code>
|
||||
</pre>
|
||||
So, what is going on here? Everything is a file, that is the way *nix systems see it, even the device which puts out random data. To read the upper part of a file we use <code>head</code>. It will be sent to <code>stdout</code> and displayed via the shell. Parameter <code>-n</code> reads exactly 42 lines of the file given to gather enough randomness. The output of <code>head</code> will be sent to <code>tr</code>. In order to select only alphanumeric characters for our password, we use <code>'[:alnum:]'</code>. Parameters <code>-c</code> selects the complement of alphanumeric characters and <code>-d</code> deletes them. <code>cut</code> does exactly what it says, <code>-c-12</code> cuts after 12 characters with leaves us with a random password of length 12. Every time you execute this one-liner a freshly made random password is returned.
|
||||
<p>
|
||||
To extend the pool of possible symbols the manual of <code>tr</code> lists various sets of filtered symbols. In the case of a password generator, further sensible filters are <code>'[:alpha:]'</code> or <code>'[:digit:]'</code>. While <code>'[:graph:]'</code> is also viable in this case it returns one of the greater sets of symbols. Use it with caution, especially if you create passwords for database users. These might be terminated prematurely through <code>`</code> or <code>'</code> inside the returned string.
|
||||
</p>
|
||||
<h2>Sunday Punch</h2>
|
||||
<hr/>
|
||||
This blog entrance can be seen as a prelude to a series of one-liners I use time and time again. The are multiple in the pipeline. One-liners should save you the time you otherwise would spend coding a complex solution. There is little better than solving a challenging problem in a single line.
|
||||
<p id="references" class="references">
|
||||
<h2>References</h2>
|
||||
<a href="https://www.bookfinder.com/?isbn=9780201547771">[1] A Quarter Century of Unix, 1994, Peter Salus, ISBN:9780201547771</a><br>
|
||||
<a href="https://www.bookfinder.com/?isbn=9780131429017">[2] The Art of UNIX Programming, 2003, Eric Raymond, ISBN:9780131429017</a><br>
|
||||
</p>
|
||||
{% endblock %}
|
|
@ -0,0 +1,144 @@
|
|||
# The Joy of One-Liners
|
||||
|
||||
There is an engineering idiom which withstands time like no other. As
|
||||
old as the hills but never forgotten. In informational technology
|
||||
relations, one could say it is ancient. Its dawn proclaimed from the
|
||||
shores of Seattle, defeated by an apocalyptic horseman with the
|
||||
melodious name *NT*. Shot! Point blank into the chest. Buried under the
|
||||
hills of an IT dark age which we call the nineties, dead. But is it?
|
||||
Well, not exactly. There is still life in the old dog. Like Beatrix
|
||||
Kiddo, it one-inch punches itself back to daylight. Coal black as a
|
||||
miner. Topsoil sticks to its beige 1978's leather jacket, it trickles to
|
||||
the ground with every step taken to the nearest diner. The door opens
|
||||
again. "May I have a glass of water, please?"
|
||||
|
||||
An art passed down from the ancestors. Its most visible interface: *The
|
||||
Shell*. Its name: *The Unix Philosophy*.
|
||||
|
||||
Coined by Doug McIlroy in the [Bell System Technical
|
||||
Journal](https://archive.org/details/bstj57-6-1899/mode/2up) as a
|
||||
foreword to the UNIX Time-Sharing System. There is an even more concise
|
||||
version[[1]](#references){style="text-decoration:none"} and
|
||||
according to [Eric Steven
|
||||
Raymond](http://www.catb.org/~esr/writings/taoup/html/ch01s06.html) this
|
||||
is [[2]](#references){style="text-decoration:none"}:
|
||||
|
||||
> "This is the Unix philosophy: Write programs that do one thing and do
|
||||
> it well. Write programs to work together. Write programs to handle
|
||||
> text streams, because that is a universal interface."
|
||||
> --- Doug McIlroy ---
|
||||
|
||||
In some way, this is similar to the concept of the on vogue philosophy
|
||||
of microservices everywhere. Services are written to do one thing and do
|
||||
it well. They work together. Also, text is the connecting link between
|
||||
programs, services, and humans. The possibility to read a program's
|
||||
output as text seems benign, as long as everything is working well. The
|
||||
advantage is interactivity at any time, testability of every component,
|
||||
and debuggability at every step of the process in an on the fly manner.
|
||||
Impromptu, out of reflex like a punch.
|
||||
|
||||
## Pipe Dreams
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Mc Ilroy made another very important contribution, which is the Unix
|
||||
pipe. It is the practical implementation of connecting the programs
|
||||
inside the shell. He saw the programs as tools, plugged together via
|
||||
pipes building a
|
||||
[toolbox](http://www.princeton.edu/~hos/Mahoney/expotape.htm). Program
|
||||
A's `stdout` is put into the `stdin` of program B. This leaves us with a
|
||||
single line of chained, well-defined programs to solve a problem that
|
||||
would otherwise be an extensive, multi-line program in any programming
|
||||
language of your choice.
|
||||
|
||||
Let's say we've got two programs. The first is one is *fortune*, the
|
||||
fortune cookie program from BSD games, which outputs random quotes as
|
||||
text. The second one is *cowsay*, which displays various kinds of
|
||||
animals as ASCII art. In order to work in a coherent manner a `|` is
|
||||
used. The pipe connects the first one to the second one.
|
||||
|
||||
```sh
|
||||
fortune | cowsay
|
||||
_________________________________________
|
||||
/ Gil-galad was an Elven-king. Of him the \
|
||||
| harpers sadly sing: the last whose |
|
||||
| realm was fair and free between the |
|
||||
| Mountains and the Sea. |
|
||||
| |
|
||||
| His sword was long, his lance was keen, |
|
||||
| his shining helm afar was seen; the |
|
||||
| countless stars of heaven's field were |
|
||||
| mirrored in his silver shield. |
|
||||
| |
|
||||
| But long ago he rode away, and where he |
|
||||
| dwelleth none can say; for into |
|
||||
| darkness fell his star in Mordor where |
|
||||
| the shadows are. |
|
||||
| |
|
||||
\ -- J. R. R. Tolkien /
|
||||
-----------------------------------------
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
```
|
||||
|
||||
To mix in some colors pipe everything through lolcat. Try it out!
|
||||
|
||||
```sh
|
||||
fortune | cowsay | lolcat
|
||||
```
|
||||
So far so good, let us gain some real-world practice.
|
||||
|
||||
## Punching Lines --- Retire Your Password Generator
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Have you ever questioned the integrity of your one-click, GUI,
|
||||
proprietary password generator? Is its randomness really as
|
||||
unpredictable as it proclaims? Are you the only one which ends up
|
||||
knowing your generated password? There is a one-liner that ups your
|
||||
opsec instantly. Right from the source of randomness:
|
||||
|
||||
```sh
|
||||
head -n 42 /dev/urandom | tr -cd '[:alnum:]' | cut -c-12
|
||||
```
|
||||
|
||||
So, what is going on here? Everything is a file, that is the way \*nix
|
||||
systems see it, even the device which puts out random data. To read the
|
||||
upper part of a file we use `head`. It will be sent to `stdout` and
|
||||
displayed via the shell. Parameter `-n` reads exactly 42 lines of the
|
||||
file given to gather enough randomness. The output of `head` will be
|
||||
sent to `tr`. In order to select only alphanumeric characters for our
|
||||
password, we use `'[:alnum:]'`. Parameters `-c` selects the complement
|
||||
of alphanumeric characters and `-d` deletes them. `cut` does exactly
|
||||
what it says, `-c-12` cuts after 12 characters with leaves us with a
|
||||
random password of length 12. Every time you execute this one-liner a
|
||||
freshly made random password is returned.
|
||||
|
||||
To extend the pool of possible symbols the manual of `tr` lists various
|
||||
sets of filtered symbols. In the case of a password generator, further
|
||||
sensible filters are `'[:alpha:]'` or `'[:digit:]'`. While `'[:graph:]'`
|
||||
is also viable in this case it returns one of the greater sets of
|
||||
symbols. Use it with caution, especially if you create passwords for
|
||||
database users. These might be terminated prematurely through `` ` `` or
|
||||
`'` inside the returned string.
|
||||
|
||||
## Sunday Punch
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
This blog entrance can be seen as a prelude to a series of one-liners I
|
||||
use time and time again. The are multiple in the pipeline. One-liners
|
||||
should save you the time you otherwise would spend coding a complex
|
||||
solution. There is little better than solving a challenging problem in a
|
||||
single line.
|
||||
|
||||
## References
|
||||
|
||||
[[1] A Quarter Century of Unix, 1994, Peter Salus,
|
||||
ISBN:9780201547771](https://www.bookfinder.com/?isbn=9780201547771)
|
||||
[[2] The Art of UNIX Programming, 2003, Eric Raymond,
|
||||
ISBN:9780131429017](https://www.bookfinder.com/?isbn=9780131429017)
|
||||
|
|
@ -11,6 +11,11 @@ Flask = "^2.3.2"
|
|||
feedgen = "^0.9.0"
|
||||
Frozen-Flask = "^0.18"
|
||||
pytz = "^2023.3"
|
||||
Markdown = "^3.4.1"
|
||||
Flask-Markdown = "^0.3"
|
||||
Pygments = "^2.12.0"
|
||||
python-markdown-math = "*"
|
||||
toml = "*"
|
||||
|
||||
|
||||
[build-system]
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
[project]
|
||||
name = "Stefan's Blog"
|
||||
title = "My personal Blog"
|
||||
|
||||
[content]
|
||||
path = "blog/"
|
||||
style = "one-dark" # Supported styles are
|
||||
# monokai, one-dark, solarized-dark, solarized-light, github-dark, xcode, nord
|
||||
# taken from https://pygments.org/styles/
|
||||
|
145
start_site.py
145
start_site.py
|
@ -1,41 +1,131 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import toml
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
from flask import Flask, url_for, render_template, send_from_directory
|
||||
from flask import make_response
|
||||
from feedgen.feed import FeedGenerator
|
||||
from flaskext.markdown import Markdown
|
||||
import markdown
|
||||
import markdown.extensions.fenced_code
|
||||
import markdown.extensions.codehilite
|
||||
import markdown.extensions.toc
|
||||
from markdown.extensions.toc import TocExtension
|
||||
from pygments.formatters import HtmlFormatter
|
||||
|
||||
app = Flask(__name__)
|
||||
Markdown(app)
|
||||
|
||||
meta_data = {
|
||||
root[len("./blog/"):]: datetime.fromtimestamp(
|
||||
os.path.getmtime(
|
||||
os.path.join(root, "index.html")
|
||||
)
|
||||
)
|
||||
for root, dirs, files in os.walk("./blog")
|
||||
if "index.html" in files
|
||||
}
|
||||
|
||||
app.config["blog"] = toml.load("settings.toml")
|
||||
content_path = app.config["blog"]["content"]["path"]
|
||||
highlight_style = app.config["blog"]["content"]["style"]
|
||||
STYLESHEET = "stylesheet.css"
|
||||
STYLESHEET_AUTO_COMPLETE = "auto-complete.css"
|
||||
project_name = app.config["blog"]["project"]["name"]
|
||||
project_title = app.config["blog"]["project"]["title"]
|
||||
|
||||
app.config["blog"]["style"] = toml.load("style.toml")
|
||||
colors = app.config["blog"]["style"][highlight_style]
|
||||
|
||||
meta_data = {root[len("./templates/blog/"):] :
|
||||
datetime.fromtimestamp(os.path.getmtime(os.path.join(root,"index.html")))
|
||||
for root, dirs, files in os.walk("./templates/blog") if "index.html" in files}
|
||||
|
||||
@app.route('/')
|
||||
def index(_paths=meta_data):
|
||||
''' Main Site.
|
||||
'''
|
||||
sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
|
||||
return render_template("index.html", _paths=sorted_meta_data)
|
||||
sorted_meta_data = dict(
|
||||
sorted(
|
||||
meta_data.items(),
|
||||
reverse=True,
|
||||
key=lambda item: item[1]
|
||||
)
|
||||
)
|
||||
return render_template("index.html", colors=colors, _paths=sorted_meta_data)
|
||||
|
||||
|
||||
@app.route('/blog/<blog_item>/index.html')
|
||||
def blog(blog_item, _date=meta_data):
|
||||
''' Blog Pages.
|
||||
'''
|
||||
return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
|
||||
md_file_path = os.path.join(f"blog/{blog_item}/index.md")
|
||||
with open(md_file_path, "r") as _f:
|
||||
md_file = _f.read()
|
||||
md_extensions = [
|
||||
'toc',
|
||||
TocExtension(toc_class="", title=""),
|
||||
"fenced_code",
|
||||
"codehilite",
|
||||
"tables",
|
||||
"mdx_math"
|
||||
]
|
||||
|
||||
md_configs = {"mdx_math": {"enable_dollar_delimiter": True}}
|
||||
md = markdown.Markdown(
|
||||
extensions=md_extensions,
|
||||
extension_configs=md_configs
|
||||
)
|
||||
|
||||
html = md.convert(md_file)
|
||||
|
||||
formatter = HtmlFormatter(
|
||||
style=highlight_style,
|
||||
full=True,
|
||||
cssclass="codehilite"
|
||||
)
|
||||
css_string = formatter.get_style_defs()
|
||||
md_css_string = "<style>" + css_string + "</style>"
|
||||
md_template = md_css_string + html
|
||||
res = render_template(
|
||||
"blog.html",
|
||||
#toc=md.toc,
|
||||
md_doc=md_template,
|
||||
colors=colors,
|
||||
stylesheet=STYLESHEET,
|
||||
#stylesheet_auto_complete=STYLESHEET_AUTO_COMPLETE,
|
||||
project_name=project_name,
|
||||
project_title=project_title,
|
||||
# tree=cut_path_tree(
|
||||
# #rem_readme(content_path, make_tree(content_path)),
|
||||
# make_tree(content_path),
|
||||
# content_path,
|
||||
# ".md" # )
|
||||
_date=meta_data[blog_item]
|
||||
)
|
||||
response = make_response(res)
|
||||
response.headers["Content-Type"] = "text/html; charset=utf-8"
|
||||
return response
|
||||
|
||||
|
||||
# return render_template(
|
||||
# f"blog/{blog_item}/index.html",
|
||||
# _date=meta_data[blog_item]
|
||||
# )
|
||||
|
||||
|
||||
@app.route("/about.html")
|
||||
def about():
|
||||
''' About Page.
|
||||
'''
|
||||
return render_template("about.html")
|
||||
return render_template("about.html", colors=colors)
|
||||
|
||||
|
||||
@app.route("/contact.html")
|
||||
def contact():
|
||||
''' Contact Page.
|
||||
'''
|
||||
return render_template("contact.html")
|
||||
return render_template("contact.html", colors=colors)
|
||||
|
||||
|
||||
@app.route("/rss.xml")
|
||||
def rss(_items=meta_data):
|
||||
|
@ -60,40 +150,57 @@ def rss(_items=meta_data):
|
|||
_fe.pubDate(pubDate=_tz.localize(meta_data[key]))
|
||||
_fg.rss_str(pretty=True)
|
||||
_fg.rss_file('./static/rss.xml')
|
||||
return send_from_directory(os.path.join(app.root_path, 'static'), 'rss.xml')
|
||||
return send_from_directory(
|
||||
os.path.join(
|
||||
app.root_path,
|
||||
'static'
|
||||
),
|
||||
'rss.xml'
|
||||
)
|
||||
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
''' Provides favicon.
|
||||
'''
|
||||
return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico')
|
||||
return send_from_directory(
|
||||
os.path.join(
|
||||
app.root_path,
|
||||
'static'
|
||||
),
|
||||
'favicon.ico'
|
||||
)
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(_error):
|
||||
''' Error Handling.
|
||||
Error 404
|
||||
'''
|
||||
return render_template("/status_code/404.html"), 404
|
||||
return render_template("/status_code/404.html", colors=colors), 404
|
||||
|
||||
|
||||
@app.errorhandler(400)
|
||||
def bad_request(_error):
|
||||
''' Error Handling.
|
||||
Error 400
|
||||
'''
|
||||
return render_template("/status_code/400.html"), 400
|
||||
return render_template("/status_code/400.html", colors=colors), 400
|
||||
|
||||
|
||||
@app.errorhandler(500)
|
||||
def internal_server_error(_error):
|
||||
''' Error Handling.
|
||||
Error 500
|
||||
'''
|
||||
return render_template("/status_code/500.html"), 500
|
||||
return render_template("/status_code/500.html", colors=colors), 500
|
||||
|
||||
|
||||
with app.test_request_context():
|
||||
print(url_for("index"))
|
||||
print(url_for("about"))
|
||||
print(url_for("contact"))
|
||||
print(url_for("rss"))
|
||||
print(url_for("static", filename="stylesheet.css"))
|
||||
print(meta_data)
|
||||
print(url_for("blog", blog_item="first_blog"))
|
||||
# print(url_for("about"))
|
||||
# print(url_for("contact"))
|
||||
# print(url_for("rss"))
|
||||
# print(url_for("static", filename="stylesheet.css"))
|
||||
# print(meta_data)
|
||||
# print(url_for("blog", blog_item="first_blog"))
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Tue, 20 Jun 2023 19:21:25 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:27:49 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 18:57:19 +0200</pubDate></item></channel></rss>
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Sat, 08 Jul 2023 11:34:36 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:52:44 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 22:47:04 +0200</pubDate></item></channel></rss>
|
|
@ -1,20 +1,37 @@
|
|||
html *{ font-family: Dejavu Sans Mono, MesloGS NF, Menlo, Consolas, Monospace !important; color: #222;}
|
||||
/* html *{ font-family: Dejavu Sans Mono, MesloGS NF, Menlo, Consolas, Monospace !important; color: #222;} */
|
||||
/* body {text-align: justify; max-width: 86ch; margin:40px auto; padding: 0 10px; text-decoration: none;} */
|
||||
/* h1 { font-size: 28px; } */
|
||||
/* h2 { font-size: 22px; margin-bottom: 2px; } */
|
||||
/* h3 { font-size: 14px; } */
|
||||
/* p { font-size: 16px; } */
|
||||
/* blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;} */
|
||||
/* pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; } */
|
||||
/* code { background-color: #eee;color: #2f3337; } */
|
||||
/* hr { height: 1px; background: #333; border: 0px;} */
|
||||
/* a {color: inherit; text-decoration: solid underline;} */
|
||||
/* a:hover {color: red;} */
|
||||
/* img { max-width: 100%; } */
|
||||
/* .menu { line-height: 1em; font-size: 24px; line-height: 1em; text-decoration: none; } */
|
||||
/* .index { color: inherit; text-decoration: solid underline; } */
|
||||
/* .references { text-decoration: solid underline; text-underline-position: under; } */
|
||||
/* .contact{text-align: center;} */
|
||||
|
||||
|
||||
|
||||
html *{ font-family: Dejavu Sans Mono, MesloGS NF, Menlo, Consolas, Monospace !important;}
|
||||
body {text-align: justify; max-width: 86ch; margin:40px auto; padding: 0 10px; text-decoration: none;}
|
||||
h1 { font-size: 28px; }
|
||||
h2 { font-size: 22px; margin-bottom: 2px; }
|
||||
h3 { font-size: 14px; }
|
||||
p { font-size: 16px; }
|
||||
blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;}
|
||||
pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
||||
code { background-color: #eee;color: #2f3337; }
|
||||
hr { height: 1px; background: #333; border: 0px;}
|
||||
pre { border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
||||
code { background-color: #282C34; color: #979FAD; }
|
||||
hr { height: 1px; border: 0px;}
|
||||
a {color: inherit; text-decoration: solid underline;}
|
||||
a:hover {color: red;}
|
||||
img { max-width: 100%; }
|
||||
.menu { line-height: 1em; font-size: 24px; line-height: 1em; text-decoration: none; }
|
||||
.index { color: inherit; text-decoration: solid underline; }
|
||||
.references { text-decoration: solid underline; text-underline-position: under; }
|
||||
.contact{text-align: center;}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
[github-dark]
|
||||
body_background ="#161b22"
|
||||
body = "#ecf2f8"
|
||||
pre_background = "#0d1117"
|
||||
pre = "#ecf2f8"
|
||||
#pre_border = "#89929b"
|
||||
pre_border = "none"
|
||||
code_background = "#0d1117"
|
||||
code = "#ecf2f8"
|
||||
a = "#77bdfb"
|
||||
details_background = "#0d1117"
|
||||
details_hover_background = "#21262d"
|
||||
details_hover = "#ecf2f8"
|
||||
selection_background = "#fa7970"
|
||||
moz_selection_background = "#fa7970"
|
||||
header_background = "#0d1117"
|
||||
nav_background = "#0d1117"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#89929b"
|
||||
search_input_background = "#161b22"
|
||||
search_input = "#c6cdd5"
|
||||
search_input_border = "#21262d"
|
||||
search_focus_border = "#c6cdd5"
|
||||
autocomplete_suggestions_background = "#0d1117"
|
||||
autocomplete_suggestions_border = "#c6cdd5"
|
||||
autocomplete_suggestion = "#ecf2f8"
|
||||
autocomplete_suggestion_b = "#161b22"
|
||||
autocomplete_suggestion_selected_background = "#77bdfb"
|
||||
autocomplete_suggestion_selected = "#ecf2f8"
|
||||
autocomplete_suggestion_hover_background = "#77bdfb"
|
||||
autocomplete_suggestion_hover = "#ecf2f8"
|
||||
|
||||
[nord]
|
||||
body_background ="#616e87"
|
||||
body = "#d8dee9"
|
||||
pre_background = "#2e3440"
|
||||
pre = "#d8dee9"
|
||||
#pre_border = "#89929b"
|
||||
pre_border = "none"
|
||||
code_background = "#2e3440"
|
||||
code = "#d8dee9"
|
||||
a = "#a3be8c"
|
||||
details_background = "#2e3440"
|
||||
details_hover_background = "#616e87"
|
||||
details_hover = "#2e3440"
|
||||
selection_background = "#d08770"
|
||||
moz_selection_background = "#d08770"
|
||||
header_background = "#2e3440"
|
||||
nav_background = "#2e3440"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#2e3440"
|
||||
search_input_background = "#616e87"
|
||||
search_input = "#d8dee9"
|
||||
search_input_border = "#616e87"
|
||||
search_focus_border = "#d08770"
|
||||
autocomplete_suggestions_background = "#2e3440"
|
||||
autocomplete_suggestions_border = "#81a1c1"
|
||||
autocomplete_suggestion = "#d8dee9"
|
||||
autocomplete_suggestion_b = "#161b22"
|
||||
autocomplete_suggestion_selected_background = "#77bdfb"
|
||||
autocomplete_suggestion_selected = "#ecf2f8"
|
||||
autocomplete_suggestion_hover_background = "#81a1c1"
|
||||
autocomplete_suggestion_hover = "#d8dee9"
|
||||
|
||||
[one-dark]
|
||||
body_background ="#2f333d"
|
||||
body = "#979fad"
|
||||
pre_background = "#282c34"
|
||||
pre = "#979fad"
|
||||
pre_border = "#282c34"
|
||||
code_background = "#282c34"
|
||||
code = "#979fad"
|
||||
a = "#be5046"
|
||||
details_background = "#282c34"
|
||||
details_hover_background = "#2f333d"
|
||||
details_hover = "#979fad"
|
||||
selection_background = "#668799"
|
||||
moz_selection_background = "#668799"
|
||||
header_background = "#282c34"
|
||||
nav_background = "#282c34"
|
||||
#content_border_top = "#979fad"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#979fad"
|
||||
search_input_background = "#3a3f4b"
|
||||
search_input = "#979fad"
|
||||
search_input_border = "#282c34"
|
||||
search_focus_border = "#d19a66"
|
||||
autocomplete_suggestions_background = "#3a3f4b"
|
||||
autocomplete_suggestions_border = "#2f333d"
|
||||
autocomplete_suggestion = "#979fad"
|
||||
autocomplete_suggestion_b = "#979fad"
|
||||
autocomplete_suggestion_selected_background = "#d19a66"
|
||||
autocomplete_suggestion_selected = "#3a3f4b"
|
||||
autocomplete_suggestion_hover_background = "#d19a66"
|
||||
autocomplete_suggestion_hover = "#3a3f4b"
|
||||
|
||||
[solarized-dark]
|
||||
body_background ="#073642"
|
||||
body = "#93a1a1"
|
||||
pre_background = "#002b36"
|
||||
pre = "#839496"
|
||||
pre_border = "none"
|
||||
code_background = "#002b36"
|
||||
code = "#839496"
|
||||
a = "#b58900"
|
||||
details_background = "#002b36"
|
||||
details_hover_background = "#839496"
|
||||
details_hover = "#002b36"
|
||||
selection_background = "#fdf6e3"
|
||||
moz_selection_background = "#fdf6e3"
|
||||
header_background = "#002b36"
|
||||
nav_background = "#002b36"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#002b36"
|
||||
search_input_background = "#073642"
|
||||
search_input = "#002b36"
|
||||
search_input_border = "#002b36"
|
||||
search_focus_border = "#b58900"
|
||||
autocomplete_suggestions_background = "#eee8d5"
|
||||
autocomplete_suggestions_border = "#b58900"
|
||||
autocomplete_suggestion = "#657b83"
|
||||
autocomplete_suggestion_b = "#1f8dd6"
|
||||
autocomplete_suggestion_selected_background = "#073642"
|
||||
autocomplete_suggestion_selected = "#93a1a1"
|
||||
autocomplete_suggestion_hover_background = "#073642"
|
||||
autocomplete_suggestion_hover = "#93a1a1"
|
||||
|
||||
[solarized-light]
|
||||
body_background ="#fdf6e3"
|
||||
body = "#657b83"
|
||||
pre_background = "#eee8d5"
|
||||
pre = "#657b83"
|
||||
pre_border = "none"
|
||||
code_background = "#eee8d5"
|
||||
code = "#657b83"
|
||||
a = "#073642"
|
||||
details_background = "#eee8d5"
|
||||
details_hover_background = "#073642"
|
||||
details_hover = "#eee8d5"
|
||||
selection_background = "#073642"
|
||||
moz_selection_background = "#073642"
|
||||
header_background = "#eee8d5"
|
||||
nav_background = "#eee8d5"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#002b36"
|
||||
search_input_background = "#fdf6e3"
|
||||
search_input = "#657b83"
|
||||
search_input_border = "#002b36"
|
||||
search_focus_border = "#b58900"
|
||||
autocomplete_suggestions_background = "#eee8d5"
|
||||
autocomplete_suggestions_border = "#b58900"
|
||||
autocomplete_suggestion = "#657b83"
|
||||
autocomplete_suggestion_b = "#1f8dd6"
|
||||
autocomplete_suggestion_selected_background = "#073642"
|
||||
autocomplete_suggestion_selected = "#93a1a1"
|
||||
autocomplete_suggestion_hover_background = "#073642"
|
||||
autocomplete_suggestion_hover = "#93a1a1"
|
||||
|
||||
[monokai]
|
||||
body_background ="#3e3d32"
|
||||
body = "#f8f8f2"
|
||||
pre_background = "#272822"
|
||||
pre = "#cfcfc2"
|
||||
pre_border = "none"
|
||||
code_background = "#272822"
|
||||
code = "#cfcfc2"
|
||||
a = "#fd5ff0"
|
||||
details_background = "#272822"
|
||||
details_hover_background = "#e6db74"
|
||||
details_hover = "#3e3d32"
|
||||
selection_background = "#fd5ff0"
|
||||
moz_selection_background = "#fd5ff0"
|
||||
header_background = "#272822"
|
||||
nav_background = "#272822"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#cfcfc2"
|
||||
search_input_background = "#3e3d32"
|
||||
search_input = "#75715e"
|
||||
search_input_border = "#75715e"
|
||||
search_focus_border = "#ae81ff"
|
||||
autocomplete_suggestions_background = "#272822"
|
||||
autocomplete_suggestions_border = "#ae81ff"
|
||||
autocomplete_suggestion = "#cfcfc2"
|
||||
autocomplete_suggestion_b = "#a6e22e"
|
||||
autocomplete_suggestion_selected_background = "#ae81ff"
|
||||
autocomplete_suggestion_selected = "#cfcfc2"
|
||||
autocomplete_suggestion_hover_background = "#ae81ff"
|
||||
autocomplete_suggestion_hover = "#cfcfc2"
|
||||
|
||||
[xcode]
|
||||
body_background ="#fff"
|
||||
body = "#262626"
|
||||
pre_background = "#ecf5ff"
|
||||
pre = "#262626"
|
||||
pre_border = "none"
|
||||
code_background = "#ecf5ff"
|
||||
code = "#262626"
|
||||
a = "#2ed9ff"
|
||||
details_background = "#ecf5ff"
|
||||
details_hover_background = "#2ed9ff"
|
||||
details_hover = "#ecf2f8"
|
||||
selection_background = "#2e9dff"
|
||||
moz_selection_background = "#2e9dff"
|
||||
header_background = "#ecf5ff"
|
||||
nav_background = "#ecf5ff"
|
||||
content_border_top = "none"
|
||||
content_border_bottom = "#262626"
|
||||
search_input_background = "#fff"
|
||||
search_input = "#262626"
|
||||
search_input_border = "#262626"
|
||||
search_focus_border = "#2e9dff"
|
||||
autocomplete_suggestions_background = "#ecf5ff"
|
||||
autocomplete_suggestions_border = "#262626"
|
||||
autocomplete_suggestion = "#262626"
|
||||
autocomplete_suggestion_b = "#262626"
|
||||
autocomplete_suggestion_selected_background = "#2ed9ff"
|
||||
autocomplete_suggestion_selected = "#e5e5e5"
|
||||
autocomplete_suggestion_hover_background = "#2ed9ff"
|
||||
autocomplete_suggestion_hover = "#e5e5e5"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{% extends "template.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<span class="body">
|
||||
{{ _date.date() }}
|
||||
{{ md_doc|markdown }}
|
||||
</span>
|
||||
{% endblock %}
|
|
@ -10,6 +10,18 @@
|
|||
<div class="menu">
|
||||
<a href="{{ url_for('index') }}" style="text-decoration:none">Stefan Friese's Website</a>
|
||||
</div>
|
||||
<style>
|
||||
/* Stylesheet 1 */
|
||||
body { background: {{ colors.body_background }}; color: {{ colors.body }}; }
|
||||
pre { background: {{ colors.pre_background }}; color: {{ colors.pre }}; border: 1px solid {{ colors.pre_border }}; }
|
||||
code { background: {{ colors.code_background }}; color: {{ colors.code }}; }
|
||||
a:hover { color: {{ colors.a }}; }
|
||||
details > summary { background: {{ colors.details_background }}; }
|
||||
details > summary:hover { background: {{ colors.details_hover_background }}; color: {{ colors.details_hover }}; }
|
||||
::selection { background: {{ colors.selection_background }}; }
|
||||
::-moz-selection { background: {{ colors.moz_selection_background }}; }
|
||||
</style>
|
||||
|
||||
<hr style="width: 36ch;"/>
|
||||
<div class="menu">
|
||||
<a href="{{ url_for('about') }}" style="text-decoration:none">about </a>
|
||||
|
|
Loading…
Reference in New Issue