initial commit
This commit is contained in:
20
docs/posts/clear-linux-encrypted-xfs-root.md
Normal file
20
docs/posts/clear-linux-encrypted-xfs-root.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: "Clear Linux Encrypted xfs Root"
|
||||
date: 2019-04-13T21:44:37-07:00
|
||||
draft: false
|
||||
tags: ["xfs","clear-linux","luks"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-04-13T21:44:37-07:00
|
||||
## **Nothing to-it Burger**
|
||||
I had intended to create a technical explanation how to install Clear Linux with disk encryption,
|
||||
with xfs. But that turned out to be unnecessary
|
||||
because the latest version of the installer handles setting that up automatically.
|
||||
|
||||
Previously, I had written down the steps needed
|
||||
to [get LMDE 3 installed using disk encryption with xfs](lmde3-xfs-full-disk-encryption.md){target=_blank}, which required manual intervention.
|
||||
|
||||
And indeed, a few months ago, the Clear Linux installer only supported xfs with disk encryption if you could
|
||||
supply some manual intervention. However, the latest Clear Linux installer can set up disk encryption with luks and xfs, automatically.
|
||||
|
||||
Just follow [the instructions](https://clearlinux.org/documentation/clear-linux/get-started/bare-metal-install){target=_blank}, no special skills needed.
|
58
docs/posts/clear-linux-guest-virt-manager.md
Normal file
58
docs/posts/clear-linux-guest-virt-manager.md
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
title: "Clear Linux Guest Virt Manager"
|
||||
date: 2019-03-11T01:39:09-07:00
|
||||
draft: false
|
||||
tags: ["kvm","clear-linux","qcow2","virt-manager","parted"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-03-11T01:39:09-07:00
|
||||
## **Introduction**
|
||||
|
||||
* download, convert, and resize the provided kvm-legacy image
|
||||
* create a virtual machine and launch it from `virt-manager`
|
||||
|
||||
But it’s not immediately clear from the instructions if you can use `virt-manager`,
|
||||
because they recommend their script which runs `qemu-system-x86_64` directly.
|
||||
Which is fine, but maybe you find it easier to customize the options using the `virt-manager` gui interface.
|
||||
## **How To**
|
||||
Assuming you have `libvirt` and `kvm` set up with `virt-manager`, you can:
|
||||
|
||||
* download the [clear-*-legacy-kvm.img.xz](https://cdn.download.clearlinux.org/releases/current/clear/){target=_blank}
|
||||
* verify the checksum
|
||||
* extract it `unxz clear-*-legacy-kvm.img.xz`
|
||||
* `mv clear-*-legacy-kvm.img.xz /var/lib/libvirt/images/`
|
||||
* create a virtual machine in `virt-manager` using the image
|
||||
|
||||
There is not an os template for Clear Linux, but **Fedora29** works fine for me.
|
||||
As a bonus, `virsh console` is configured and ready to go.
|
||||
## **Convert Raw -> Qcow2 and Resize**
|
||||
The image has a gpt partition table. I am not sure if that is the reason why,
|
||||
but `fdisk` does not seem to work for resizing the partition. However, `parted` works fine.
|
||||
|
||||
The [image download](https://cdn.download.clearlinux.org/releases/current/clear/){target=_blank} is an 8gb sparse raw image. You may wish to convert that to qcow2
|
||||
and and resize before creating the virtual machine. Here is how to do that.
|
||||
|
||||
1. convert the sparse raw image to qcow2
|
||||
```console
|
||||
qemu-img convert -f raw -O qcow2 clear*.img clear.qcow2
|
||||
```
|
||||
1. resize the image to taste
|
||||
```console
|
||||
qemu-img resize clear.qcow2 20G
|
||||
```
|
||||
1. create the virtual machine in `virt-manager` gui
|
||||
1. boot the virtual machine: `virsh start clearvm`
|
||||
1. log in: `virsh console clearvm`
|
||||
1. install a bundle which contains `parted`
|
||||
```console
|
||||
swupd bundle-add clr-installer
|
||||
```
|
||||
1. expand `/` partition and file system with `parted` and `resize2fs`
|
||||
```console
|
||||
parted /dev/vda resizepart
|
||||
> Fix/Ignore? Fix
|
||||
> Partition number? 1
|
||||
> End? [8590MB]? 100%
|
||||
> size2fs /dev/vda1
|
||||
```
|
||||
|
153
docs/posts/faster-partitioning-with-sgdisk.md
Normal file
153
docs/posts/faster-partitioning-with-sgdisk.md
Normal file
@ -0,0 +1,153 @@
|
||||
---
|
||||
title: "Faster Partitioning With sgdisk"
|
||||
date: 2019-02-11T04:23:52-08:00
|
||||
draft: false
|
||||
tags: ["command-line","gdisk","partition","sgdisk"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-02-11T04:23:52-08:00
|
||||
|
||||
## **Disclaimer**
|
||||
If any of this is wrong, let me know so I can fix it. No actual hard drives were harmed in the production of this blog post.
|
||||
|
||||
The examples are easier to read if you turn your smart phone sideways.
|
||||
|
||||
## **Command Line Is Faster**
|
||||
Sure you can partition your discs using a GUI disk management application or an interactive,
|
||||
menu-driven terminal interface. But the command line is faster.
|
||||
|
||||
## **gdisk vs sgdisk**
|
||||
`sgdisk` is the scriptable version of `gdisk` (gptfdisk).
|
||||
|
||||
## **[what the manpage says](https://manpages.debian.org/stretch/gdisk/sgdisk.8.en.html){target=_blank}**
|
||||
If you’re familiar with `gdisk`, you probably know how to interactively set the partition size and type.
|
||||
If you look at the man page for `sgdisk` you see that the relevant flags are `-n` and `-t`. The beginning and ending numbers
|
||||
are absolute, unless you prepend them with a `+` or `-` sign, in which case they become relative.
|
||||
```console
|
||||
# For New Partition:
|
||||
-n, --new=partnum:start:end
|
||||
```
|
||||
```console
|
||||
# Change partition type:
|
||||
-t, --typecode=partnum:{hexcode|GUID}
|
||||
```
|
||||
## **Example with Separate EFI and / Partitions**
|
||||
BTW, `gdisk` is a partitioning tool intended to be used with a gpt partition table, so the assumption is that you would want an efi partition,
|
||||
|
||||
(although the efi partition does not have to be on the disk you are partitioning or even on the same disk where your other system partitions are).
|
||||
|
||||
1. Wipe any leftover filesystem metadata with wipefs.
|
||||
```console
|
||||
wipefs --all /dev/sdx
|
||||
```
|
||||
1. Create a new GPT partition table.
|
||||
```console
|
||||
sgdisk /dev/sdx -o
|
||||
```
|
||||
1. Create an efi partition of 512MB by specifying the end of the partition (relative) and the partition type, `ef00`.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 1::+512MiB -t 1:ef00
|
||||
```
|
||||
1. Create an `/` partition using the remainder of the disk, by not specifying the end or the beginning or partition type, which defaults to 8300.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 2
|
||||
```
|
||||
1. Format the efi partition fat 32.
|
||||
```console
|
||||
mkfs.vfat -F32 /dev/sdx1
|
||||
```
|
||||
1. Format the `/` partition ext4.
|
||||
```console
|
||||
mkfs.ext4 /dev/sdx2
|
||||
```
|
||||
## **Practice With A Sparse Image**
|
||||
If you don’t want to partition a real hard drive, you can practice using an sparse image file, instead.
|
||||
```console
|
||||
# create a sparse image file
|
||||
truncate -S 100G practiceImage.img
|
||||
# partition the image file with sgdisk
|
||||
sgdisk practiceImage.img -o
|
||||
# etc
|
||||
```
|
||||
## **Example with Separate /boot, EFI, and luks-encrypted / Partitions**
|
||||
|
||||
1. Wipe any leftover filesystem metadata with `wipefs`.
|
||||
```console
|
||||
wipefs --all /dev/sdx
|
||||
```
|
||||
1. Create a new GPT partition table.
|
||||
```console
|
||||
sgdisk /dev/sdx -o
|
||||
```
|
||||
1. Create an efi partition of 512MB by specifying the end of the partition (relative) and the partition type, `ef00`.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 1::+512MiB -t 1:ef00
|
||||
```
|
||||
1. Create a `/boot` partition of 1GB, by specifying the end of the partition (relative), but not specifying the partition type which defaults to `8300`.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 2::+1GiB
|
||||
```
|
||||
1. Create an `/` partition using the remainder of the disk, by not specifying the end or the beginning or partition type, which defaults to `8300`.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 3
|
||||
```
|
||||
1. Format the efi partition fat 32.
|
||||
```console
|
||||
mkfs.vfat -F32 /dev/sdx1
|
||||
```
|
||||
1. Format the `/boot` partition ext4.
|
||||
```console
|
||||
mkfs.ext4 /dev/sdx2
|
||||
```
|
||||
1. Encrypt the `/` partition.
|
||||
```console
|
||||
cryptsetup -y -v luksFormat --type luks2 /dev/sdx3
|
||||
```
|
||||
1. Decrypt the `/` device.
|
||||
```console
|
||||
cryptsetup open /dev/sdx3 cryptroot
|
||||
```
|
||||
1. Format the `/` device.
|
||||
```console
|
||||
mkfs.xfs /dev/mapper/cryptroot
|
||||
```
|
||||
## **What About Swap?**
|
||||
I prefer to use a swap file inside the luks-encrypted / partition. But you can make a separate swap partition if you like.
|
||||
## **Example with 2GB swap partition**
|
||||
|
||||
1. Wipe the disc.
|
||||
```console
|
||||
wipefs --all /dev/sdx
|
||||
```
|
||||
1. Create a new GPT partition table.
|
||||
```console
|
||||
sgdisk /dev/sdx -o
|
||||
```
|
||||
1. Create an EFI partition.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 1::+512MiB -t 1:ef00
|
||||
```
|
||||
1. Create a `/boot` partition.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 2::+1GiB
|
||||
```
|
||||
1. Create a `/` partition with a relative negative end.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 3::-2GiB
|
||||
```
|
||||
1. Create a swap partion type `8200`.
|
||||
```console
|
||||
sgdisk /dev/sdx -n 4 -t 4:8200
|
||||
```
|
||||
1. format the partitions.
|
||||
```console
|
||||
mkfs.vfat -F32 /dev/sdx1
|
||||
mkfs.ext4 /dev/sdx2
|
||||
mkfs.xfs /dev/sdx3
|
||||
mkswap /dev/sdx4
|
||||
```
|
||||
## **Conclusion**
|
||||
|
||||
* Good luck to you.
|
||||
* Backup your data first.
|
||||
* Kind Regards, Trent
|
46
docs/posts/linux-move-cursor-with-keyboard.md
Normal file
46
docs/posts/linux-move-cursor-with-keyboard.md
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
title: "Linux Move Cursor With Keyboard"
|
||||
date: 2020-06-21T22:01:35-07:00
|
||||
draft: false
|
||||
tags: ["X11","xdotool","cursor","keyboard","keyboard shortcuts"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2020-06-21T22:01:35-07:00
|
||||
## **Introduction**
|
||||
Linux just makes everything so easy. On a laptop it can be tricky to place your
|
||||
mouse cursor on exactly the correct pixel, using the touchpad.
|
||||
This became apparent to myself while using GIMP to create some png button files
|
||||
for a little tkinter project, but there must be other use-cases as well.
|
||||
|
||||
## **xdo commands for moving the cursor**
|
||||
|
||||
* move the cursor one pixel left:
|
||||
```console
|
||||
xdotool mousemove_relative -- -1 0
|
||||
```
|
||||
* move the cursor one pixel right:
|
||||
```console
|
||||
xdotool mousemove_relative -- 1 0
|
||||
```
|
||||
* move the cursor one pixel up:
|
||||
```console
|
||||
xdotool mousemove_relative -- 0 -1
|
||||
```
|
||||
* move the cursor one pixel down:
|
||||
```console
|
||||
xdotool mousemove_relative -- 0 1
|
||||
```
|
||||
|
||||
## **map keyboard shortcuts**
|
||||
Now, in your keyboard settings, map the above commands to new custom shortcuts.
|
||||
For instance, I find the
|
||||
|
||||
++ctrl+super+arrow-up++
|
||||
|
||||
++ctrl+super+arrow-down++
|
||||
|
||||
++ctrl+super+arrow-left++
|
||||
|
||||
++ctrl+super+arrow-right++
|
||||
|
||||
combinations to be convenient in the Mate Desktop. Enjoy!
|
230
docs/posts/lmde3-xfs-full-disk-encryption.md
Normal file
230
docs/posts/lmde3-xfs-full-disk-encryption.md
Normal file
@ -0,0 +1,230 @@
|
||||
---
|
||||
title: "LMDE3 xfs Full Disk Encryption"
|
||||
date: 2019-01-25T23:25:36-08:00
|
||||
draft: false
|
||||
tags: ["linux-mint","disk-encryption"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-01-25T23:25:36-08:00
|
||||
## **Introduction**
|
||||
Linux Mint Debian Edition is the alternate version of Linux Mint, but built on a Debian base. The result is quite pleasant: the
|
||||
stability of desktop Debian, but with the rough edges polished smooth, nicely configured fonts and ui, and all the multi-media codecs included.
|
||||
|
||||
Unfortunately, the LMDE 3 installer does not support disk encryption, but manually setting this up by hand is pretty straightforward.
|
||||
On the other hand, manually setting up your partitions by hand allows extra freedom and flexibility,
|
||||
and so I have chosen a simple luks-encrypted `/` partition formatted xfs.
|
||||
|
||||
As far as swap is concerned, my preference is to use a swap file instead of a swap partition. Having a swap file instead of a swap partition is more flexible because obviously you can easily recreate a
|
||||
different size swap file whenever you like (or use none at all), and the encryption requires no extra set up because the `/` partition is encrypted anyway.
|
||||
|
||||
Will this work with a dual-boot set up? Of course! Because you have to manually configure the partitions anyway, just arrange them exactly how you would need for dual-boot.
|
||||
|
||||
Assumes uefi-configured boot, with separate partitions for `/boot` formatted ext4, `/boot/efi` formatted fat32, and a regular luks-encrypted partition for `/` formatted xfs.
|
||||
|
||||
## **Prepare The Installation Media**
|
||||
Visit the [Linux Mint Website](https://www.linuxmint.com/){target=_blank}
|
||||
and [download](https://www.linuxmint.com/edition.php?id=259){target=_blank} the iso file for LMDE 3 64bit. Download from torrents if possible, to save bandwidth.
|
||||
|
||||
* verify the sha256 sum of the iso file
|
||||
```console
|
||||
sha256sum lmde-3-201808-cinnamon-64bit.iso
|
||||
```
|
||||
|
||||
Identify the thumb drive you are going to install from.
|
||||
|
||||
* type `lsblk`, note the output, and then insert the thumb drive
|
||||
* then type `lsblk` again and note the *additional output*
|
||||
|
||||
```conf
|
||||
# lsblk /dev/sdb
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sdb 8:32 1 14.5G 0 disk
|
||||
├─sdb1 8:33 1 3.4G 0 part /media/trent/Debian 9.6.0 amd64
|
||||
└─sdb2 8:34 1 416K 0 part
|
||||
```
|
||||
|
||||
In the above example output we see that our thumb drive is identified as `/dev/sdb`, and partition `/dev/sdb1` is automatically mounted.
|
||||
|
||||
Take special care that you have accurately identified the thumb drive before proceeding. For the sake of example,
|
||||
we will proceed on the assumption that our thumb drive is identified as `/dev/sdb`, but you need to compensate accordingly.
|
||||
|
||||
* unmount any partition of the thumb drive that are automatically mounted
|
||||
```console
|
||||
umount /dev/sdb1
|
||||
```
|
||||
|
||||
* write the disk image to the thumb drive
|
||||
```console
|
||||
ddrescue -D --force lmde-3-201808-cinnamon-64bit.iso /dev/sdb
|
||||
```
|
||||
|
||||
## **Boot The Install Disc**
|
||||
* boot into bios to disable fastboot and secureboot
|
||||
* invoke your machine's device boot menu and boot the install disc in uefi mode
|
||||
* confirm that you have booted in uefi mode by listing efivars
|
||||
```console
|
||||
ls /sys/firmware/efi/vars
|
||||
```
|
||||
|
||||
## **Partition The Hard Drive**
|
||||
If you recall we are assuming the target hard drive is `/dev/sda`, as an example. So, make adjustments as necessary.
|
||||
|
||||
If you would rather use a different partition tool, make sure the efi partition is an efi partition type, and you definitely need a separate `/boot` partition.
|
||||
|
||||
1. if needed you can clear the drive with wipefs
|
||||
```console
|
||||
wipefs --all /dev/sda
|
||||
```
|
||||
1. create a new partition table for `/dev/sda`
|
||||
```console
|
||||
sgdisk /dev/sda -o
|
||||
```
|
||||
1. create a new efi partition for `/dev/sda`
|
||||
```console
|
||||
sgdisk /dev/sda --new=1::+512MiB --typecode=1:ef00
|
||||
```
|
||||
1. create a new `/boot` partition for `/dev/sda`
|
||||
```console
|
||||
sgdisk /dev/sda --new=2::+1G
|
||||
```
|
||||
1. create a new `/` partition for `/dev/sda`
|
||||
```console
|
||||
sgdisk /dev/sda --new=3
|
||||
```
|
||||
1. verify your partition work
|
||||
```console
|
||||
sgdisk /dev/sda -p
|
||||
```
|
||||
1. format the efi partition
|
||||
```console
|
||||
mkfs.vfat -F32 /dev/sda1
|
||||
```
|
||||
1. format the /boot partition
|
||||
```console
|
||||
mkfs.ext4 /dev/sda2
|
||||
```
|
||||
1. encrypt the `/` partition, you will be prompted for a password
|
||||
```console
|
||||
cryptsetup -y -v luksFormat --type luks2 /dev/sda3
|
||||
```
|
||||
1. decrypt the `/` partition, you will be prompted for a password
|
||||
```console
|
||||
cryptsetup open /dev/sda3 cryptroot
|
||||
```
|
||||
1. format the `/` device
|
||||
```console
|
||||
mkfs.xfs /dev/mapper/cryptroot
|
||||
```
|
||||
## **Mount The Hard Drive**
|
||||
This takes advantage of *expert mode* in the LMDE installer.
|
||||
|
||||
1. create an `/target` directory
|
||||
```console
|
||||
mkdir /target
|
||||
```
|
||||
1. mount the `/` device at `/target`
|
||||
```console
|
||||
mount /dev/mapper/cryptroot /target
|
||||
```
|
||||
1. create an `/target/boot` directory
|
||||
```console
|
||||
mkdir /target/boot
|
||||
```
|
||||
1. mount the `/boot` partition at `/target/boot`
|
||||
```console
|
||||
mount /dev/sda2 /target/boot
|
||||
```
|
||||
1. create an `/target/boot/efi` directory
|
||||
```console
|
||||
mkdir /target/boot/efi
|
||||
```
|
||||
1. mount the efi partition at `/target/boot/efi`
|
||||
```console
|
||||
mount /dev/sda1 /target/boot/efi
|
||||
```
|
||||
|
||||
## **Run The Installer App**
|
||||
At this point you're ready to run the live installer. You can click the disc icon on the desktop.
|
||||
|
||||
The first three pages of the live-installer cover Language,Timezone, and Keymap.
|
||||
The fourth page of the live-installer covers name, password, and hostname.
|
||||
On the fifth page of the live-installer, you come to a partition configuration page.
|
||||
But there is nothing to do, so select *expert mode* at the bottom of the page.
|
||||
|
||||
Again select *forward*, and when you come to the page where you configure the location
|
||||
to install grub, that should be the efi partition, i.e. `/dev/sda1`.
|
||||
|
||||
Select forward one more time, and then select install. The installation will run for a
|
||||
few minutes and will then pause. During the pause you need to manually configure `fstab` and `crypttab`.
|
||||
|
||||
## **Configure Fstab**
|
||||
|
||||
1. find the UUID of the efi partition
|
||||
```console
|
||||
blkid /dev/sda1 -s UUID
|
||||
```
|
||||
1. find the UUID of the `/boot` partition
|
||||
```console
|
||||
blkid /dev/sda2 -s UUID
|
||||
```
|
||||
1. find the UUID of the `/` device
|
||||
```console
|
||||
blkid /dev/mapper/cryptroot -s UUID
|
||||
```
|
||||
|
||||
And when you find the correct UUID numbers, use them to configure `/etc/fstab` which is actually currently at `/target/etc/fstab`.
|
||||
```conf
|
||||
# /etc/fstab
|
||||
###############
|
||||
# efi partition
|
||||
# run the command `blkid /dev/sda1 -s UUID` which outputs
|
||||
# /dev/sda1: UUID="17C4-215D", from which derive
|
||||
UUID=17C4-215D /boot/efi vfat defaults 0 2
|
||||
|
||||
# /boot partition
|
||||
# run the command `blkid /dev/sda2 -s UUID` which outputs
|
||||
# /dev/sda2: UUID="f2509fff-4854-4721-b546-0274c89e6aec", from which derive
|
||||
UUID=f2509fff-4854-4721-b546-0274c89e6aec /boot ext4 defaults 0 2
|
||||
|
||||
# "/" device
|
||||
# run the command `blkid /dev/mapper/cryptroot -s UUID` which outputs
|
||||
# /dev/mapper/cryptroot: UUID="72241377-cd65-43a6-8363-1afce5bd93f6", from which derive
|
||||
UUID=72241377-cd65-43a6-8363-1afce5bd93f6 / xfs defaults 0 1
|
||||
```
|
||||
|
||||
## **Configure Crypttab**
|
||||
But before the file systems can be mounted, `crypttab` needs to mount `/dev/sda3` at `/dev/mapper/cryptroot`.
|
||||
Configure `/etc/crypttab` which is actually currently at `/target/etc/crypttab`
|
||||
|
||||
1. find the UUID of the partition that will be mounted at `/dev/mapper/crypttab`
|
||||
```console
|
||||
blkid /dev/sda3 -s UUID
|
||||
```
|
||||
|
||||
And when you find the correct UUID number for `/dev/sda3`,
|
||||
use that to configure `/etc/crypttab` which is actually currently at `/target/etc/crypttab`.
|
||||
```conf
|
||||
# /etc/crypttab
|
||||
# run the command `blkid /dev/sda3 -s UUID` which outputs
|
||||
# /dev/sdb3: UUID="da3e0967-711f-4159-85ac-7d5743a75201", from which derive
|
||||
# <target name> <source device> <key file> <options>
|
||||
cryptroot UUID=da3e0967-711f-4159-85ac-7d5743a75201 none luks
|
||||
```
|
||||
|
||||
## **Resume Installer App**
|
||||
At this point finish running the live installer, and you'll be done.
|
||||
|
||||
## **UEFI Fix**
|
||||
On some machines, such as HP Laptops, UEFI is broken and efi boot entries don't persist.
|
||||
|
||||
1. remount the efi parition
|
||||
```console
|
||||
mount /dev/sda1 /mnt/ ; cd /mnt/EFI/
|
||||
```
|
||||
1. create a default efi executable
|
||||
```console
|
||||
mkdir BOOT ; cp linuxmint/grubx64.efi BOOT/BOOTX64.efi
|
||||
```
|
||||
|
||||
## **Optional Swap File**
|
||||
Visit the [Arch Wiki](https://wiki.archlinux.org/index.php/Swap#Swap_file){target=_blank} and they will hook you up.
|
33
docs/posts/rewrite-hugo-themes-report-in-python.md
Normal file
33
docs/posts/rewrite-hugo-themes-report-in-python.md
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
title: "Rewrite Hugo Themes Report in Python"
|
||||
date: 2019-01-25T01:02:57-08:00
|
||||
draft: false
|
||||
tags: ["python","sql","sqlalchemy","html5","hugo-themes"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-01-25T01:02:57-08:00
|
||||
|
||||
## **Ranking Hugo Themes by Stars, Commit Date**
|
||||
A while back I was grazing the selfhosted subreddit, and noticed Hugo coming up in conversation.
|
||||
I recalled that hugo requires a third-party theme in order to function. But was a bit of a challenge,
|
||||
because how do you know what is a good Hugo theme?
|
||||
|
||||
## **First Version in Bash**
|
||||
I ended up writing a little bash script (now deprecated) that scrapes the Github api and generates a little report about Hugo themes.
|
||||
It basically curled json from the Github api, and parsed it with grep, awk, and sed, and eventually spat out a plain text file.
|
||||
|
||||
## **Rewrite in Python**
|
||||
It was about a year later that I decided to rewrite the script in Python, using sqlite as a database.
|
||||
I discovered how to use the python requests module, got some practice with sqlite,
|
||||
and discovered how to make conditional request against the Github api using ETags and ‘If-Modified-Since’ (ETags are easier).
|
||||
|
||||
But this was my first time using python like this. And I have to tell you,
|
||||
**it’s a lot moar fun than recursive fibonacci tutorials!**
|
||||
|
||||
## **Building an HTML5 Table (bootstrap, actually)**
|
||||
By the time I had figured out how to collect the data I needed, I realized that I could simply generate an html table right in the python script.
|
||||
|
||||
`rank_hugo_themes.py` runs in a cronjob every night, and you can view
|
||||
[Hugo Themes Report](https://trentsonlinedocs.xyz/hugo-themes-report/hugo-themes-report.html){target=_blank} here.
|
||||
|
||||
And you can [see the script on Github](https://github.com/TrentSPalmer/hugo_themes_report){target=_blank}.
|
32
docs/posts/simplified-raspberry-streaming.md
Normal file
32
docs/posts/simplified-raspberry-streaming.md
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
title: "Simplified Raspberry Streaming"
|
||||
date: 2019-05-12T18:32:55-07:00
|
||||
draft: false
|
||||
tags: ["raspberrypi","mpd","mp3","internet-radio","ncmpcpp","playlist","m3u"]
|
||||
authors: ["trent"]
|
||||
---
|
||||
date: 2019-05-12T18:32:55-07:00
|
||||
## **RaspberryPi is a Great MPD Appliance**
|
||||
I’m really pleased with the [RaspberryPi](https://www.raspberrypi.org/){target=_blank} as an
|
||||
[MPD](https://en.wikipedia.org/wiki/Music_Player_Daemon){target=_blank} (music player daemon),
|
||||
appliance. I have it hooked up to the home surround-sound system via spdif,
|
||||
digital optical cable hat, btw, running
|
||||
[Arch Linux ARM](https://www.hifiberry.com/products/digiplus/){target=_blank}, with
|
||||
the `/` file system on a dual-thumbdrive,
|
||||
[btrfs raid1 (mirror) device](https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices){target=_blank}.
|
||||
|
||||
It plays music around the clock, reliably, without breaking a sweat.
|
||||
And the mpd daemon is easy to remote control,
|
||||
either from the command line with [ncmpcpp](https://github.com/arybczak/ncmpcpp){target=_blank},
|
||||
or using [M.A.L.P for Android](https://play.google.com/store/apps/details?id=org.gateshipone.malp&hl=en_US){target=_blank}.
|
||||
|
||||
## **And/Or as an Internet Radio Streaming Client**
|
||||
The beauty of this setup it in the simplicity. All you have to do is create an plain text *m3u
|
||||
file with the address:port of the internet radio stream you want,
|
||||
and place that in `/var/lib/mpd/playlists` directory.
|
||||
|
||||
You can find various internet radio lists on the internet, and many offer
|
||||
example *m3u playlist files that you can download. However, the important thing
|
||||
is that your m3u playlist file has to contain the exact streaming address,
|
||||
so if the m3u file you download points to a pls file,
|
||||
you may have to download that pls file to look for the streaming address.
|
Reference in New Issue
Block a user