Compare commits

...

No commits in common. "2f3480a63e66e77d995a46578dea2cddd83f72fe" and "1a01f328fd89297df9872018c41c55873f711c38" have entirely different histories.

31 changed files with 236 additions and 429 deletions

290
build.py
View File

@ -1,290 +0,0 @@
import markdown
import os
import time
import shutil
import subprocess
from html import escape
from const import *
def getTemplateHTML(name):
html = ""
with open(os.path.join(templates, name), "r") as file:
html = file.read();
return html
def lowerHeadings(html):
# This is a dumb lol
return html.replace("<h6>", "<p>")\
.replace("</h6>", "</p>")\
.replace("<h5>", "<h6>")\
.replace("</h5>", "</h6>")\
.replace("<h4>", "<h5>")\
.replace("</h4>", "</h5>")\
.replace("<h3>", "<h4>")\
.replace("</h3>", "</h4>")\
.replace("<h2>", "<h3>")\
.replace("</h2>", "</h3>")\
.replace("<h1>", "<h2>")\
.replace("</h1>", "</h2>")\
def listPages():
return [
(lambda path:
(lambda content:
(lambda timestamp:
(lambda name: {
"source_file" : path,
"source_content" : content,
"html" : markdown.markdown("\n".join(content.split("\n...\n"))),
"title" : content.split("\n")[0].replace("# ", ""),
"summary" : lowerHeadings(markdown.markdown(content.split("\n...\n")[0])),
"timestamp" : timestamp,
"date": time.strftime(date_format, time.localtime(timestamp)),
"name" : name,
"url" : f"entries/{name}.html"
})(".".join(p.split(".")[:-1]))
)(os.stat(path).st_mtime)
)(open(path, "r").read())
)(os.path.join(source, p)) for p in os.listdir(source)
]
def formatEntry(content, page):
return content.replace("%date%", page["date"])\
.replace("%name%", page["name"])\
.replace("%time%", str(page["timestamp"]))\
.replace("%source%", site_index + page["source_file"])\
.replace("%url%", site_index + page["url"])
def make():
try:
os.makedirs(os.path.join(dist, "entries"))
except:
print("Already have content")
try:
shutil.rmtree(os.path.join(dist, "src"))
except:
pass
try:
shutil.rmtree(os.path.join(dist, "images"))
except:
pass
try:
shutil.copytree(source, os.path.join(dist, "src"))
except:
pass
try:
shutil.copytree(images, os.path.join(dist, "images"))
except:
pass
pages = listPages()
pages = sorted(pages, key=lambda p: p["timestamp"])
summary_templ = getTemplateHTML("summary.html")
summariesHTML = getTemplateHTML("about.html").replace("%posts%", "\n<ul>\n"+ "\n".join(
[
formatEntry(summary_templ, page)
.replace(
"%content%",
page["summary"] + (f"<a href={page['url']}>read more...</a>" if len(page["source_content"].split("\n...\n")) > 1 else "")
).replace("%title%", page["title"])
for page in pages
][: : -1]
) + "</ul>")
entry_templ = getTemplateHTML("page.html")
for page in pages:
with open(os.path.join(dist, page["url"]), "w") as entry:
entry.write(
formatEntry(
entry_templ,
page
)
.replace("%content%", page["html"])
)
index_templ = getTemplateHTML("page.html")
with open(os.path.join(dist, "index.html"), "w") as index:
index.write(
index_templ.replace("%content%", summariesHTML)
)
item_templ = getTemplateHTML("item.xml")
rss_templ = getTemplateHTML("rss.xml")
itemsXML = "\n".join(
[
formatEntry(item_templ, page).replace("%content%", page["html"])
for page in pages
][: : -1]
)
with open(os.path.join(dist, "rss.xml"), "w") as index:
index.write(
rss_templ.replace("%items%", itemsXML)
)
for f in os.listdir(resources):
shutil.copy(os.path.join(resources, f), dist)
print(f"built in {len(pages)} pages")
def get_repos():
repos = []
if os.path.exists("git_repos.txt"):
with open("git_repos.txt", "r") as file:
repos = [l for l in file.readlines() if l.startswith("http")]
return repos
def list_files(path):
files = []
dirlist = [path]
while len(dirlist) > 0:
for (dirpath, dirnames, filenames) in os.walk(dirlist.pop()):
dirlist.extend(dirnames)
files.extend(map(lambda n: os.path.join(*n), zip([dirpath] * len(filenames), filenames)))
print(len(files))
return files
def linkify_path(path):
output = []
full = "/"
for s in path.split("/"):
full += s + "/"
output.append(f"<a href='{full}'>{s}</a>")
return "/" + "/".join(output)
def format_file(page_templ, content, v):
return page_templ.replace("%title%", v["name"])\
.replace("%up%", v["above"])\
.replace("%filename%", linkify_path(v["filename"]))\
.replace("%commit%", str(v["commit"]))\
.replace("%url%", str(v["url"]))\
.replace("%content%", content)
def traverse_repo(path, name, commit, url):
page_templ = getTemplateHTML("page.html")
page_templ = page_templ.replace("%content%", getTemplateHTML("file.html"))
date = time.strftime(date_format, time.localtime())
footer = f"<p class='small'>This repo has been compiled for web view on <b>{date}</b> and may not be the latest version</p>"
for root, dirs, files in os.walk(path):
filename = "/".join(root.split("/")[1:])
index_content = "<ul>"
index_content += f"<a href='../'><li>../</li></a>"
for d in dirs:
if d.startswith("."):
shutil.rmtree(os.path.join(root, d))
else:
index_content += f"<a href='{d}'><li>{d}/</li></a>"
for file_name in files:
if file_name.startswith("."):
os.remove(f)
else:
f = os.path.join(root, file_name)
try:
with open(f, "r") as file:
content = file.read()
if f.endswith(".md"):
content = markdown.markdown(content)
content = content.replace("\"/", "\"/" + filename + "/")
else:
content = "<p><pre><code>" + escape(content) + "</code></p></pre>"
content += footer
content = format_file(page_templ, content, {
"name": name,
"commit": commit,
"url": url,
"filename": "/".join(f.split("/")[1:]),
"above": "/".join(f.split("/")[1:-1]),
})
with open(f + ".html", "w") as file:
file.write(content)
if file_name != "README.md":
os.remove(f)
index_content += f"<a href='{file_name}.html'><li>{file_name}</li></a>"
except UnicodeDecodeError:
index_content += f"<a href='{file_name}'><li>{file_name}</li></a>"
index_content += "</ul><hr>"
readme = os.path.join(root, "README.md")
if os.path.exists(readme):
with open(readme) as file:
readme_content = markdown.markdown(file.read())
#massive hack
readme_content = readme_content.replace("\"/", "\"/" + filename + "/")
index_content += readme_content
index_content += "<hr>"
index_content += footer
index_content = format_file(page_templ, index_content, {
"name": name,
"commit": commit,
"url": url,
"filename": filename,
"above": "/".join(root.split("/")[1:-1]),
})
with open(os.path.join(root,"index.html"), "w") as file:
file.write(index_content)
def create_repos():
try:
shutil.rmtree(os.path.join(dist, "git"))
except:
pass
git_path = os.path.join(dist, "git")
try:
os.makedirs(git_path)
except:
print("Already have git path")
for repo in get_repos():
repo = repo.strip()
print(repo)
name = ".".join(repo.split("/")[-1].split(".")[:-1])
os.system(f"mkdir -p /tmp/repos/{name} ;\
cd /tmp/repos/{name} ;\
git pull || git clone {repo} /tmp/repos/{name}")
os.system(f"cp -r /tmp/repos/{name} {dist}/git")
command = subprocess.run(f"cd /tmp/repos/{name} && git log --pretty=format:'%h%x09%an%x09%ad%x09%s' --no-decorate -1", stdout=subprocess.PIPE, shell=True)
commit = command.stdout.decode()
traverse_repo(os.path.join(git_path, name), name, commit, repo)
make()
create_repos()

