From: Amin Bandali Date: Mon, 3 Sep 2018 14:17:10 +0000 (-0400) Subject: [wip] start migrating to ox-hugo X-Git-Url: https://git.shemshak.org/~bandali/bndl.org/commitdiff_plain/caf3b78c74be4c0d1e53904aa258fda50e512ef0?ds=sidebyside [wip] start migrating to ox-hugo --- diff --git a/.gitignore b/.gitignore index 89f9ac0..73ab876 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -out/ +public/ +resources/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..13837d0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "themes/divine"] + path = themes/divine + url = https://git.sr.ht/~aminb/hugo-theme-divine +[submodule "themes/hugo-debugprint"] + path = themes/hugo-debugprint + url = https://github.com/kaushalmodi/hugo-debugprint +[submodule "themes/hugo-search-fuse-js"] + path = themes/hugo-search-fuse-js + url = https://github.com/kaushalmodi/hugo-search-fuse-js diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..612d8f0 --- /dev/null +++ b/config.toml @@ -0,0 +1,30 @@ +baseurl = "https://aminb.org" +title = "Amin Bandali" +author = "Amin Bandali" +theme = "divine" + +enableEmoji = true +enableGitInfo = true + +disableFastRender = true # Hugo 0.30 + +pygmentsCodeFences = true # This applies to Chroma too. +pygmentsUseClasses = true # This applies to Chroma too. + +[Author] + name = "Amin Bandali" + +[Social] + github = "aminb" + +[Params] + disable_debug = true + description = """\ + Amin Bandali is a graduate student in the WatForm \ + group at UWaterloo. He is also the co-host of the \ + Emacs.el podcast and loves functional programming.\ + """ + [Params.source] + url = "https://git.sr.ht/~aminb/aminb.org" + md_dir = "content" + org_dir = "content-org" diff --git a/content-org/aminb.org b/content-org/aminb.org new file mode 100644 index 0000000..5f31ecd --- /dev/null +++ b/content-org/aminb.org @@ -0,0 +1,327 @@ +#+title: sources of aminb.org's pages and posts + +#+hugo_base_dir: .. +#+seq_todo: TODO DRAFT DONE +#+property: header-args :eval never-export +#+options: author:nil + +#+macro: abbr @@html:$1@@ +#+macro: span @@html:$2@@ + +* Pages +:PROPERTIES: +:EXPORT_HUGO_SECTION: / +:EXPORT_HUGO_MENU: :menu topnav +:END: + +** CV +:PROPERTIES: +:EXPORT_FILE_NAME: cv +:END: + +My academic {{{abbr(CV)}}} is available as [[/cv.pdf][cv.pdf]], +and an outdated professional resume is available as [[/resume.pdf][resume.pdf]] as +well. + +I'm interested in functional programming and functional languages, +type systems, and formal methods in general. I love writing Haskell +and I'm looking into Rust and Lean as well. Feel free to [[/contact][drop me a +line]] if you like to geek out about any of the above. + +** TODO Now + +** TODO Projects + +** TODO Contact + +* Posts +:PROPERTIES: +:EXPORT_HUGO_SECTION: post +:EXPORT_HUGO_MENU: :menu main +:END: + +** Arch GNU/Linux on MacBook Air 2013 :arch:macbook: +:PROPERTIES: +:EXPORT_FILE_NAME: arch-macbook-air +:EXPORT_DATE: 2016-11-01 +:EXPORT_HUGO_MENU: :menu main +:EXPORT_OPTIONS: ^:{} +:END: + +This post summarizes how I install and dual-boot Arch GNU/Linux with +Full-Disk Encryption alongside macOS. It is not meant to be a +replacement for the [[https://wiki.archlinux.org/index.php/installation_guide][Installation Guide]] or the former [[https://csdietz.github.io/arch-beginner-guide/][Beginner's Guide]]. +Rather, it mostly serves as a small summary with a few useful notes +about the gotchas. + +So, make sure you understand what you type into your terminal. If you +don't, checking out the Arch wiki should probably be your first step. + +/Note:/ you will need internet access throughout the installation and +the MacBook Air's WiFi doesn't work out of the box on Arch. I +recommend using your phone's USB Tethering (if it does support it), or +using an Ethernet-USB adapter. + +*** Shrinking the macOS partition + +The first step I take is resizing the HFS+ macOS partition to make +room for the new {{{abbr(GNU/Linux)}}} installation. There are plenty +of tutorials on how to do this using macOS's Disk Utility, so do that +and then come back! + +*** Creating a bootable Arch Installer USB + +There are different ways of creating a bootable Arch USB, all +documented on the [[https://wiki.archlinux.org/index.php/USB_flash_installation_media][USB flash installation media]] page on the Arch wiki, +but the simplest one is using =dd= if you already have access to +another UNIX system. + +{{{span(red,Warning:)}}} make sure you backup the data on your flash +drive, as =dd= will irrevocably destroy all data on it. + +Use =lsblk= to find the name (block device) of your USB drive, then +run =dd= (as root) as shown below: + +#+begin_src bash +dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync +#+end_src + +Replace =/path/to/archlinux.iso= with the path to the Arch image you +have downloaded, and =/dev/sdx= with your drive. + +*** Booting up from the USB + +After creating the install USB, reboot your laptop and hold the alt +key and boot into the USB. + +When booting is complete and you're presented with the prompt, it's a +good time to make sure you're connected to the internet (see the +/note/ at the top of this post). + +Use =ping= to verify that you've established a connection: + +#+begin_src bash +ping archlinux.org +#+end_src + +*** Updating the system clock + +Once you're connected to the internet, make sure the system clock is +accurate: + +#+begin_src bash +timedatectl set-ntp true # start and enable systemd-timesyncd +#+end_src + +You can check the service status using =timedatectl status=. + +*** Partitioning +:PROPERTIES: +:CUSTOM_ID: partitioning +:END: + +I won't dive into partitioning and instead, I'll refer you to the +[[https://wiki.archlinux.org/index.php/Partitioning][Partitioning]] page of Arch wiki. Of the available partitioning tools, I +personally prefer =cfdisk=. + +*** Setting up LVM & LUKS + +I use a [[https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS][LVM on LUKS]] setup, where I set up LVM on top of the encrypted +partition. + +First, let's set up the underlying encrypted partition: + +#+begin_src bash +cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 \ + --iter-time 5000 --use-urandom -y luksFormat /dev/sdaX +#+end_src + +where =/dev/sdaX= is the partition you created in the last step +(e.g. =/dev/sda4=). For more information about the =cryptsetup= +options, see the [[https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption#Encryption_options_for_LUKS_mode][LUKS encryption options]]. + +Then we open the container: + +#+begin_src bash +cryptsetup open --type luks /dev/sdaX lvm +#+end_src + +Now it's time to use lvm and prepare the logical volume(s): + +#+begin_src bash +pvcreate /dev/mapper/lvm +vgcreate vg /dev/mapper/lvm +lvcreate --extents +100%FREE -n root vg +#+end_src + +This will create a physical volume on the mapping we just opened, +create a volume group named =vg= on the physical volume, and create a +logical volume named =root= that spans the entire volume group. More +complex setups are possible thanks to the great flexibility of lvm. + +We now format the logical volume with =ext4=: + +#+begin_src bash +mkfs.ext4 /dev/mapper/vg-root +#+end_src + +*** Installing the base system + +Let's mount the logical volume, make a directory for the mount point +of the boot partition, and mount the boot partition (=/dev/sda1=): + +#+begin_src bash +mount /dev/mapper/vg-root /mnt +mkdir /mnt/boot +mount /dev/sda1 /mnt/boot +#+end_src + +Finally, let's install the base system (and optionally =base-devel=): + +#+begin_src bash +pacstrap /mnt base base-devel +#+end_src + +*** Configuring the system + +Let's generate the fstab: + +#+begin_src bash +genfstab -U /mnt >> /mnt/etc/fstab +#+end_src + +Use your favorite terminal-based editor, edit the fstab file and add +the =discard= option for the root partition to enable TRIM on the SSD. + +Now we change root into our newly installed system and will configure +it. Adjust these according to your own setup. + +#+begin_src bash +arch-chroot /mnt /bin/bash +passwd # set the root password +echo myhostname > /etc/hostname # set the hostname +ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime # time zone +hwclock --systohc --utc # write system clock to hardware clock (UTC) +useradd -m -G wheel -s /bin/bash myuser # create myuser +passwd myuser # set the password for myuser +echo "myuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/myuser +# uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen +locale-gen +echo LANG=en_US.UTF-8 > /etc/locale.conf +export LANG=en_US.UTF-8 +#+end_src + +Then adjust the initramfs hooks in =/etc/mkinitcpio.conf= and enable +the =encrypt= and =lvm2= hooks, and make sure =keyboard= is available +before =encrypt= so you can actually type in the LUKS password when +booting. Your =HOOKS= line should look similar to this: + +#+begin_src +HOOKS="base udev autodetect modconf block keyboard encrypt lvm2 filesystems fsck" +#+end_src + +After adjusting the hooks, build the initramfs: + +#+begin_src bash +mkinitcpio -p linux +#+end_src + +Now, install the =intel-ucode= package. We'll configure the bootloader +to enable intel microcode updates. + +#+begin_src bash +pacman -S intel-ucode +#+end_src + +Create the =/boot/loader/loader.conf= with the following content +(adjust the timeout to your liking): + +#+begin_src +default arch +timeout 3 +#+end_src + +Then create the entry for Arch: + +#+begin_src bash +mkdir -p /boot/loader/entries +touch /boot/loader/entries/arch.conf +#+end_src + +Now edit =/boot/loader/entries/arch.conf= to specify the Arch entry: + +#+begin_src +title Arch GNU/Linux +linux /vmlinuz-linux +initrd /intel-ucode.img +initrd /initramfs-linux.img +options cryptdevice=/dev/sdaX:vg:allow-discards root=/dev/mapper/vg-root rw +#+end_src + +Again, =/dev/sdaX= is the partition you created in the [[#partitioning][partitioning]] +step as the underlying encrypted partition. + +Finally, install the bootloader, exit the chroot, umount and reboot! + +#+begin_src bash +bootctl install +exit +umount -R /mnt +reboot +#+end_src + +*** Post-installation recommendations + +Congratulations! You now have a minimal Arch installation. + +At this point, I usually install my favorite AUR helper, [[https://aur.archlinux.org/packages/pacaur/][pacaur]], then +I install the [[https://aur.archlinux.org/packages/broadcom-wl-dkms/][broadcom-wl-dkms]] wireless driver and [[https://aur.archlinux.org/packages/mba6x_bl-dkms/][mba6x_bl-dkms]] +backlight driver to fix the post suspend/resume issue where three's no +brightness after waking up from suspend, and the only available +brightness would be 100%. + +#+begin_src bash +pacaur -S linux-headers dkms # linux-headers is required for dkms +pacaur -S broadcom-wl-dkms +pacaur -S mba6x_bl-dkms +#+end_src + +Then, I'd like to install + +- input, graphics, and sound drivers, +- a desktop environment (I prefer Xfce or LXQt), +- a display manager for login screen (lightdm or sddm), and +- a network manager (NetworkManager or ConnMan). + +Check out the [[https://wiki.archlinux.org/index.php/General_recommendations][General recommendations]] for more details. + +*** References + +Here are some resources I've come across each with lots of useful bits +and pieces, about installing Arch on a MacBook: + +- [[https://github.com/pandeiro/arch-on-air][pandeiro/arch-on-air]] +- [[https://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/][Arch Linux on MacBook Pro Retina 2014 with DM-Crypt, LVM and suspend to disk]] +- [[http://frankshin.com/installing-archlinux-on-macbook-air-2013/][Installing Archlinux on Macbook Air 2013]] +- [[http://panks.me/posts/2013/06/arch-linux-installation-with-os-x-on-macbook-air-dual-boot/][Arch Linux Installation with OS X on Macbook Air (Dual Boot)]] +- [[https://visual-assault.org/2016/03/05/install-encrypted-arch-linux-on-apple-macbook-pro/][Installing (encrypted) Arch Linux on an Apple MacBook Pro]] +- [[http://alexeyzabelin.com/arch-on-mac][Installing Arch Linux on a MacBook Air 2013]] +- [[https://medium.com/phils-thought-bubble-of-recent-stuff/arch-linux-running-on-my-macbook-2ea525ebefe3][Arch Linux running on my MacBook]] +- [[http://codylittlewood.com/arch-linux-on-macbook-pro-installation/][Dual boot Arch Linux on MacBook Pro Installation]] + +* Meta +** Search +:PROPERTIES: +:EXPORT_HUGO_SECTION: / +:EXPORT_FILE_NAME: search +:EXPORT_HUGO_LAYOUT: search +:EXPORT_HUGO_OUTPUTS: html json +:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :sitemap '((priority . 0.1)) +:END: +Results from static site search implemented using /Fusejs/, /jquery/ +and /mark.js/. -- [[https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae][Source]] + +* COMMENT Local Variables :ARCHIVE: +# Local Variables: +# org-hugo-footer: "\n\n[//]: # \"Exported with love from a post written in Org mode\"\n[//]: # \"- https://github.com/kaushalmodi/ox-hugo\"" +# End: diff --git a/content/cv.md b/content/cv.md new file mode 100644 index 0000000..f26c6b8 --- /dev/null +++ b/content/cv.md @@ -0,0 +1,16 @@ ++++ +title = "CV" +draft = false +[menu.topnav] + weight = 2001 + identifier = "cv" ++++ + +My academic CV is available as [cv.pdf](/cv.pdf), +and an outdated professional resume is available as [resume.pdf](/resume.pdf) as +well. + +I'm interested in functional programming and functional languages, +type systems, and formal methods in general. I love writing Haskell +and I'm looking into Rust and Lean as well. Feel free to [drop me a +line](/contact) if you like to geek out about any of the above. diff --git a/content/post/arch-macbook-air.md b/content/post/arch-macbook-air.md new file mode 100644 index 0000000..f4b3b22 --- /dev/null +++ b/content/post/arch-macbook-air.md @@ -0,0 +1,280 @@ ++++ +title = "Arch GNU/Linux on MacBook Air 2013" +date = 2016-11-01 +tags = ["arch", "macbook"] +draft = false +[menu.main] + weight = 2001 + identifier = "arch-gnu-linux-on-macbook-air-2013" ++++ + +This post summarizes how I install and dual-boot Arch GNU/Linux with +Full-Disk Encryption alongside macOS. It is not meant to be a +replacement for the [Installation Guide](https://wiki.archlinux.org/index.php/installation%5Fguide) or the former [Beginner's Guide](https://csdietz.github.io/arch-beginner-guide/). +Rather, it mostly serves as a small summary with a few useful notes +about the gotchas. + +So, make sure you understand what you type into your terminal. If you +don't, checking out the Arch wiki should probably be your first step. + +_Note:_ you will need internet access throughout the installation and +the MacBook Air's WiFi doesn't work out of the box on Arch. I +recommend using your phone's USB Tethering (if it does support it), or +using an Ethernet-USB adapter. + + +## Shrinking the macOS partition {#shrinking-the-macos-partition} + +The first step I take is resizing the HFS+ macOS partition to make +room for the new GNU/Linux installation. There are plenty +of tutorials on how to do this using macOS's Disk Utility, so do that +and then come back! + + +## Creating a bootable Arch Installer USB {#creating-a-bootable-arch-installer-usb} + +There are different ways of creating a bootable Arch USB, all +documented on the [USB flash installation media](https://wiki.archlinux.org/index.php/USB%5Fflash%5Finstallation%5Fmedia) page on the Arch wiki, +but the simplest one is using `dd` if you already have access to +another UNIX system. + +Warning: make sure you backup the data on your flash +drive, as `dd` will irrevocably destroy all data on it. + +Use `lsblk` to find the name (block device) of your USB drive, then +run `dd` (as root) as shown below: + +```bash +dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync +``` + +Replace `/path/to/archlinux.iso` with the path to the Arch image you +have downloaded, and `/dev/sdx` with your drive. + + +## Booting up from the USB {#booting-up-from-the-usb} + +After creating the install USB, reboot your laptop and hold the alt +key and boot into the USB. + +When booting is complete and you're presented with the prompt, it's a +good time to make sure you're connected to the internet (see the +_note_ at the top of this post). + +Use `ping` to verify that you've established a connection: + +```bash +ping archlinux.org +``` + + +## Updating the system clock {#updating-the-system-clock} + +Once you're connected to the internet, make sure the system clock is +accurate: + +```bash +timedatectl set-ntp true # start and enable systemd-timesyncd +``` + +You can check the service status using `timedatectl status`. + + +## Partitioning {#partitioning} + +I won't dive into partitioning and instead, I'll refer you to the +[Partitioning](https://wiki.archlinux.org/index.php/Partitioning) page of Arch wiki. Of the available partitioning tools, I +personally prefer `cfdisk`. + + +## Setting up LVM & LUKS {#setting-up-lvm-and-luks} + +I use a [LVM on LUKS](https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting%5Fan%5Fentire%5Fsystem#LVM%5Fon%5FLUKS) setup, where I set up LVM on top of the encrypted +partition. + +First, let's set up the underlying encrypted partition: + +```bash +cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 \ + --iter-time 5000 --use-urandom -y luksFormat /dev/sdaX +``` + +where `/dev/sdaX` is the partition you created in the last step +(e.g. `/dev/sda4`). For more information about the `cryptsetup` +options, see the [LUKS encryption options](https://wiki.archlinux.org/index.php/Dm-crypt/Device%5Fencryption#Encryption%5Foptions%5Ffor%5FLUKS%5Fmode). + +Then we open the container: + +```bash +cryptsetup open --type luks /dev/sdaX lvm +``` + +Now it's time to use lvm and prepare the logical volume(s): + +```bash +pvcreate /dev/mapper/lvm +vgcreate vg /dev/mapper/lvm +lvcreate --extents +100%FREE -n root vg +``` + +This will create a physical volume on the mapping we just opened, +create a volume group named `vg` on the physical volume, and create a +logical volume named `root` that spans the entire volume group. More +complex setups are possible thanks to the great flexibility of lvm. + +We now format the logical volume with `ext4`: + +```bash +mkfs.ext4 /dev/mapper/vg-root +``` + + +## Installing the base system {#installing-the-base-system} + +Let's mount the logical volume, make a directory for the mount point +of the boot partition, and mount the boot partition (`/dev/sda1`): + +```bash +mount /dev/mapper/vg-root /mnt +mkdir /mnt/boot +mount /dev/sda1 /mnt/boot +``` + +Finally, let's install the base system (and optionally `base-devel`): + +```bash +pacstrap /mnt base base-devel +``` + + +## Configuring the system {#configuring-the-system} + +Let's generate the fstab: + +```bash +genfstab -U /mnt >> /mnt/etc/fstab +``` + +Use your favorite terminal-based editor, edit the fstab file and add +the `discard` option for the root partition to enable TRIM on the SSD. + +Now we change root into our newly installed system and will configure +it. Adjust these according to your own setup. + +```bash +arch-chroot /mnt /bin/bash +passwd # set the root password +echo myhostname > /etc/hostname # set the hostname +ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime # time zone +hwclock --systohc --utc # write system clock to hardware clock (UTC) +useradd -m -G wheel -s /bin/bash myuser # create myuser +passwd myuser # set the password for myuser +echo "myuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/myuser +# uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen +locale-gen +echo LANG=en_US.UTF-8 > /etc/locale.conf +export LANG=en_US.UTF-8 +``` + +Then adjust the initramfs hooks in `/etc/mkinitcpio.conf` and enable +the `encrypt` and `lvm2` hooks, and make sure `keyboard` is available +before `encrypt` so you can actually type in the LUKS password when +booting. Your `HOOKS` line should look similar to this: + +```nil +HOOKS="base udev autodetect modconf block keyboard encrypt lvm2 filesystems fsck" +``` + +After adjusting the hooks, build the initramfs: + +```bash +mkinitcpio -p linux +``` + +Now, install the `intel-ucode` package. We'll configure the bootloader +to enable intel microcode updates. + +```bash +pacman -S intel-ucode +``` + +Create the `/boot/loader/loader.conf` with the following content +(adjust the timeout to your liking): + +```nil +default arch +timeout 3 +``` + +Then create the entry for Arch: + +```bash +mkdir -p /boot/loader/entries +touch /boot/loader/entries/arch.conf +``` + +Now edit `/boot/loader/entries/arch.conf` to specify the Arch entry: + +```nil +title Arch GNU/Linux +linux /vmlinuz-linux +initrd /intel-ucode.img +initrd /initramfs-linux.img +options cryptdevice=/dev/sdaX:vg:allow-discards root=/dev/mapper/vg-root rw +``` + +Again, `/dev/sdaX` is the partition you created in the [partitioning](#partitioning) +step as the underlying encrypted partition. + +Finally, install the bootloader, exit the chroot, umount and reboot! + +```bash +bootctl install +exit +umount -R /mnt +reboot +``` + + +## Post-installation recommendations {#post-installation-recommendations} + +Congratulations! You now have a minimal Arch installation. + +At this point, I usually install my favorite AUR helper, [pacaur](https://aur.archlinux.org/packages/pacaur/), then +I install the [broadcom-wl-dkms](https://aur.archlinux.org/packages/broadcom-wl-dkms/) wireless driver and [mba6x\_bl-dkms](https://aur.archlinux.org/packages/mba6x%5Fbl-dkms/) +backlight driver to fix the post suspend/resume issue where three's no +brightness after waking up from suspend, and the only available +brightness would be 100%. + +```bash +pacaur -S linux-headers dkms # linux-headers is required for dkms +pacaur -S broadcom-wl-dkms +pacaur -S mba6x_bl-dkms +``` + +Then, I'd like to install + +- input, graphics, and sound drivers, +- a desktop environment (I prefer Xfce or LXQt), +- a display manager for login screen (lightdm or sddm), and +- a network manager (NetworkManager or ConnMan). + +Check out the [General recommendations](https://wiki.archlinux.org/index.php/General%5Frecommendations) for more details. + + +## References {#references} + +Here are some resources I've come across each with lots of useful bits +and pieces, about installing Arch on a MacBook: + +- [pandeiro/arch-on-air](https://github.com/pandeiro/arch-on-air) +- [Arch Linux on MacBook Pro Retina 2014 with DM-Crypt, LVM and suspend to disk](https://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/) +- [Installing Archlinux on Macbook Air 2013](http://frankshin.com/installing-archlinux-on-macbook-air-2013/) +- [Arch Linux Installation with OS X on Macbook Air (Dual Boot)](http://panks.me/posts/2013/06/arch-linux-installation-with-os-x-on-macbook-air-dual-boot/) +- [Installing (encrypted) Arch Linux on an Apple MacBook Pro](https://visual-assault.org/2016/03/05/install-encrypted-arch-linux-on-apple-macbook-pro/) +- [Installing Arch Linux on a MacBook Air 2013](http://alexeyzabelin.com/arch-on-mac) +- [Arch Linux running on my MacBook](https://medium.com/phils-thought-bubble-of-recent-stuff/arch-linux-running-on-my-macbook-2ea525ebefe3) +- [Dual boot Arch Linux on MacBook Pro Installation](http://codylittlewood.com/arch-linux-on-macbook-pro-installation/) + +[//]: # "Exported with love from a post written in Org mode" +[//]: # "- https://github.com/kaushalmodi/ox-hugo" diff --git a/partials/postamble.html b/partials/postamble.html deleted file mode 100644 index a3b1dbe..0000000 --- a/partials/postamble.html +++ /dev/null @@ -1,5 +0,0 @@ -© 2016–2018 Amin Bandali -| -colophon -| -%g diff --git a/partials/preamble.html b/partials/preamble.html deleted file mode 100644 index c0dad2a..0000000 --- a/partials/preamble.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/publish.el b/publish.el deleted file mode 100644 index 7acc4a5..0000000 --- a/publish.el +++ /dev/null @@ -1,114 +0,0 @@ -;; Inspiration: https://gitlab.com/ambrevar/ambrevar.gitlab.io. - -;; TODO: use git time-stamps - -(require 'ox-publish) - -(add-to-list 'load-path ".") - -(defun aminb--readfile (filepath) - "Return filepath's content." - (with-temp-buffer - (insert-file-contents filepath) - (buffer-string))) - -(defun aminb--find-replace (match-with replace-with string) - "Return the string resulting from replacing `match-with' with - `replace-with' in `string'." - (when (string-match match-with string) - (replace-match replace-with nil nil string))) - -(defun aminb--my-html-body-light-filter (output backend info) - "Make adjustments needed for dark/light mode tag to work." - (when (eq backend 'html) - (aminb--find-replace - "\n" - "\n\n" - (aminb--find-replace - "\n" - "\n\n
" - output)))) - -(add-to-list 'org-export-filter-final-output-functions - 'aminb--my-html-body-light-filter) - -;; re-defining this (originally in `ox-html.el') to add `?g' -(defun org-html-format-spec (info) - "Return format specification for preamble and postamble. -INFO is a plist used as a communication channel." - (let ((timestamp-format (plist-get info :html-metadata-timestamp-format)) - (git-repo "@%s") - (git-rev (shell-command-to-string "git rev-parse HEAD")) - (git-rev-short (shell-command-to-string "git rev-parse --short HEAD"))) - `((?t . ,(org-export-data (plist-get info :title) info)) - (?s . ,(org-export-data (plist-get info :subtitle) info)) - (?d . ,(org-export-data (org-export-get-date info timestamp-format) - info)) - (?T . ,(format-time-string timestamp-format)) - (?a . ,(org-export-data (plist-get info :author) info)) - (?e . ,(mapconcat - (lambda (e) (format "%s" e e)) - (split-string (plist-get info :email) ",+ *") - ", ")) - (?g . ,(format git-repo git-rev git-rev-short)) - (?c . ,(plist-get info :creator)) - (?C . ,(let ((file (plist-get info :input-file))) - (format-time-string timestamp-format - (and file (nth 5 (file-attributes file)))))) - (?v . ,(or (plist-get info :html-validation-link) ""))))) - -;; timestamps can be used to avoid rebuilding everything -;; should probably be put inside the public/ directory -(setq org-publish-use-timestamps-flag t - org-publish-timestamp-directory "./") - -;; get rid of index.html~ and other backup files that may be created during generation -(setq make-backup-files nil) - -(setq org-export-with-section-numbers nil - org-export-with-smart-quotes t - org-export-with-email t - org-export-with-date t - org-export-with-tags 'not-in-toc - org-export-with-toc t) - -(setq org-html-divs '((preamble "header" "preamble") - (content "main" "content") - (postamble "footer" "postamble")) - ;; TODO: link last update to commit history of file - org-html-preamble t - org-html-postamble t - org-html-preamble-format `(("en" ,(aminb--readfile "partials/preamble.html"))) - org-html-postamble-format `(("en" ,(aminb--readfile "partials/postamble.html"))) - org-html-container-element "section" - org-html-metadata-timestamp-format "%Y-%m-%d" - org-html-checkbox-type 'html - org-html-html5-fancy t - ;; use custom css - ;; this removes the dependency on `htmlize', - ;; but we also lose syntax highlighting. - org-html-htmlize-output-type nil - org-html-validation-link nil - org-html-doctype "html5") - -(setq org-publish-project-alist - (list - (list "site-org" - :base-directory "./source/" - :exclude "macros.org" - :recursive t - :publishing-function '(org-html-publish-to-html) - :publishing-directory "./public/" - :html-head-include-default-style nil - :html-head-include-scripts nil) - (list "site-static" - :base-directory "source/" - :exclude "\\.org\\'" - :base-extension 'any - :publishing-directory "./public" - :publishing-function 'org-publish-attachment - :recursive t) - (list "site" :components '("site-org")))) - -(defun aminb/publish () - (org-publish-all)) diff --git a/source/global.js b/source/global.js deleted file mode 100644 index f7ecb6b..0000000 --- a/source/global.js +++ /dev/null @@ -1,11 +0,0 @@ -!function(t){ - t.addEventListener('DOMContentLoaded', function () { - var l = t.querySelector('#light-off'); - if (l !== null) { - l.checked = t.cookie.match(/lightOff=true/) !== null; - l.addEventListener('change', function () { - t.cookie = 'lightOff=' + JSON.stringify(l.checked) + ';path=/'; - }); - } - }) -}(document); diff --git a/source/style.css b/source/style.css deleted file mode 100644 index 3ffebe6..0000000 --- a/source/style.css +++ /dev/null @@ -1,220 +0,0 @@ -html, body { - margin: 0; - height: 100%; -} - -body { - font-family: "Liberation Sans", "Arial", sans-serif; - color: #232323; -} - -main { - margin: 0 auto; - max-width: 34em; - padding: 1em; -} - -/* Header and Footer */ - -#aminb { font-size: 0.9em; } - -#preamble, -#postamble { - color: #888888; - padding: 1em; - margin: 0 auto; - max-width: 34em; -} - -#preamble { padding: 2em 1em 0em 1em; } - -#preamble h2 { display: inline; } - -#preamble a { border: none !important; color: #888 !important; } - -#preamble h2 a { color: #3a89c9 !important; } - -#preamble .bar { - color: #ccc; - font-size: 12pt; - vertical-align: bottom; - padding-left: 1px; - padding-right: 1px; -} - -#postamble { margin-bottom: 2em; } - -#postamble a { - color: #888888 !important; - border-bottom: 1px solid #cccccc !important; -} - -/* Content */ - -#content { - line-height: 1.6em; -} - -#content h1, #content h2 { - line-height: 1em; - font-weight: 700; - letter-spacing: -0.03em; - word-spacing: -0.03em; -} - -#content h1 { font-size: 1.6em; } - -#content h2 { - font-size: 1.2em; - padding: 0.25em 0; -} - -#content p { - margin: 1em 0; -} - -#content code { - background-color: #f5f5f5; - padding: 1px 3px; -} - -#content code, -#content pre { - font-family: "DejaVu Sans Mono", monospace; - font-size: 0.9em; - line-height: 1.5em; - margin: 0; -} - -#content pre { - background-color: #f5f5f5; - color: #232323; - margin: 0 -1em; - overflow-x: auto; - padding: 1em; - word-wrap: normal; -} - -#content ul { - padding: 0; - margin: 0.3em 0 0 1.6em; -} - -#content ul li { - /* list-style: none; */ -} - -#content li { - margin: 0.5em 0; -} - -.pub-desc { - font-size: 0.95em; -} - -#text-publications p { - margin: 0.5em 0; -} - -.light-off:checked ~ .page #content pre, -.light-off:checked ~ .page #content code { - background-color: #232323; -} - -.clear { clear: both; } - -#hello { float: left; line-height: 50px !important; } - -#content .picture__avatar { - margin: 0; - height: 64px; - width: 64px; - border-radius: 50%; - float: right; -} - -@media only screen and (min-width: 570px) { - .picture__avatar { - margin-right: 3em !important; - } -} - -.page { - background-color: #ffffff; - color: #232323; - min-height: 100%; -} - -.page a { - color: #357edd; - text-decoration: none; - border-bottom: 1px solid #a5ceff; -} - -pre { margin-left: 0 } - -/* Light switch */ - -#light-off { - position: absolute; - visibility: hidden; -} - -.light-off-button { - cursor: pointer; - vertical-align: middle; -} - -.light-off-button, -.light-off-button-inline { - color: #888888; - -webkit-user-select: none; - user-select: none; - cursor: pointer; - text-align: right; -} - -.light-off-button:hover:after, -.light-off-button-inline:hover:after { - color: #357edd; - border-bottom: 0; -} - -.light-off:checked ~ .page .light-off-button:hover:after -.light-off:checked ~ .page .light-off-button-inline:hover:after { - color: #ddddb6; - border-bottom: 0; -} - -.light-off-button:after, -.light-off-button-inline:after { - content: "\1F4A1"; - font-family: "Noto Color Emoji", "Noto Sans", "Arial", sans-serif; -} - -.light-off:checked ~ .page { - background-color: #141414; - color: #cccccc; -} - -.page:selection { - background: #ddddb6; -} -.light-off:checked ~ .page:selection { - background: #357edd; -} - -.light-off:checked ~ .page a, .light-off:checked ~ header a { - color: #ddddb6 !important; - border-bottom: 1px solid #aaaa96; -} - -.light-off:checked ~ .page a:visited { - color: #888888; - border-bottom: 1px solid #444444; -} - -.light-off:checked ~ .page a:hover { - color: #ddddb6; - border-bottom: 1px solid #ddddb6; -} diff --git a/themes/divine b/themes/divine new file mode 160000 index 0000000..dd3bc55 --- /dev/null +++ b/themes/divine @@ -0,0 +1 @@ +Subproject commit dd3bc55ba50f2320098c894a0de5458fb233920a diff --git a/themes/hugo-debugprint b/themes/hugo-debugprint new file mode 160000 index 0000000..334aed7 --- /dev/null +++ b/themes/hugo-debugprint @@ -0,0 +1 @@ +Subproject commit 334aed7c01552d2f761a0cab2f048c2475b96363 diff --git a/themes/hugo-search-fuse-js b/themes/hugo-search-fuse-js new file mode 160000 index 0000000..3622108 --- /dev/null +++ b/themes/hugo-search-fuse-js @@ -0,0 +1 @@ +Subproject commit 362210856807d835cb9e41f3bc27625c36fed618