use shblg to generate a static site from this repo
This commit is contained in:
parent
7acbb08438
commit
045ab662bb
290
build.py
290
build.py
|
@ -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()
|
|
8
const.py
8
const.py
|
@ -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
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!../page.sh
|
||||||
|
|
||||||
|
[ -z "$1" ] || {
|
||||||
|
md2html $1
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
|
#!./entries.sh
|
||||||
|
|
||||||
# Compiling files in a git repo
|
# 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.
|
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.
|
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.
|
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.
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!./entries.sh
|
||||||
|
|
||||||
# LibreX - a metasearch engine
|
# LibreX - a metasearch engine
|
||||||
|
|
||||||
My instance: [search.davidovski.xyz](https://search.davidovski.xyz/)
|
My instance: [search.davidovski.xyz](https://search.davidovski.xyz/)
|
|
@ -1,9 +1,9 @@
|
||||||
|
#!./entries.sh
|
||||||
|
|
||||||
# PCI passthrough with qemu
|
# 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.
|
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.
|
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.
|
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.
|
|
@ -1,11 +1,11 @@
|
||||||
|
#!./entries.sh
|
||||||
|
|
||||||
# Permanent SSH Forwarding (Tutorial)
|
# 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
|
||||||
|
|
||||||
SSH remote port forwarding is built right into ssh itself, and is quite simple:
|
SSH remote port forwarding is built right into ssh itself, and is quite simple:
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!./entries.sh
|
||||||
|
|
||||||
# welcome
|
# 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.
|
|
@ -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
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
./gif.py
|
|
@ -1,4 +1,7 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
import glob
|
import glob
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -21,14 +24,8 @@ colors = [
|
||||||
color("#191919"),
|
color("#191919"),
|
||||||
color("#373b41"),
|
color("#373b41"),
|
||||||
]
|
]
|
||||||
colors2 = colors + [
|
|
||||||
color("#f58f44")
|
|
||||||
]
|
|
||||||
|
|
||||||
sorted(colors, key=rgb_to_v)
|
def make(colors, inp=None):
|
||||||
sorted(colors2, key=rgb_to_v)
|
|
||||||
|
|
||||||
def make(filename, colors, inp=None):
|
|
||||||
p = len(colors)
|
p = len(colors)
|
||||||
w = int(128 / p) * p
|
w = int(128 / p) * p
|
||||||
h = 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.append(image.convert("P"))
|
||||||
|
|
||||||
|
|
||||||
frames[0].save(filename, mode="P", format="GIF", append_images=frames[1:], save_all=True, duration=100, loop=0)
|
frames[0].save(sys.stdout, 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")
|
template = None
|
||||||
|
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
|
||||||
|
template = sys.argv[1]
|
||||||
|
colors = colors + [ color("#f58f44") ]
|
||||||
|
|
||||||
|
sorted(colors, key=rgb_to_v)
|
||||||
|
make(colors, inp=template)
|
||||||
|
#make("dist/images/remotecontrol.gif", colors2, inp="images/remotecontrol-small.png")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
./gif.py remotecontrol-small.png
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!./page.sh
|
||||||
|
|
||||||
|
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/*.html; do
|
||||||
|
title="$(grep '^# ' $file)"
|
||||||
|
title=${title#\# }
|
||||||
|
|
||||||
|
printf "
|
||||||
|
<li class=\"entry\">
|
||||||
|
<a href=\"%s\">
|
||||||
|
<div class=\"small\">%s</div>
|
||||||
|
<span>%s</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
" "${file%.*}.html" "$(stat -c %z "$file")" "$title"
|
||||||
|
done
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
EOF
|
4
new.sh
4
new.sh
|
@ -5,9 +5,9 @@ TEMPFILE=/tmp/blog_entry.md
|
||||||
|
|
||||||
$EDITOR $TEMPFILE
|
$EDITOR $TEMPFILE
|
||||||
|
|
||||||
NAME=src/$(head -1 $TEMPFILE | cut -d" " -f2-).md
|
NAME=entries/$(head -1 $TEMPFILE | cut -d" " -f2-).html
|
||||||
|
|
||||||
cp $TEMPFILE "$NAME"
|
cp $TEMPFILE "$NAME"
|
||||||
rm $TEMPFILE
|
rm $TEMPFILE
|
||||||
|
|
||||||
./sync.sh
|
chmod +x $NAME
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# set a variable to avoid this template being repeated indefinitely
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -13,8 +17,6 @@
|
||||||
<hr>
|
<hr>
|
||||||
<div class="links">
|
<div class="links">
|
||||||
<a href="https://davidovski.xyz/git">git</a>
|
<a href="https://davidovski.xyz/git">git</a>
|
||||||
|
|
|
||||||
<a href="https://orangepeel.pw/">op</a>
|
|
||||||
||
|
||
|
||||||
<a color="#cc6666" style="color: var(--red);" href="https://davidovski.xyz/m">m</a>
|
<a color="#cc6666" style="color: var(--red);" href="https://davidovski.xyz/m">m</a>
|
||||||
|
|
|
|
||||||
|
@ -31,8 +33,13 @@
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
%content%
|
EOF
|
||||||
|
|
||||||
|
[ -z "$1" ] || /bin/sh $*
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
EOF
|
|
@ -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" "$(stat -c %z "$entry")"
|
||||||
|
|
||||||
|
|
||||||
|
printf "<description><![CDATA["
|
||||||
|
md2html $entry
|
||||||
|
printf "]]></description>\n</item>"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
EOF
|
5
sync.sh
5
sync.sh
|
@ -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
|
|
|
@ -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>@iksv:monero.social</code>.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="image">
|
|
||||||
<img src="/images/remotecontrol.gif">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<h2>blog posts</h2>
|
|
||||||
%posts%
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<h1>%filename%</h1>
|
|
||||||
|
|
||||||
<p><code>%commit%</code></p>
|
|
||||||
|
|
||||||
%content%
|
|
||||||
|
|
||||||
<p>Clone this repo: <code>git clone %url%</code><p>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<item>
|
|
||||||
<title>%name%</title>
|
|
||||||
<link>%url%</link>
|
|
||||||
<pubDate>%date%</pubDate>
|
|
||||||
<description><![CDATA[%content%]]></description>
|
|
||||||
</item>
|
|
|
@ -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>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<li class="entry">
|
|
||||||
<a href="%url%">
|
|
||||||
<div class="small">%date%</div>
|
|
||||||
<span>%title%</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
Loading…
Reference in New Issue