From f666ac3dc9848ac0ad58df0722bf1b57b4296d9c Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sat, 6 Apr 2024 01:04:43 +0200 Subject: [PATCH] tree to markdown command --- basics/tree.md | 13 ++++++++++++- data/sqlite.md | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 data/sqlite.md diff --git a/basics/tree.md b/basics/tree.md index 1aa08d3..910d67f 100644 --- a/basics/tree.md +++ b/basics/tree.md @@ -1,6 +1,6 @@ --- title: "tree" -tags: [ "basics" ] +tags: [ "basics", "tree", "markdown" ] --- The `tree` utility outputs a full listing of everything in your current directory, and those below. @@ -23,3 +23,14 @@ README.md ``` Each description-line starts with a tab. + +## Markdown Conversion + +To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner: + +```bash +tree -tf --dirsfirst --gitignore --noreport --charset ascii | \ + sed -e 's/| \+/ /g' \ + -e 's/[|`]-\+/ */g' \ + -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g' +``` diff --git a/data/sqlite.md b/data/sqlite.md new file mode 100644 index 0000000..77d3eb7 --- /dev/null +++ b/data/sqlite.md @@ -0,0 +1,21 @@ +--- +title: "sqlite" +tags: [ "Documentation", "data" ] +--- + +Work with a database: + +```bash +sqlite3 "$FILE".sqlite3 +``` +Compress the database: + +```sqlite +pragma vacuum; +``` +Optimize the database: + +```sqlite +pragma optimize; +``` +