Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
executable file 149 lines (134 sloc) 4.16 KB
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p eva pandoc esh
title_wrapper() {
# remove extension
# snake to title case
echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
read_time() {
minu="$(eva -f 1 $1/150 | xargs)"
echo "$minu"
height() {
cm="$(eva -f 2 $1*18*0.0222 | xargs)"
echo "$cm"
link_wrapper() {
# 1 - id
# 2 - title
# 3 - date
# 4 - read time
echo -ne "
<td class="table-post">
<div class=\"date\">
<a href=\"/posts/$1\" class=\"post-link\">
<span class=\"post-link\">$2</span>
<td class="table-stats">
<span class=\"stats-number\">
<span class="stats-unit">min</span>
intro() {
echo -ne "
<div class="intro">
<div class="hot-links">
<a href="" class="feed-button">Subscribe</a>
<a href="" class="donate-button">Donate</a>
<p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p>
I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer.
I write <a href="">open-source stuff</a> to pass time.
I also design fonts:
<a href="">scientifica</a>,
<a href="">curie</a>.
<p>Send me a mail at or a message at</p>
cat > ./docs/index.html << EOF
<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="./style.css">
<link rel="alternate" type="application/atom+xml" title="nerdypepper's micro musings" href="./index.xml">
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1">
<meta content="#ffffff" name="theme-color">
<meta name="HandheldFriendly" content="true">
<meta property="og:title" content="nerdypepper">
<meta property="og:type" content="website">
<meta property="og:description" content="nerdypepper's micro musings">
<meta property="og:url" content="">
<link rel="icon" type="image/x-icon" href="/favicon.png">
<h1 class="heading">n</h1>
<h4 class="subheading">nerdypepper's μsings</h4>
<div class="posts">
<div class="post">
echo -ne "$(intro)<table>" >> ./docs/index.html
# posts
posts=$(ls -t ./posts)
mkdir -p docs/posts
rm -rf "./docs/posts/"
for f in $posts; do
id="${file##*/}" # ill name my posts just fine
# generate posts
stats=$(wc "$file")
words="$(echo $stats | awk '{print $2}')"
lines="$(echo $stats | awk '{print $1}')"
r_time="$(read_time $words)"
height="$(height $lines)"
post_title=$(title_wrapper "$id")
echo "[~] $post_title"
post_date=$(date -r "$file" "+%d/%m — %Y")
post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height")
echo -ne "$post_link" >> docs/index.html
mkdir -p "docs/posts/$id"
esh \
-o "docs/posts/$id/index.html" \
"./post.esh" \
file="$file" \
date="$post_date" \
title="$post_title" \
read_time="$r_time" \
height="$height" \
# generate rss feeds
echo "generating RSS feeds ..."
esh \
-o "./docs/index.xml" \
cat >> ./docs/index.html << EOF
<div class="separator"></div>
<div class="footer">
<a href="">Github</a> ·
<a rel="me" href="">Mastodon</a> ·
<a href="">Mail</a> ·
<a href="">LinkedIn</a> ·
<a href="">
<img class="footimgs" src="">