organized scripts
This commit is contained in:
parent
abdd7e6ef2
commit
0232b09c81
7 changed files with 146 additions and 102 deletions
18
build_exocortex.sh
Executable file
18
build_exocortex.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#This script creates the exocortex
|
||||
|
||||
# start clean
|
||||
rm -rf ./public/exocortex-hugo-md/public/*
|
||||
rm -rf ./public/exocortex-hugo-md/content/
|
||||
|
||||
# create hugo md files using ox-hugo
|
||||
emacs -Q --batch -l ox-hugo-exocortex.el
|
||||
|
||||
# build create html files from hugo markdown files using quartz
|
||||
cd ./public/exocortex-hugo-md/
|
||||
npx quartz build
|
||||
cd ../../
|
||||
|
||||
# copy the generated folder to the main public site
|
||||
rsync -avi --delete ./public/exocortex-hugo-md/public/ ./public/cosmicflow-html/exocortex/
|
||||
|
||||
echo "exocortex created"
|
|
@ -168,7 +168,7 @@ Then
|
|||
|
||||
Since $S: \mathbb{N} \times \mathbb{N} \rightarrow \mathbb{N}$ is both injective and surjective, it is a bijection, we are done.
|
||||
|
||||
* An Interesting Applications
|
||||
* An Interesting Application
|
||||
*The set of finite subsets of $\mathbb{N}$ is countable.*
|
||||
Let $A_i$ be set of all subsets of $\mathbb{N}$ containing $i$ elements, that is with cardinality $i$.
|
||||
|
||||
|
|
19
copy-pics.sh
Executable file
19
copy-pics.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
# Set the source and destination directories
|
||||
src_dir="./public/cosmicflow-html"
|
||||
src_pics_dir="./assets/pics/"
|
||||
|
||||
# Loop through each subdirectory
|
||||
for dir in "$src_dir"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
dir_name=$(basename "$dir")
|
||||
dst_pics_dir="${src_dir}/${dir_name}/pics"
|
||||
|
||||
# Create the destination subdirectory if it doesn't exist
|
||||
if [ ! -d "$dst_pics_dir" ]; then
|
||||
mkdir -p "$dst_pics_dir"
|
||||
fi
|
||||
|
||||
# Use rsync to copy files starting with the subdirectory name as prefix
|
||||
rsync -av --include="$dir_name*" --exclude="*" "${src_pics_dir}/" "${dst_pics_dir}/"
|
||||
fi
|
||||
done
|
28
copy_latex_images.sh
Executable file
28
copy_latex_images.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
## The purpose of this script is to copy all latex images to the appropriate subdirectories
|
||||
|
||||
|
||||
rsync -avi ./content/ltximg ./public/cosmicflow-html/
|
||||
|
||||
# Set the source and destination directories
|
||||
src_dir="./public/cosmicflow-html"
|
||||
src_ltximg_dir="./public/cosmicflow-html/ltximg"
|
||||
|
||||
# Loop through each subdirectory
|
||||
for dir in "$src_dir"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
dir_name=$(basename "$dir")
|
||||
dst_ltximg_dir="${src_dir}/${dir_name}/ltximg"
|
||||
echo "$dir_name"
|
||||
# Create the destination subdirectory if it doesn't exist
|
||||
if [ ! -d "$dst_ltximg_dir" ]; then
|
||||
mkdir -p "$dst_ltximg_dir"
|
||||
fi
|
||||
|
||||
# Use rsync to copy files starting with the subdirectory name as prefix
|
||||
rsync -av --include="$dir_name*" --exclude="*" "${src_ltximg_dir}/" "${dst_ltximg_dir}/"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf ./public/cosmicflow-html/ltximg/ltximg
|
||||
|
||||
echo "Successfully copied latex images."
|
|
@ -28,58 +28,6 @@
|
|||
(package-install 'htmlize)
|
||||
(package-install 'ox-gemini)
|
||||
|
||||
;; ox-hugo for exocortex notes
|
||||
(use-package ox-hugo
|
||||
:ensure t ;Auto-install the package from Melpa
|
||||
:pin melpa ;`package-archives' should already have ("melpa" . "https://melpa.org/packages/")
|
||||
:after ox
|
||||
:config
|
||||
(setq org-hugo-base-dir "~/projects/cosmicflow.space/public/exocortex-hugo-md" )
|
||||
(setq org-hugo-default-section-directory "./")
|
||||
)
|
||||
(setq org-roam-directory "~/projects/thought_garden/")
|
||||
|
||||
;; modified this function from https://github.com/kaushalmodi/ox-hugo/discussions/585#discussioncomment-2335203
|
||||
(defun ox-hugo/export-all (&optional org-files-root-dir dont-recurse)
|
||||
"Export all Org files (including nested) under ORG-FILES-ROOT-DIR.
|
||||
|
||||
All valid post subtrees in all Org files are exported using
|
||||
`org-hugo-export-wim-to-md'.
|
||||
|
||||
If optional arg ORG-FILES-ROOT-DIR is nil, all Org files in
|
||||
current buffer's directory are exported.
|
||||
|
||||
If optional arg DONT-RECURSE is nil, all Org files in
|
||||
ORG-FILES-ROOT-DIR in all subdirectories are exported. Else, only
|
||||
the Org files directly present in the current directory are
|
||||
exported. If this function is called interactively with
|
||||
\\[universal-argument] prefix, DONT-RECURSE is set to non-nil.
|
||||
|
||||
Example usage in Emacs Lisp: (ox-hugo/export-all \"~/org\")."
|
||||
(interactive)
|
||||
(let* ((org-files-root-dir (or org-files-root-dir default-directory))
|
||||
(dont-recurse (or dont-recurse (and current-prefix-arg t)))
|
||||
(search-path (file-name-as-directory (expand-file-name org-files-root-dir)))
|
||||
(org-files (if dont-recurse
|
||||
(directory-files search-path :full "\.org$")
|
||||
(directory-files-recursively search-path "\.org$")))
|
||||
(num-files (length org-files))
|
||||
(cnt 1))
|
||||
(if (= 0 num-files)
|
||||
(message (format "No Org files found in %s" search-path))
|
||||
(progn
|
||||
(message (format (if dont-recurse
|
||||
"[ox-hugo/export-all] Exporting %d files from %S .."
|
||||
"[ox-hugo/export-all] Exporting %d files recursively from %S ..")
|
||||
num-files search-path))
|
||||
(dolist (org-file org-files)
|
||||
(with-current-buffer (find-file-noselect org-file)
|
||||
(message (format "[ox-hugo/export-all file %d/%d] Exporting %s" cnt num-files org-file))
|
||||
(org-hugo-export-wim-to-md :all-subtrees)
|
||||
(setq cnt (1+ cnt))))
|
||||
(message "Done!")))))
|
||||
(ox-hugo/export-all org-roam-directory)
|
||||
|
||||
;; Load the publishing system
|
||||
(require 'ox-publish)
|
||||
(use-package ox-gemini)
|
||||
|
|
56
create.sh
56
create.sh
|
@ -1,59 +1,17 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# start with a clean slate
|
||||
rm -rf ./public/cosmicflow-html/
|
||||
rm -rf ./public/exocortex-hugo-md/content/
|
||||
rm -rf ./public/exocortex-hugo-md/public/*
|
||||
# generate the html and gemini versions of the site using org-publish
|
||||
emacs -Q --batch -l create-site.el
|
||||
|
||||
rsync -avi ./content/ltximg ./public/cosmicflow-html/
|
||||
|
||||
#sync exocortex notes
|
||||
cd ./public/exocortex-hugo-md/
|
||||
npx quartz build
|
||||
cd ../../
|
||||
# run script to copy the generated latex images to the appropiate subdirectories
|
||||
./copy_latex_images.sh
|
||||
|
||||
rsync -avi --delete ./public/exocortex-hugo-md/public/ ./public/cosmicflow-html/exocortex/
|
||||
# Generate the exocortex
|
||||
./build_exocortex.sh
|
||||
|
||||
# Set the source and destination directories
|
||||
src_dir="./public/cosmicflow-html"
|
||||
src_ltximg_dir="./public/cosmicflow-html/ltximg"
|
||||
# Copy relavent pics to blog subdirectories
|
||||
./copy-pics.sh
|
||||
|
||||
# Loop through each subdirectory
|
||||
for dir in "$src_dir"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
dir_name=$(basename "$dir")
|
||||
dst_ltximg_dir="${src_dir}/${dir_name}/ltximg"
|
||||
|
||||
# Create the destination subdirectory if it doesn't exist
|
||||
if [ ! -d "$dst_ltximg_dir" ]; then
|
||||
mkdir -p "$dst_ltximg_dir"
|
||||
fi
|
||||
|
||||
# Use rsync to copy files starting with the subdirectory name as prefix
|
||||
rsync -av --include="$dir_name*" --exclude="*" "${src_ltximg_dir}/" "${dst_ltximg_dir}/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Set the source and destination directories
|
||||
src_dir="./public/cosmicflow-html"
|
||||
src_pics_dir="./assets/pics/"
|
||||
|
||||
# Loop through each subdirectory
|
||||
for dir in "$src_dir"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
dir_name=$(basename "$dir")
|
||||
dst_pics_dir="${src_dir}/${dir_name}/pics"
|
||||
|
||||
# Create the destination subdirectory if it doesn't exist
|
||||
if [ ! -d "$dst_pics_dir" ]; then
|
||||
mkdir -p "$dst_pics_dir"
|
||||
fi
|
||||
|
||||
# Use rsync to copy files starting with the subdirectory name as prefix
|
||||
rsync -av --include="$dir_name*" --exclude="*" "${src_pics_dir}/" "${dst_pics_dir}/"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# rm -rf ./content/ltximg/
|
||||
|
|
73
ox-hugo-exocortex.el
Normal file
73
ox-hugo-exocortex.el
Normal file
|
@ -0,0 +1,73 @@
|
|||
;; ox-hugo for exocortex notes
|
||||
|
||||
;; Set the package installation directory so that packages aren't stored in the
|
||||
;; ~/.emacs.d/elpa path.
|
||||
(require 'package)
|
||||
(setq package-user-dir (expand-file-name "./.packages"))
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("melpa-stable" . "https://stable.melpa.org/packages/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")))
|
||||
|
||||
;; Initialize the package system
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
;; Install use-package
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'use-package))
|
||||
(require 'use-package)
|
||||
|
||||
|
||||
(use-package ox-hugo
|
||||
:ensure t ;Auto-install the package from Melpa
|
||||
:pin melpa ;`package-archives' should already have ("melpa" . "https://melpa.org/packages/")
|
||||
:after ox
|
||||
:config
|
||||
(setq org-hugo-base-dir "~/projects/cosmicflow.space/public/exocortex-hugo-md" )
|
||||
(setq org-hugo-default-section-directory "./")
|
||||
)
|
||||
(setq org-roam-directory "~/projects/thought_garden/")
|
||||
|
||||
;; modified this function from https://github.com/kaushalmodi/ox-hugo/discussions/585#discussioncomment-2335203
|
||||
(defun ox-hugo/export-all (&optional org-files-root-dir dont-recurse)
|
||||
"Export all Org files (including nested) under ORG-FILES-ROOT-DIR.
|
||||
|
||||
All valid post subtrees in all Org files are exported using
|
||||
`org-hugo-export-wim-to-md'.
|
||||
|
||||
If optional arg ORG-FILES-ROOT-DIR is nil, all Org files in
|
||||
current buffer's directory are exported.
|
||||
|
||||
If optional arg DONT-RECURSE is nil, all Org files in
|
||||
ORG-FILES-ROOT-DIR in all subdirectories are exported. Else, only
|
||||
the Org files directly present in the current directory are
|
||||
exported. If this function is called interactively with
|
||||
\\[universal-argument] prefix, DONT-RECURSE is set to non-nil.
|
||||
|
||||
Example usage in Emacs Lisp: (ox-hugo/export-all \"~/org\")."
|
||||
(interactive)
|
||||
(let* ((org-files-root-dir (or org-files-root-dir default-directory))
|
||||
(dont-recurse (or dont-recurse (and current-prefix-arg t)))
|
||||
(search-path (file-name-as-directory (expand-file-name org-files-root-dir)))
|
||||
(org-files (if dont-recurse
|
||||
(directory-files search-path :full "\.org$")
|
||||
(directory-files-recursively search-path "\.org$")))
|
||||
(num-files (length org-files))
|
||||
(cnt 1))
|
||||
(if (= 0 num-files)
|
||||
(message (format "No Org files found in %s" search-path))
|
||||
(progn
|
||||
(message (format (if dont-recurse
|
||||
"[ox-hugo/export-all] Exporting %d files from %S .."
|
||||
"[ox-hugo/export-all] Exporting %d files recursively from %S ..")
|
||||
num-files search-path))
|
||||
(dolist (org-file org-files)
|
||||
(with-current-buffer (find-file-noselect org-file)
|
||||
(message (format "[ox-hugo/export-all file %d/%d] Exporting %s" cnt num-files org-file))
|
||||
(org-hugo-export-wim-to-md :all-subtrees)
|
||||
(setq cnt (1+ cnt))))
|
||||
(message "Done!")))))
|
||||
(ox-hugo/export-all org-roam-directory)
|
||||
|
||||
(message "exocortex markdown created")
|
Loading…
Add table
Reference in a new issue