View File

@ -1,4 +1,6 @@
#!/bin/sh
python build.py
python gif.py
[ -d dist ] && rm -r dist
mkdir dist
shblg -i site -o dist

View File

@ -1,8 +0,0 @@
site_index = "https://davidovski.xyz/"
images = "images"
date_format = "%a, %d %b %Y %H:%M:%S"
source = "src"
templates = "templates"
resources = "resources"
dist = "dist"
summary_max = 10

View File

@ -1,10 +0,0 @@
#https://git.davidovski.xyz/davidovski.git
#https://git.davidovski.xyz/xilinux/xibuild.git
#https://git.davidovski.xyz/xilinux/xipkg.git
#https://git.davidovski.xyz/dot.git
#https://github.com/davidovski/glsl-mandelbrot.git
#https://github.com/davidovski/dungeon-generator.git
#https://github.com/davidovski/chatroom.git
#https://github.com/davidovski/kblg.git
#https://github.com/davidovski/asteriods.git
#https://github.com/davidovski/anyscroll.git

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

4
new.sh
View File

@ -5,9 +5,9 @@ TEMPFILE=/tmp/blog_entry.md
$EDITOR $TEMPFILE
NAME=src/$(head -1 $TEMPFILE | cut -d" " -f2-).md
NAME=site/entries/$(head -1 $TEMPFILE | cut -d" " -f2- | tr " " "-" | tr "[:upper:]" "[:lower:]").html
cp $TEMPFILE "$NAME"
rm $TEMPFILE
./sync.sh
chmod +x $NAME

