diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcaf716 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +index.html diff --git a/index.html b/index.html deleted file mode 100644 index 72fba0b..0000000 --- a/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Dakota's tilde.club - - - - -
-

David Dakota Blair

-
    -

    Table of Contents

    -
  1. About
  2. -
  3. Fun bash one liners
  4. -
-
-
-

About

- This is Dakota's tilde.club page. -
-
-

Fun bash one liners

-
-
Print a few random numbers
-
od -d < /dev/random | awk '{ print $2 }' | head
-
-
- - - diff --git a/index.tmpl.html b/index.tmpl.html new file mode 100644 index 0000000..81d6ae9 --- /dev/null +++ b/index.tmpl.html @@ -0,0 +1,84 @@ + + + + + Dakota's tilde.club + + + + +
+

David Dakota Blair

+

Table of Contents

+
    +
  1. About
  2. +
  3. Fun bash one liners
  4. +
  5. + Readings: + 2020 + 2019 + 2018 + 2017 + 2016 + 2015 +
  6. +
+
+
+
+

About

+ This is Dakota's tilde.club page. +
+
+
+

Fun bash one liners

+
+
Print a few random numbers
+
od -d < /dev/random | awk '{ print $2 }' | head
+
+
+
A simple awk for isolating columns
+
awk '{print $2}'
+
+
+
Find lines containing literal tabs
+
awk '/\t/'
+
grep -P
+
+
+
Remove all tab characters
+
tr -d '\t'
+
+
+
Join files using a tab separator
+
join -t $'\t' file1 file2
+
+
+
Simple system benchmarks
+
yes | sed '=' | sed '/y/d'
+
time seq -n 1e6
+
+
+
What shell am I using?
+
lsof -p $$
+
+
+
See which processes are listening to a $PORT
+
netstat -pntl | grep $PORT # linux
+
lsof -nP -iTCP:$PORT | grep LISTEN # os x
+
+
+
Useful flags for rsync
+
rsync -h --progress --stats --verbose
+
+
+
Recover files from a slightly corrupted tar archive
+
cpio -ivd -H tar < file.tar
+
+
+
+
+ {{readings}} +
+ + diff --git a/publish.py b/publish.py new file mode 100755 index 0000000..f96b14d --- /dev/null +++ b/publish.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import io +from subprocess import run + +import markdown +from jinja2 import Template + +def main(): + tidy_exists = run(["which", "-s", "tidy"]).returncode == 0 + with open("readings.md") as readings, open("index.tmpl.html") as tmpl: + readings_html = markdown.markdown(readings.read()) + template = Template(tmpl.read()) + out = template.render( + readings=readings_html + ) + with open("index.html", "w") as outfile: + outfile.write(out) + if tidy_exists: + run(( + """tidy --quiet yes -modify -config tidy.conf index.html""" + ).split(" ")) + +if(__name__ == "__main__"): + main() diff --git a/readings.md b/readings.md new file mode 100644 index 0000000..a1a8948 --- /dev/null +++ b/readings.md @@ -0,0 +1 @@ +# Readings diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c129e02 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +Jinja2==2.11.2 +Markdown==3.2.2 +MarkupSafe==1.1.1 diff --git a/tidy.conf b/tidy.conf new file mode 100644 index 0000000..2713905 --- /dev/null +++ b/tidy.conf @@ -0,0 +1,6 @@ +doctype: html5 +indent: yes +indent-spaces: 1 +quiet: yes +repeated-attributes: keep-last +wrap: 76