5
site/entries/entries.sh Executable file
View File

@ -0,0 +1,5 @@
#!../page.sh
[ -z "$1" ] || {
md2html $1
}

15
site/entries/git_compile.html Executable file
View File

@ -0,0 +1,15 @@
#!./entries.sh
# Compiling files in a git repo
So I decided to improve the way that that you can access some of the repos that I am hosting on this server, including the code that I use to compile the site itself. I quickly hacked together a bit of code in my existing [build.py](https://davidovski.xyz/git/davidovski/build.py.html) to clone a list of repos and go through and generate a html pages for each of the files in the repo.
Although this means that this is only a static view of the repo at any time (needing me to rebuild the site for it to update) I can easily add any git repo to be built into my site, so as you may see, I have added a few repos from my github as well.
I tried using cgit, but it just didn't provide exactly what I wanted and I wasn't in the mood to try configuring it to my liking, so I opted for this approach instead.
A way that I can improve it is to serve a http server that dynamically updates the repositories when new commits are added, which would probably be a better solution; but this works.. for now.
If you want to view all of the repos that I've listed so far, click the link at the top of the page. (sorry that the index is still the default nginx autoindex, I will change that at some point), and feel free to check out how I did it in [build.py](https://davidovski.xyz/git/davidovski/build.py.html), though Im warning you, its probably some of the hackiest code i've put together.
Tutorial on how to host your own git repos on your server and allow people to clone them with https may be coming soon

4
src/librex.md → site/entries/librex.html Normal file → Executable file
View File

@ -1,7 +1,9 @@
#!./entries.sh
# LibreX - a metasearch engine
My instance: [search.davidovski.xyz](https://search.davidovski.xyz/)
For a while now I have been using [SearX](https://github.com/searx/searx) as my search engine, a meta search engine that cumulates search results from multiple different sites. While this is a great idea in theory, making the best of all search engines through one *privacy respecting* interface, in reality it ends up meaning that search results are quite slow. Couple this with the fact that most SearX instances are hosted by volunteers, and often have downtime, I was in the situation where I was hopping between various instances to try and find ones that worked. I always wanted to self host one myself, but the whole system seemed very bloated and complicated, and honestly I just couldn't be bothered to mess around with it.
For a while now I have been using [SearX](https://github.com/searx/searx) as my search engine, a meta search engine that cumulates search results from multiple different sites. While this is a great idea in theory, making the best of all search engines through one *privacy respecting* interface, in reality it ends up meaning that search results are quite slow. Couple this with the fact that most SearX instances are hosted by volunteers, and often have downtime, I was in the situation where I was hopping between various instances to try and find ones that worked. I always wanted to self host one myself, but the whole system seemed very bloated and complicated, and honestly I just couldn't be bothered to mess around with it.
That's where [LibreX](https://github.com/hnhx/librex) comes in, a very small and simple meta search engine. Its still in development, but currently it has just enough functionality to actually be somewhat useful. Currently it only really supports google searches, but it still is a good layer for privacy, since all of your queries are anonymised, with google only seeing that they came from LibreX. I am curious to see how well it will handle larger amounts of search queries and if Google will limit them or something. If you want to support development, feel free to use it, find bugs and request features: [View the github repo](https://github.com/hnhx/librex)

View File

@ -1,9 +1,9 @@
#!./entries.sh
# PCI passthrough with qemu
QEMU is a powerful free and open source emulator which when paired with kvm can be used to create almost bare-metal performance virtual machines. In this guide I will be detailing some tips and tricks to configuring a setup on your linux system to allow a PCI device (typically a graphics card) to be passed through to a virtual machine.
...
Countless guides already exist on this topic but they all rely on using virt-manager and other Redhat software, which, depending on your use case, may be completely overkill. This guide assumes that you will not be using the target GPU as a video output on your host machine from boot, so will only work in configurations where you are able to remote connect or where you have **multiple graphics cards**. However the process is mostly similar for single GPU passthrough, with extra steps if you want to bind and unbind display drivers from the host.
This is a generic guide written to support any semi-standard Linux distributions, so adapt any instructions as you see fit to your current system.

24
site/entries/shebangs.html Executable file
View File

@ -0,0 +1,24 @@
#!./entries.sh
# shebangs
When working with a unix-like system, you've no doubt come across shebangs, like the little `#!/bin/sh` at the top of your shell scripts. The way these work is actually really simple: if you have a text file with a shebang and you set the execute bit on it, you can execute it as if you've invoked the interpreter in the shebang with that file.
For example, if you have a shell script, `script.sh`, and you place a `#!/bin/sh` at the top, executing this file will essentially run the `/bin/sh` program with the arguments `script.sh`. This probably seems quite straightforward, but it does mean you can do some pretty cool stuff.
## shblg
Using this simple feature, I decided to re-write the static-generator for my site. Instead of running a single python script that will convert markdown files into html, shblg takes source files and "executes" them. I wrote a small program that takes a markdown file as an argument and converts it to html and writes it to stdout, naming it `md2html`. With this, I can place a shebang at the top of each markdown file, `#!/usr/bin/md2html` and then execute the markdown file to output an html file.
All shblg does is it recursively executes each file in a given site directory, writing their output to files in the output directory. While this does have some limitations, it can be very easily extended to any sorts of file, and since files are executed with any generic interpreter, they can contain any sort of logic like listing files, or calculating dates.
## source
if you want to check out the code of shblg, you can clone it with:
`git clone https://git.davidovski.xyz/shblg.git`
and if you want to check out how i used it for the code of this site, you can clone it with:
`git clone https://git.davidovski.xyz/davidovski.git`

View File

@ -1,33 +1,31 @@
#!./entries.sh
# Permanent SSH Forwarding (Tutorial)
Take this situation: you have a cheap (or even free), low-powered remote server and a considerably better homeserver with more storage and power. For certain services that require more power, you'd obviously want to run them on that homeserver.
Take this situation: you have a cheap (or even free), low-powered remote server and a considerably better homeserver with more storage and power. For certain services that require more power, you'd obviously want to run them on that homeserver.
However, what if you don't want to, *or can't*, directly open ports onto your home network, or you if you simply want to keep all of your site to one IP? This is where SSH port forwarding comes in handy: using ssh to forward the open port from a service from your local server to the remote one, where it can be exposed to the rest of the internet.
...
However, what if you don't want to, *or can't*, directly open ports onto your home network, or you if you simply want to keep all of your site to one IP? This is where SSH port forwarding comes in handy: using ssh to forward the open port from a service from your local server to the remote one, where it can be exposed to the rest of the internet.
## SSH Remote Port Forwarding
SSH remote port forwarding is built right into ssh itself, and is quite simple:
```
ssh -R 5505:localhost:4404 user@remote.host
```
ssh -R 5505:localhost:4404 user@remote.host
When this command is run on the local server, it will:
+ create an ssh connection to the remote server, as per usual
+ open the port 5505 on the remote server,
+ all traffic on this port will be forwarded to port 4404 on the local server.
+ open the port 5505 on the remote server,
+ all traffic on this port will be forwarded to port 4404 on the local server.
This command by itself is already everything you'd need to forward most ports easily to your remote server, of course, remember to open the port on your remote server's firewall, if applicable.
However to ensure that that port is exposed properly on the remote server, you'd want to make sure that it is listening to all external traffic.
However to ensure that that port is exposed properly on the remote server, you'd want to make sure that it is listening to all external traffic.
You can fix this by setting `GatewayPorts yes` in `/etc/ssh/sshd_config` on the remote server. (don't forget to restart sshd after editing the config)
## Persistent ssh forwarding
The above is all well and good, but you'd need to keep an interactive ssh connection up at all times, so the above isn't the most ideal solution.
The above is all well and good, but you'd need to keep an interactive ssh connection up at all times, so the above isn't the most ideal solution.
To get around this, you can create a service to run on the local server to forward requested ports from the remote server.
@ -39,14 +37,14 @@ Then, create a script for your ssh port forwarding. I placed mine directly in th
Here is my example of a script that you could use:
#!/bin/sh
#!/bin/sh
PORTS="8080 25565"
DEST="bridge@remote.host"
SSH_PORT="22"
IDENTITY_FILE="~/.ssh"
PORTS="8080 25565"
DEST="bridge@remote.host"
SSH_PORT="22"
IDENTITY_FILE="~/.ssh"
/usr/bin/ssh -nNT $(echo $PORTS | awk -v host=$LOCALHOST '{for (i = 1; i <= NF; i++){ printf "-R %d:%s:%d ",$i,host,$i}}') -p $SSH_PORT -i $IDENTITY_FILE $DEST
/usr/bin/ssh -nNT $(echo $PORTS | awk -v host=$LOCALHOST '{for (i = 1; i <= NF; i++){ printf "-R %d:%s:%d ",$i,host,$i}}') -p $SSH_PORT -i $IDENTITY_FILE $DEST
Next you'd want to run this script as a service. Check your distro's service system how to do this if you have any trouble.
@ -56,17 +54,17 @@ Say that the script you made was `/home/bridge/tunnel.sh`, you should create a u
To do this create the following file in `/home/bridge/.config/systemd/user/tunnel.service`:
[Unit]
Description=SSH tunnel
[Unit]
Description=SSH tunnel
[Service]
ExecStart=/home/bridge/tunnel.sh
RestartSec=5
Restart=always
KillMode=mixed
[Service]
ExecStart=/home/bridge/tunnel.sh
RestartSec=5
Restart=always
KillMode=mixed
[Install]
WantedBy=default.target
[Install]
WantedBy=default.target
Then enable and start the service with: `systemd --user enable tunnel.service` and `system --user start tunnel.service`. Ensure that it is running with `systemd --user status tunnel`
@ -82,7 +80,7 @@ Say you forwarded traffic from port 8080 on remote to port 80 on local, you coul
Here is an example of this in practice, forwarding port 80 and 443, by forwarding ports 8080 and 8443:
/usr/bin/ssh -nT -R 8443:localhost:443 -R 8080:localhost:80 -i $IDENTITY_FILE -p $SSH_PORT $DEST "(sudo socat TCP-LISTEN:80,fork TCP:localhost:8080) & sudo socat TCP-LISTEN:443,fork TCP:localhost:8443"
/usr/bin/ssh -nT -R 8443:localhost:443 -R 8080:localhost:80 -i $IDENTITY_FILE -p $SSH_PORT $DEST "(sudo socat TCP-LISTEN:80,fork TCP:localhost:8080) & sudo socat TCP-LISTEN:443,fork TCP:localhost:8443"
However this command assumes that the remote user has access to sudo with **NO PASSWORD**. Alternatively you could create a similar service (this time as a system service) on the remote server running the socat commands.

4
src/welcome.md → site/entries/welcome.html Normal file → Executable file
View File

@ -1,6 +1,8 @@
#!./entries.sh
# welcome
welcome. i decided to turn this webpage into blog-style site... i havent got a topic or anything, so expect either: quality tutorials and very interesting techy things; or just random shitposts or rambles about things.
welcome! i decided to turn this webpage into blog-style site... i havent got a topic or anything, so expect either: quality tutorials and very interesting techy things; or just random shitposts or rambles about things.
originally i was going to make this blog on [b.davidovski.xyz](https://b.davidovski.xyz) using [nanoblogger](http://nanoblogger.sourceforge.net/) (you might be able to still see the start of that) but nb itself seemed quite dead, and i couldn't really be asked to customise it all myself. So i made my own script to generate this static site: [kblg](https://github.com/davidovski/kblg/). Right now its probably just the bare minimum needed for this, but I am planning to add more things to it as I go along (including rss, if anyone would be interested?)

BIN
site/images/bg.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
site/images/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
site/images/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

28
gif.py → site/images/gif.py Normal file → Executable file
View File

@ -1,4 +1,7 @@
#!/usr/bin/env python
import glob
import sys
import os
import math
import random
from PIL import Image
@ -19,16 +22,10 @@ def rgb_to_v(c):
replace = color("#f58f44")
colors = [
color("#191919"),
color("#373b41"),
color("#282a2e"),
]
colors2 = colors + [
color("#f58f44")
]
sorted(colors, key=rgb_to_v)
sorted(colors2, key=rgb_to_v)
def make(filename, colors, inp=None):
def make(colors, inp=None):
p = len(colors)
w = int(128 / p) * p
h = int(128 / p) * p
@ -58,9 +55,16 @@ def make(filename, colors, inp=None):
frames.append(image.convert("P"))
frames[0].save(filename, mode="P", format="GIF", append_images=frames[1:], save_all=True, duration=100, loop=0)
make("dist/images/bg.gif", colors)
make("dist/images/remotecontrol.gif", colors2, inp="images/remotecontrol-small.png")
frames[0].save(sys.stdout, mode="P", format="GIF", append_images=frames[1:], save_all=True, duration=50, loop=0)
template = None
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
template = sys.argv[1]
colors = colors + [ color("#fefefe") ]
sorted(colors, key=rgb_to_v)
make(colors, inp=template)
#make("dist/images/remotecontrol.gif", colors2, inp="images/remotecontrol-small.png")

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

2
site/images/remotecontrol.gif Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
./gif.py remotecontrol-small.png

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

45
site/index.html Executable file
View File

@ -0,0 +1,45 @@
#!./page.sh -s
entries="$(for f in entries/*.html; do echo $(git log --pretty=format:'%ct' --follow $f | tail -n 1) $f; done | sort -nr | cut -f2- -d' ')"
cat << EOF
<div class="grid">
<div class="about">
<p>Hi, I'm david and this is my website.</p>
<p>if you want to contact me, you can message me on matrix <code>@ix:davidovski.xyz</code>.</p>
</div>
<div class="image">
<img src="/images/remotecontrol.gif">
</div>
</div>
EOF
cat << EOF
<div>
<h2>blog posts</h2>
<ul>
EOF
# list all the files in the directory
for file in $entries; do
title="$(grep '^# ' $file)"
title=${title#\# }
printf "
<li class=\"entry\">
<a href=\"%s\">
<span>%s</span>
<div class=\"small\">%s</div>
</a>
</li>
" "${file%.*}.html" "$title" "$(git log --pretty=format:'%cD' --follow -- "$file" | tail -n 1)"
done
cat << EOF
</ul>
</div>
EOF

23
templates/page.html → site/page.sh Normal file → Executable file
View File

@ -1,3 +1,14 @@
#!/bin/sh
# if this is called with -s then make it the small version of the page
type="regular-window"
[ "$1" = "-s" ] &&{
type="small-window"
shift
}
cat << EOF
<!DOCTYPE html>
<html lang="en">
<head>
@ -7,7 +18,7 @@
<title>davidovski.xyz</title>
</head>
<body bgcolor="#191919" text="#f58f44" link="#b4d6d1">
<div valign="middle" class="main" bgcolor="#191919" text="#f58f44">
<div valign="middle" class="main $type" bgcolor="#191919" text="#f58f44">
<div class="header">
<a href="https://davidovski.xyz/"<h1 class="title">davidovski.xyz</h1></a>
<hr>
@ -28,9 +39,15 @@
</div>
</div>
<hr>
%content%
<div class="content">
EOF
[ -z "$1" ] || /bin/sh $*
cat << EOF
</div>
</div>
</body>
</html>
EOF

33
site/rss.xml Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
cat << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>davidovski</title>
<link>https://davidovski.xyz</link>
<description>davidovski's site</description>
EOF
for entry in entries/*.html; do
title="$(grep '^# ' $entry)"
title=${title#\# }
printf "<item>\n"
printf "<title>%s</title>\n" "${title}"
printf "<link>%s</link>\n" "http://davidovski.xyz/$entry"
printf "<pubDate>%s</pubDate>\n" "$(git log --pretty=format:'%cD' --follow -- "$entry" | tail -n 1)"
printf "<description><![CDATA["
md2html $entry
printf "]]></description>\n</item>"
done
cat << EOF
</channel>
</rss>
EOF

View File

@ -20,16 +20,18 @@
}
body {
background-color: #303030;
background-color: #373b41;
background-image: url("/images/bg.gif");
background-repeat: repeat;
background-repeat: repeat-x;
background-attachment: fixed;
background-position: center bottom;
background-size: 100%;
image-rendering: pixelated;
image-rendering: optimizeSpeed;
/*background-image: url("https://davidovski.xyz/images/bg.png");*/
color: #f58f44;
color: #fefefe;
font-family: mononoki;
font-size: 16px;
padding: 0;
@ -63,22 +65,41 @@ h3 {
color: #5f819d;
}
.small-window {
width: 100%;
max-width: 1080px;
height: 100%;
max-height: 607px;
}
.regular-window {
width: 70%;
max-width: 70%;
height: 100%;
max-height: 80%;
overflow: hidden;
}
.main {
background-color: #191919;
margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
width: 70%;
margin-left: auto;
margin-right: auto;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: absolute;
padding: 2%;
height: 100%;
border-left: 2px solid #f58f44;
border-right: 2px solid #f58f44;
border-bottom: 2px solid #f58f44;
border-radius: 6px;
box-shadow: 0px 0px 50px black;
}
.content {
overflow: auto;
height: 80%;
padding: 2%;
}
.header {
@ -94,12 +115,12 @@ h3 {
hr {
width: 100%;
border: 0;
border-bottom: 2px solid #f58f44;
border-bottom: 2px solid #fefefe;
}
.title {
font-size: 45px;
color: #f58f44;
color: #fefefe;
}
.small {
@ -132,7 +153,6 @@ pre {
background-color: #303030;
white-space: pre-wrap;
padding: 5px;
border: 2px solid #f58f44;
}

View File

@ -1,5 +0,0 @@
#!/bin/bash
rsync -Lta --no-perms --no-owner --no-group --delete --exclude=sync.sh -z -e ssh ./dist/ cheetah.remote:/srv/www/davidovski/html
ssh -t cheetah.remote "ln -s /srv/shared/site/* /srv/www/davidovski/html/"
# git push # push after everything to keep it all backed up

View File

@ -1,20 +0,0 @@
<div class="grid">
<div class="about">
<p>Hi, I'm david and this is my website.</p>
<p>This site is still under construction... permanently. So expect it to look better (or worse) in the future.</p>
<p>if you want to contact me, you can message me on matrix <code>@ix:davidovski.xyz</code>.</p>
</div>
<div class="image">
<img src="/images/remotecontrol.gif">
</div>
</div>
<div>
<h2>blog posts</h2>
%posts%
</div>

View File

@ -1,7 +0,0 @@
<h1>%filename%</h1>
<p><code>%commit%</code></p>
%content%
<p>Clone this repo: <code>git clone %url%</code><p>

View File

@ -1,6 +0,0 @@
<item>
<title>%name%</title>
<link>%url%</link>
<pubDate>%date%</pubDate>
<description><![CDATA[%content%]]></description>
</item>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>davidovski</title>
<link>https://davidovski.xyz</link>
<description>davidovski's site</description>
%items%
</channel>
</rss>

View File

@ -1,6 +0,0 @@
<li class="entry">
<a href="%url%">
<div class="small">%date%</div>
<span>%title%</span>
</a>
</li>