Initial commit of site with new terminal theme
This commit is contained in:
commit
a3cb590d26
37 changed files with 1534 additions and 0 deletions
23
content/posts/cuda_on_void.md
Normal file
23
content/posts/cuda_on_void.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: "Getting CUDA toolkit installed on Void Linux"
|
||||
date: 2025-04-15T10:45:26-04:00
|
||||
---
|
||||
|
||||
This is a short post (mainly for myself) to remember how I got CUDA installed on Void Linux.
|
||||
These steps are as follows:
|
||||
|
||||
1. **Download the installation files:** Go to the CUDA toolkit installation website. Select Linux->x86_64->Debian->11->runfile (local)
|
||||
2. **Set executable permission:** `chmod +x ./cuda_version.run`
|
||||
3. **Install using the correct flags:**
|
||||
```bash
|
||||
sudo ./cuda_11.8.0_520.61.05_linux.run --silent --override --toolkit --no-opengl-libs --tmpdir=/home/aselimov/down/tmp
|
||||
```
|
||||
4. **Add to path:** Build should now be installed at /usr/local/cuda-version. Add the following to your bashrc or zshrc:
|
||||
```bash
|
||||
export PATH="$PATH:/usr/local/cuda-version/bin"
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-version/lib64"
|
||||
```
|
||||
|
||||
The reason I had to add the `--tmpdir` command was because I was getting an error message about the default `tmp` directory not having enough space.
|
||||
Hopefully this helps someone else out!
|
||||
|
171
content/posts/gitea.md
Normal file
171
content/posts/gitea.md
Normal file
|
@ -0,0 +1,171 @@
|
|||
---
|
||||
title: "Hosting your own git frontend service using Gitea"
|
||||
date: 2023-02-25T10:19:50-05:00
|
||||
topics: ['git', 'self-host']
|
||||
---
|
||||
|
||||
I recently had interest in starting to work on the implementation of the [Concurrent Atomistic-Continuum Method](https://doi.org/10.1063/1.5099653) using C++ to take advantage of GPU acceleration.
|
||||
As a first step, I began thinking about where I wanted to host my project.
|
||||
I decided to add hosting my own git server to my list of self-hosted services, including [e-mail](https://github.com/LukeSmithxyz/emailwiz) and [matrix chat server](https://matrix.org/docs/projects/server/synapse).
|
||||
This is a quick guide on how I set up [Gitea](https://gitea.io/en-us/) and configured it on my website.
|
||||
**As a note, my web server is a Debian machine using Nginx**
|
||||
|
||||
## Setting up the database
|
||||
|
||||
I already use [PostgreSQL](https://www.postgresql.org/) to manage my matrix-synapse database and configured Gitea to use the same.
|
||||
First, following the [Gitea documentation](https://docs.gitea.io/en-us/database-prep/#postgresql-1), I set the `listen_address` and `password_encryption` in my `postgresql.conf` at `/etc/postgresql/11/main/postgresql.conf`:
|
||||
|
||||
```
|
||||
listen_addresses = 'localhost, 203.0.113.3'
|
||||
password_encryption = scram-sha-256
|
||||
```
|
||||
|
||||
You should then restart PostgreSQL.
|
||||
Now you can log into the database console:
|
||||
|
||||
```
|
||||
su -c "psql" - postgres
|
||||
```
|
||||
|
||||
Then create a database user, gitea:
|
||||
|
||||
```
|
||||
CREATE ROLE gitea WITH LOGIN PASSWORD '{ReplaceWithStrongPassword}';
|
||||
```
|
||||
|
||||
Then you can actually create your gitea database:
|
||||
|
||||
```
|
||||
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
|
||||
```
|
||||
|
||||
The last step is adding authentication rules to your `pg_hba.conf` at `/etc/postgresql/11/main/pg_hba.conf`.
|
||||
**As a note, the following line should be added near the top of this file as authentication rules are evaluated sequentially.
|
||||
As a result, any generic rule at the top of this file may be used instead of the inserted rule if not inserted first.**
|
||||
|
||||
```
|
||||
local giteadb gitea scram-sha-256
|
||||
```
|
||||
|
||||
## Installing and setting up gitea
|
||||
|
||||
Since my server is on debian, I didn't have access to a gitea package.
|
||||
Instead, I downloaded the executable:
|
||||
|
||||
```
|
||||
wget -O gitea https://dl.gitea.com/gitea/1.18.5/gitea-1.18.5-linux-amd64
|
||||
chmod +x gitea
|
||||
```
|
||||
|
||||
You should then create a git user account on your server:
|
||||
|
||||
```
|
||||
adduser \
|
||||
--system \
|
||||
--shell /bin/bash \
|
||||
--gecos 'Git Version Control' \
|
||||
--group \
|
||||
--disabled-password \
|
||||
--home /home/git \
|
||||
git
|
||||
```
|
||||
|
||||
A few directories need to be created for gitea and file permissions set:
|
||||
|
||||
```
|
||||
mkdir -p /var/lib/gitea/{custom,data,log}
|
||||
chown -R git:git /var/lib/gitea/
|
||||
chmod -R 750 /var/lib/gitea/
|
||||
mkdir /etc/gitea
|
||||
chown root:git /etc/gitea
|
||||
chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
You can then copy gitea to a directory on your path, i.e.:
|
||||
|
||||
```
|
||||
cp gitea /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
The last step for setting up gitea is downloading the [example systemd service file](https://github.com/go-gitea/gitea/blob/main/contrib/systemd/gitea.service) and placing that in `/etc/systemd/system`.
|
||||
At this point you should be able to enable and start the service:
|
||||
|
||||
```
|
||||
sudo systemctl enable gitea
|
||||
sudo systemctl start gitea
|
||||
```
|
||||
|
||||
## Gitea and Nginx configuration
|
||||
|
||||
There are a few configurations options you need to set for Gitea and Nginx that I'll outline here.
|
||||
First as a note, I wanted my git server to be accessible at [alexselimov.com/git](alexselimov.com/git).
|
||||
It's possible to set gitea up as a subdomain, i.e. `git.some.site`, but I won't go into that.
|
||||
First you want to configure nginx so you can access your Gitea instance.
|
||||
You can also simply go to `your.web.site:3000` to skip the Nginx configuration.
|
||||
Adding Gitea at `your.web.site/git` is extremely simple and if you have SSL certificates with certbot, access to your Gitea instance will also occur over HTTPS.
|
||||
All you have to do is add:
|
||||
|
||||
```
|
||||
location /git/{
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
```
|
||||
in your primary server block for your website.
|
||||
Now if you restart Nginx you should be able to navigate to `your.web.site/git`.
|
||||
The first time you access your Gitea instance, it will ask you several configuration questions which then populate the default configuration file for Gitea that you can then adjust.
|
||||
Answer to the best of your knowledge and then we will go over the most important ones in your configuration file.
|
||||
|
||||
Gitea configurations are available in the `/etc/gitea/app.ini` file.
|
||||
You want to double check that your `[database]` section is correct, especially the `NAME` variable.
|
||||
|
||||
```
|
||||
[database]
|
||||
DB_TYPE = postgres
|
||||
HOST = 127.0.0.1
|
||||
NAME = giteadb
|
||||
USER = gitea
|
||||
PASSWD = '{SOME SECURE PASSWORD}'
|
||||
```
|
||||
|
||||
If you want you can set your default branch name in the `[repository]` section:
|
||||
|
||||
```
|
||||
[repository]
|
||||
DEFAULT_BRANCH = master
|
||||
```
|
||||
|
||||
Finally to make sure your site works properly, you want to go to your `[server]` section and make sure that `[SSH_DOMAIN]` is set to the domain that you use to ssh into your server.
|
||||
For example, I ssh into [alexselimov.com](alexselimov.com) so my `app.ini` has:
|
||||
|
||||
```
|
||||
[server]
|
||||
SSH_DOMAIN = alexselimov.com
|
||||
```
|
||||
|
||||
Your `ROOT_URL` should however be set to the url that maps to your Gitea instance, i.e.,
|
||||
|
||||
```
|
||||
ROOT_URL = https://alexselimov.com/git
|
||||
```
|
||||
|
||||
To finish setting up ssh, you just have to add your public key to your user account in the Gitea under settings->SSH/GPG keys.
|
||||
Then as site admin you have to go to the Site Administration menu and run the "Update the '.ssh/authorized_keys' file with Gitea SSH keys." option.
|
||||
At this point you should be good to go with Gitea and using ssh to access your repositories.
|
||||
The final option I though was useful was:
|
||||
|
||||
```
|
||||
[sevice]
|
||||
DISABLE_REGISTRATION = true
|
||||
```
|
||||
|
||||
I am making this repo for personal use.
|
||||
Disabling registration still allows people to clone my public repositories, but I want to be sure that I screen potential contributors or other people that can have accounts on my instance.
|
||||
|
||||
## Conclusion
|
||||
|
||||
I hope these instructions were useful to someone, let me know if I missed a step or got something wrong and I'll be sure to correct it. Thanks for reading!
|
89
content/posts/highlighedmenu.md
Normal file
89
content/posts/highlighedmenu.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
title: "Highlighting the active menu item in Hugo"
|
||||
date: 2023-07-03T22:19:00-04:00
|
||||
topics: ['hugo','web design']
|
||||
---
|
||||
|
||||
I've recently been developing sites for some family/friends.
|
||||
I had one person request highlighting the currently selected menu item.
|
||||
I had built a custom theme which used a navbear defined in the site wide `hugo.toml`.
|
||||
There were a few different solutions but I wanted to highlight the solution I ended up using for my use case.
|
||||
A dummy of my site directory set up is:
|
||||
|
||||
```
|
||||
content
|
||||
|-- section1
|
||||
|--_index.md
|
||||
|--section1Post.md
|
||||
|-- section2
|
||||
|--_index.md
|
||||
|--section2Post.md
|
||||
|-- section3
|
||||
|--_index.md
|
||||
```
|
||||
|
||||
In my header partial I created a menu by looping over the entries in `[[menu.main]]` defined in the `hugo.toml`.
|
||||
It's important here to end the `url` with a `/`.
|
||||
Hugo adds an ending `/`, to the urls of the pages that it creates.
|
||||
While this might not be necessary to make the hyperlink work, it will be necessary to get the highlighting correct.
|
||||
The definition of the menu looks like:
|
||||
|
||||
```
|
||||
[menu]
|
||||
[[menu.main]]
|
||||
name= "section1"
|
||||
url= "/section1/"
|
||||
weight= "1"
|
||||
[[menu.main]]
|
||||
name= "section2"
|
||||
url= "/section2/"
|
||||
weight= "2"
|
||||
[[menu.main]]
|
||||
name= "section3"
|
||||
url= "/section3/"
|
||||
weight= "3"
|
||||
```
|
||||
|
||||
The original header partial is pretty simple.
|
||||
I just loop over the range `.Site.Menus.main` and insert a `<div class="item">` which is my div class for a navbar menu item.
|
||||
I populate the text and link from the variables associated with the main menu item.
|
||||
This is all wrapped within a `<nav>` element with other items and stylings that create the overall navigation menu.
|
||||
The loop for insertion of menu items is below:
|
||||
|
||||
```
|
||||
{{ range .Site.Menus.main }}
|
||||
<div class="item">
|
||||
<a href="{{ .URL }}">
|
||||
{{ $text := print .Name | safeHTML }}
|
||||
{{ $text }}
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
As I mentioned before, there were a few different solutions but the one I went with was to save the menu item url and the current page url into two separate variables.
|
||||
**I can then compare these to determine whether the current page corresponds to a menu item and if so I change the class of the div from a normal menu item to the activated menu item class.**
|
||||
This concept can be seen in action in the following code snippet:
|
||||
|
||||
```
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ $menu_item_url := .URL | relLangURL }}
|
||||
{{ $page_url:= $currentPage.RelPermalink | relLangURL }}
|
||||
<div
|
||||
{{ if eq $menu_item_url $page_url }}
|
||||
class="active-item"
|
||||
{{else}}
|
||||
class="item"
|
||||
{{ end }}
|
||||
>
|
||||
<a href="{{ .URL }}">
|
||||
{{ $text := print .Name | safeHTML }}
|
||||
{{ $text }}
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
I hope that this is helpful to somebody else as it took me a decent amount of time to try the different recommended methods before I found this one.
|
||||
As always shoot me an email if you have any thoughts or comments!
|
40
content/posts/java_dev_problems.md
Normal file
40
content/posts/java_dev_problems.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: "Solutions to problems with Java Development"
|
||||
date: 2024-05-12T20:03:17-04:00
|
||||
topics: ['Java', 'software development', 'Neovim']
|
||||
---
|
||||
|
||||
I recently ran into some problems with java development.
|
||||
One problem was neovim specific but the other was an issue with gradle.
|
||||
I wanted to document these in case any one else has similar problems as it took me a little bit of time to figure out.
|
||||
|
||||
## Problem 1: jdtls exiting with status code 13
|
||||
|
||||
I use jdtls through Mason with the built in nvim LSP and was recently having an issue where jdtls would immediately crash when opening a file.
|
||||
The solution to this problem was just deleting the cache for jdtls:
|
||||
|
||||
```sh
|
||||
rm ~/.cache/jdtls
|
||||
```
|
||||
|
||||
**Edit 05/14/2024**: This also solves the problem of jdtls not attaching on neovim startup.
|
||||
May solve other problems as well, so should be first thing to try if jdtls isn't working.
|
||||
|
||||
## Problem 2: Could not set executable permissions for .gradle
|
||||
|
||||
When attempting to build with a gradlew script I was running into the following error:
|
||||
|
||||
*Could not set executable permissions for: ~/.gradle/wrapper/dists/gradle-7.6-bin/9l9tetv7ltxvx3i8an4pb86ye/gradle-7.6/bin/gradle*
|
||||
|
||||
After spending some time trying to find a solution, I found a suggestion of setting an environment variable:
|
||||
|
||||
```sh
|
||||
export JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork"
|
||||
```
|
||||
|
||||
The above environment variable was all I needed and the gradle script was able to assemble the project successfully.
|
||||
Hopefully this is helpful to someone!
|
||||
|
||||
|
||||
|
||||
|
48
content/posts/leaving_artix_for_void.md
Normal file
48
content/posts/leaving_artix_for_void.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
title: "Why I left Artix for Void Linux"
|
||||
date: 2024-01-05T21:46:58-05:00
|
||||
topics: ['Artix', 'Void Linux', 'Linux', 'Opinions']
|
||||
---
|
||||
|
||||
This is going to be primarily opinion based post but I want to talk about a shakeup that has happened.
|
||||
I have uninstalled Artix from all of my computers and have instead swapped them to Void Linux.
|
||||
This is the first time I have changed Linux distros in about 3/4 years and was done with a heavy heart as having to setup a new system is always a pain.
|
||||
Regardless I have been using void linux for about 2-3 months and I am finding it a much better experience than Artix, and I want to discuss the reasons why below.
|
||||
|
||||
## Problems with Artix
|
||||
|
||||
The biggest reason for me leaving Artix was an issue of stability/compatibility.
|
||||
I have a [previous post](/posts/valgrind-artix-linux/) describing one issue that I ran into regarding incompatibility between the Artix debuginfod server and their shipped glibc version.
|
||||
In general, after 2/3 years Artix gives me the impression of simply a patched version of Arch linux to remove systemd instead of it's own OS.
|
||||
Package compatibility sometimes has issues when Arch linux core repositories move slightly ahead of Artix linux core repositories.
|
||||
For the most part, Artix Linux ran very well but towards the end of my time with it I found significant accumulated debt on my system with mixtures of Artix and Arch packages which lead to annoying configuration problems that took way too much time to fix.
|
||||
After being unsuccessful in addressing some issues and with fresh installs for some reason having issues on my systems, I decided I need to figure out something new.
|
||||
|
||||
## Void Linux saves the day
|
||||
|
||||
This is when Void Linux came in to save the day.
|
||||
I find that void offers a few benefits over Artix Linux:
|
||||
|
||||
- **Stability**- VoidLinux in my experience has been much more stable over updates than either Artix or Arch.
|
||||
- **Vision** - Not sure if vision is the right word, but void linux is an independent OS not forked from any other. As a result the OS feels more cohesive as it doesn't have to deal with conflicting visions.
|
||||
- **Package Manger** - XBPS is an extremely fast and easy to use package manager.
|
||||
- **Init System** - runit was my preferred init system on Artix, and finding an OS which defaults to runit is a positive indication for me.
|
||||
|
||||
The obvious issues with void are:
|
||||
|
||||
- No AUR
|
||||
- Less documentation, arch linux guide works most but not all of the times
|
||||
|
||||
I've found that in practice, I do not significantly miss the AUR as any software I need is packaged in the void repositories.
|
||||
For the very rare cases that the software I need is not packaged, I can just clone the software repo and build/install from source.
|
||||
The documentation factor is a little bit of a bigger deal.
|
||||
There have been a few cases where I've spent far too much time trying to address some seemingly basic configuration because of lack of documentation.
|
||||
This doesn't bother me as much as the issues I had with Artix as the time I spent is learning how to use Void Linux, familiarity with your tools, as opposed to trying to bandage broken systems.
|
||||
If you install a desktop environment such as KDE or Gnome, you probably won't run into this issue as much as I did.
|
||||
|
||||
## Overall I find that the following meme captures my current feelings pretty well:
|
||||
|
||||
{{< img src="/img/friendship_meme.webp" width="100%" max-width="500px" >}}
|
||||
|
||||
**Hopefully this is helpful to someone else as I personally have not regretted my switch for a moment.**
|
||||
|
245
content/posts/mobile_navbar.md
Normal file
245
content/posts/mobile_navbar.md
Normal file
|
@ -0,0 +1,245 @@
|
|||
---
|
||||
title: "Developing a mobile-friendly navigation menu for your website"
|
||||
date: 2023-02-13T11:13:34-05:00
|
||||
toc: true
|
||||
topics: ["web design", "css", "javascript"]
|
||||
---
|
||||
|
||||
I personally am a big fan of navbars as they are a clean way to navigate any website.
|
||||
The classic navbar, that you are likely seeing on this site if you are viewing this on a desktop browser, is extremely simple to make and you can easily find guides to develop these.
|
||||
The one I personally used is [here](https://www.w3schools.com/howto/howto_css_dropdown_navbar.asp).
|
||||
What was not as simple for me was creating a decent navbar for mobile.
|
||||
I had to develop it for a site that I was working on for my church that never concluded development.
|
||||
I copied it over to my personal site and learned a lot in the process of developing it so all was not wasted.
|
||||
It did however end up taking me way more time than it should have and in the hopes of saving some other poor soul some time, I decided to write an article about how I did it on my site.
|
||||
|
||||
**If you want to check out how it looks like on my site before we get started, just shrink the width of your browser!**
|
||||
|
||||
|
||||
## Fundamental approach
|
||||
|
||||
I decided that the simplest way to do what I wanted, was to design two completely separate navigation bars.
|
||||
One is used for larger screen widths while the other is used for smaller screen widths.
|
||||
This might not be the most elegant method but it certainly is simple.
|
||||
The `<nav class="primary">`, which is the default navigation bar, is therefore styled using the following code (excluding all actual styling code):
|
||||
|
||||
```
|
||||
nav.primary{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px){
|
||||
nav.primary{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now that we have briefly touched the primary navigation bar, let's move on to styling the mobile navigation bar.
|
||||
|
||||
## Designing a mobile navigation bar
|
||||
|
||||
The mobile navigation menu that I am using is simple.
|
||||
What I wanted was a menu with items that would reveal itself after the user clicks the hamburger menu icon.
|
||||
To start, we need to style a menu that is hidden.
|
||||
The CSS for this menu is:
|
||||
|
||||
```
|
||||
nav.mobile{
|
||||
transition: left 0.4s ease;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: -50%;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
background: #665c54;
|
||||
z-index: 9999;
|
||||
}
|
||||
```
|
||||
|
||||
The `z-index`, `height`, `top`, `width`, and `background` properties create a rectangular block that is laid over the site.
|
||||
The `transition` property allows for smooth sliding when we move this element around when we open the menu.
|
||||
The final important property here is that we set `left:-50%` to hide the menu.
|
||||
We can then easily add items to this menu using a list, or just an item div (which is what I prefer) i.e.
|
||||
|
||||
```
|
||||
nav.mobile .mobile-item{
|
||||
margin: 20px 10px;
|
||||
}
|
||||
```
|
||||
|
||||
## Creating a hamburger menu icon to open our menu
|
||||
|
||||
Now we need an icon that we can click to open our menu.
|
||||
It turns out that it is possible to create a hamburger menu just using html and CSS.
|
||||
We won't need Font Awesome for this.
|
||||
The html code for the hamburger menu is:
|
||||
|
||||
```
|
||||
<div class="hamburger" id="Ham">
|
||||
<div class = "bars" >
|
||||
<span class="bar"></span>
|
||||
<span class="bar"></span>
|
||||
<span class="bar"></span>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
We put our `<span class='bar'>` inside of a `<div class = "hamburger">`.
|
||||
By default we have `<div class="hamburger"` hidden while the `<span class="bar">` is what actually forms the icon.
|
||||
The CSS code for this is:
|
||||
|
||||
```
|
||||
.hamburger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bar {
|
||||
display: block;
|
||||
width: 25px;
|
||||
height: 3px;
|
||||
margin: 5px auto;
|
||||
-webkit-transition: all 0.3s ease-in-out;
|
||||
transition: all 0.3s ease-in-out;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.bars{
|
||||
display : block;
|
||||
position: absolute;
|
||||
top: 20%;
|
||||
left: 20%;
|
||||
}
|
||||
```
|
||||
|
||||
I was not able to create a close symbol that looked nice so I ended up using Font Awesome as shown below:
|
||||
|
||||
```
|
||||
html:
|
||||
<div class = "hamburger">
|
||||
....
|
||||
<div class = "close">
|
||||
<i class="fa-solid fa-xmark fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
CSS:
|
||||
close{
|
||||
display: none;
|
||||
}
|
||||
```
|
||||
|
||||
It should be noted that `<div class="hamburger">`, contains both `<div class="bars">` and `<div class="close">`.
|
||||
This icon is activated at smaller screen sizes, i.e.
|
||||
|
||||
```
|
||||
@media screen and (max-width: 768px) {
|
||||
.hamburger{
|
||||
display: block;
|
||||
margin: 20px 0;
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
left: 45px;
|
||||
height: 45px;
|
||||
width: 45px;
|
||||
text-align: center;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
transition: left 0.4s ease;
|
||||
background-color: #696969;
|
||||
z-index: 9999;
|
||||
}
|
||||
```
|
||||
|
||||
## Opening the menu using javascript
|
||||
|
||||
Now that we have a hidden menu and the hamburger icon to open it, we need to add a javascript function that activates on click.
|
||||
I won't describe how to link .js files, this is a pretty simple thing to look up.
|
||||
To enable our responsive menu, we need one javascript function described below.
|
||||
|
||||
```
|
||||
/* Toggle between adding and removing the "responsive" class to
|
||||
the nav when the user clicks on the icon */
|
||||
|
||||
function myFunction() {
|
||||
var x = document.getElementById("Nav");
|
||||
if (x.className === "primary") {
|
||||
x.className += " responsive";
|
||||
} else {
|
||||
x.className = "primary";
|
||||
}
|
||||
var x = document.getElementById("Ham");
|
||||
if (x.className === "hamburger") {
|
||||
x.className += " responsive";
|
||||
} else {
|
||||
x.className = "hamburger";
|
||||
}
|
||||
|
||||
var children = x.children;
|
||||
if (children[0].className === "bars") {
|
||||
children[0].className += " responsive";
|
||||
} else {
|
||||
children[0].className = "bars";
|
||||
}
|
||||
if (children[1].className === "close") {
|
||||
children[1].className += " responsive";
|
||||
} else {
|
||||
children[1].className = "close";
|
||||
}
|
||||
|
||||
var x = document.getElementById("Navmobile");
|
||||
if (x.className === "mobile") {
|
||||
x.className += " responsive";
|
||||
} else {
|
||||
x.className = "mobile";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
This function simply toggles the class of the divs that comprise our mobile navigation menu.
|
||||
By default, these divs start out with just a `mobile` class.
|
||||
This function then adds the `responsive` class when called.
|
||||
If the class already has the `responsive` class, it removes it.
|
||||
We can then define additional styling for the `responsive` elements.
|
||||
The most obvious step of opening the menu can be done simply by setting the left margin to 0, i.e:
|
||||
|
||||
|
||||
```
|
||||
nav.mobile.responsive {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
As a note we also want to adjust the hamburger menu to a red close symbol by changing the position and color of the menu and also setting display none to the bars which make up the original hamburger menu.
|
||||
|
||||
```
|
||||
.hamburger.responsive{
|
||||
left: 55%;
|
||||
cursor: pointer;
|
||||
background-color: #ff6347;
|
||||
}
|
||||
|
||||
.bars.responsive{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.close.responsive{
|
||||
display: block;
|
||||
color: #FFF;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 10px;
|
||||
}
|
||||
```
|
||||
|
||||
I am certainly not an expert in javascript and am self-taught in html and css so this code might not be optimized, but it gets the job done and makes me happy!
|
||||
|
||||
## Conclusion
|
||||
|
||||
Hopefully this is helpful to someone.
|
||||
I figure I'm probably just tossing this into the void but maybe it will end up being useful to someone.
|
||||
If you have any comments or find any errors shoot me an email!
|
||||
Would love to know if anyone actually is using this stuff.
|
69
content/posts/pull_files_into_submodule.md
Normal file
69
content/posts/pull_files_into_submodule.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: "Separate files from git repo into a submodule"
|
||||
date: 2023-02-22T20:31:34-05:00
|
||||
topics: ["git", "software development"]
|
||||
---
|
||||
|
||||
I recently had a situation where a library I was working on, originally as part of one project, was going to be needed for another project.
|
||||
The ideal way to handle this situation, is to have the library files as their own git repo which is then added to the projects as a submodule.
|
||||
This way any changes required to the submodule for the needs of each project can be shared easily.
|
||||
It took me much longer than I would've liked to, but I finally managed to find the solution and wanted to share it with anyone else who might need it.
|
||||
|
||||
|
||||
Assume I have a git repo as below:
|
||||
|
||||
```
|
||||
test
|
||||
├── README.md
|
||||
├── main.cpp
|
||||
├── test.cpp
|
||||
└── test.h
|
||||
```
|
||||
|
||||
If I wanted to pull out the test.cpp and test.h files on their own with all the history for only those commits, the command is:
|
||||
|
||||
```
|
||||
$ git filter-branch --force --prune-empty --index-filter \
|
||||
'git rm --cached --ignore-unmatch $(git ls-files | grep -v "test.h\|test.cpp")'
|
||||
```
|
||||
|
||||
A couple notes should be mentioned.
|
||||
First when you run the git filter-branch command it will give you a message saying that you shouldn't use filter-branch and should instead use filter-repo.
|
||||
I don't know how to do this with filter-repo and didn't have the time to figure it out.
|
||||
The `--prune-empty` flag deletes all the commits that aren't associated with the files of interest so that you don't have to do a rebase.
|
||||
Finally to specify the files you want, you need to pass them to the grep command as:
|
||||
|
||||
```
|
||||
grep -v "file1\|file2\|file3"
|
||||
```
|
||||
|
||||
The `-v` flag inverts the match, returning all files to the `git rm` command which don't match the files you specify.
|
||||
The file names must be separated with `\|` for matching multiple different tokens.
|
||||
Once this command completes, you should be left with just the files of interest and the associated history.
|
||||
All that's left is simply setting a new remote url and then push, i.e.
|
||||
|
||||
```
|
||||
$ git remote set-url origin submodule.git.url
|
||||
$ git push
|
||||
```
|
||||
|
||||
**Final Important Note:** If this goes wrong you may get worried as all of your git history is wiped out.
|
||||
To fix this you can use `git reflog`.
|
||||
If you run `git reflog` after you mess up the `git filter-branch` you should see something like this (dummy commits from my fake repo):
|
||||
|
||||
```
|
||||
$ git reflog
|
||||
790c883 (HEAD -> master) HEAD@{0}: filter-branch: rewrite
|
||||
3b3c8b8 HEAD@{1}: commit: Update test library
|
||||
93cfbd4 HEAD@{2}: commit: Add main function
|
||||
18259bc HEAD@{3}: commit: README update
|
||||
aba8323 HEAD@{4}: commit: init test files
|
||||
```
|
||||
|
||||
You can then reset your git repo to a state before your filter branch command by running:
|
||||
|
||||
```
|
||||
$ git reset --hard HEAD@{1}
|
||||
```
|
||||
|
||||
Hopefully this helps someone out!
|
39
content/posts/thoughts_on_rust.md
Normal file
39
content/posts/thoughts_on_rust.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: "Rust is pretty good (Short thoughts on Rust)"
|
||||
date: 2024-04-09T21:31:01-04:00
|
||||
topics: ['rust', 'Opinions', 'software development']
|
||||
---
|
||||
|
||||
In my current position I've had to swap to full time Rust development.
|
||||
After about 2 months of full time Rust development I think I'll likely be developing projects in Rust in the future instead of C++ when performance is important.
|
||||
My reasons for this are primarily:
|
||||
|
||||
1. Just Works™ build system and crates.io makes drawing in libraries painless
|
||||
2. Guaranteed memory safety is pretty nice
|
||||
3. Syntax is much cleaner and succinct than C++, with lots of nice syntax sugar to sweeten the package
|
||||
4. Easily integrable with C (and therefore C++ with some massaging)
|
||||
5. Proc macros are pretty nice as well
|
||||
6. Built-in test framework
|
||||
|
||||
I think that point 3 is potentially the biggest factor for me as the C++ modern syntax is not what I would consider clean, especially if you are trying to use a more functional programming style.
|
||||
A simple example highlighting the difference:
|
||||
|
||||
**C++**
|
||||
```c++
|
||||
vector<int> v(10,1);
|
||||
std::transform(v.cbegin(), v.cend(), v.begin(), [](int value){ value + 1;})
|
||||
```
|
||||
|
||||
**Rust**
|
||||
```rust
|
||||
let v = vec![1;10];
|
||||
let v = v.map(|val| val + 1).collect()
|
||||
```
|
||||
**I think that speaks for itself...**(Although I prefer the C++ lambdas which don't auto capture)
|
||||
|
||||
I'm not sure that I consider myself a Rustacean though as some seemingly simple programming tasks can become huge mountains due to the borrow rules Rust enforces.
|
||||
Once you learn the borrow rules and some of the tricks, the language itself ends up being very clean to write and easy to test.
|
||||
I probably won't be writing C++ in the future unless I have a very specific/niche reason to.
|
||||
I recommend checking Rust out if you haven't yet, it may surprise you!
|
||||
|
||||
|
95
content/posts/tmux_and_nvim.md
Normal file
95
content/posts/tmux_and_nvim.md
Normal file
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
title: "My nvim/tmux workflow"
|
||||
date: 2024-03-04T21:44:00-05:00
|
||||
topics: [software development, neovim, tmux]
|
||||
---
|
||||
|
||||
At my previous employment I was forced to use a windows system.
|
||||
Although not ideal, I was able to continue using my Linux terminal workflows by heavily utilizing Windows Subsystem for Linux.
|
||||
As part of this I had to get comfortable with integrating tmux into my workflow as I didn't care to learn the Windows Terminal options for terminal multiplexing.
|
||||
I don't need tmux quite as much anymore since my current employer allows me run Linux on my development machine, but I still use it when remoting into my work desktop via ssh.
|
||||
Hopefully this can be of use in improving the efficiency of others that depend on terminal based workflows.
|
||||
|
||||
## tmux setup
|
||||
|
||||
As a note, all of the below settings should be added to your `~/.tmux.conf` if you are interested in using them.
|
||||
### Some nice settings
|
||||
|
||||
I wanted to start out with some nice settings for tmux that I generally like.
|
||||
First and foremost I remap the `send-prefix` key.
|
||||
|
||||
```tmux
|
||||
unbind C-b
|
||||
set -g prefix C-p
|
||||
bind C-p send-prefix
|
||||
```
|
||||
|
||||
I also rebind the pane splitting commands:
|
||||
|
||||
```tmux
|
||||
bind | split-window -h -c "#{pane_current_path}"
|
||||
bind - split-window -v -c "#{pane_current_path}"
|
||||
unbind '"'
|
||||
unbind %
|
||||
```
|
||||
|
||||
And finally, I enable vim key binds in scrolling mode
|
||||
|
||||
```tmux
|
||||
set-window-option -g mode-keys vi
|
||||
bind-key -T copy-mode-vi v send -X begin-selection
|
||||
bind-key -T copy-mode-vi V send -X select-line
|
||||
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
```
|
||||
### Integration with neovim
|
||||
|
||||
Here by integration, I mean seamlessly transitioning between tmux and neovim splits.
|
||||
To do this we want tmux to figure out if the current tmux split contains a vim process (and potential vim splits).
|
||||
We then can then bind the same motion keys in tmux and nvim so that we can seamlessly move from a tmux split into a vim split and back all using the same keys!
|
||||
We can do this with the following code snippet in our `~/.tmux.conf`.
|
||||
|
||||
```tmux
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||
|
||||
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
||||
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
||||
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
||||
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
||||
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
||||
```
|
||||
|
||||
`is_vim` defines a command to determine whether the current pane is running vim.
|
||||
If so, we send the key codes directly to vim, otherwise process the key binding with tmux.
|
||||
For this case we utilize `<C-{vim_keys}>` for motion to make things easy.
|
||||
|
||||
## Neovim setup
|
||||
|
||||
Now we need to make sure we can go from a neovim split smoothly to a tmux split.
|
||||
To do this we utilize the [christoomey/vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) plugin.
|
||||
First add it to your plugin manager,
|
||||
|
||||
**Lazy.nvim:**
|
||||
```
|
||||
require("lazy").setup({
|
||||
"christoomey/vim-tmux-navigator"
|
||||
})
|
||||
```
|
||||
|
||||
or **Vim-plug:**
|
||||
|
||||
```
|
||||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
and that's it!
|
||||
It should automatically add the `<C-{vim_keys}>` for motion and handle moving out of vim splits to tmux panes.
|
||||
Hopefully this is useful to someone else!
|
||||
|
||||
## Bonus
|
||||
|
||||
Gruvbox is everywhere even [tmux gets a nice theme](https://github.com/egel/tmux-gruvbox).
|
||||
|
||||
|
60
content/posts/valgrind-artix-linux.md
Normal file
60
content/posts/valgrind-artix-linux.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
title: "Gettting Valgrind working on Artix Linux"
|
||||
date: 2023-08-29T21:38:32-04:00
|
||||
topics: ['software development', 'linux', 'Artix']
|
||||
---
|
||||
|
||||
I'm currently working on developing an implementation of the Concurrent Atomistic-Continuum method using C++ and CUDA to accelerate calculations.
|
||||
A need arose to use `valgrind` for debugging some memory issues.
|
||||
I currently run [Artix Linux](https://artixlinux.org) and it turns out that both Artix Linux and Arch Linux have fully removed all debug packages from their repositories and have swapped over to a `debuginfod` style system.
|
||||
On my system, said `debuginfod` was working with `gdb` but not with `valgrind`.
|
||||
In particular I was missing the debug symbols for `glibc` which prevented `valgrind` from working at all.
|
||||
I had to try a few things before I got it working so I want to share how I did.
|
||||
I also want to mention an issue I ran into if any guys from Artix Linux ever end up reading this post.
|
||||
|
||||
## What should've worked but didn't
|
||||
|
||||
Artix linux is hosting a debuginfod server at https://debuginfod.artixlinux.org.
|
||||
They have this set up so that you can add it to your `/etc/pacman.conf` as a custom repository.
|
||||
All you have to do is append:
|
||||
```
|
||||
[system-debug]
|
||||
Server = https://debuginfod.artixlinux.org/$repo/os/$arch
|
||||
[world-debug]
|
||||
Server = https://debuginfod.artixlinux.org/$repo/os/$arch
|
||||
[galaxy-debug]
|
||||
Server = https://debuginfod.artixlinux.org/$repo/os/$arch
|
||||
[lib32-debug]
|
||||
Server = https://debuginfod.artixlinux.org/$repo/os/$arch
|
||||
```
|
||||
|
||||
to the bottom of the file, run a quick `pacman -Syu`, and then you should be good to go.
|
||||
The issue that I ran into was that the debug package for `glibc` was old compared to the version of `glibc` I had installed.
|
||||
This meant that even though I had the `glibc-debug` package, `valgrind` still didn't work.
|
||||
My only gripe with the Artix Linux team is that if you are going to switch to a `debuginfod` setup and not allow us to install packages from the core repositories that have debug symbols enabled, please at least keep it up to date with the other core repositories.
|
||||
|
||||
## What does work and isn't ideal
|
||||
|
||||
Once the Artix specific solution didn't work, I switched over to figuring out the more general Arch Linux solution with the hope that it didn't involve `systemd`.
|
||||
It turns out that the Arch Linux team has not exposed their debug repositories the same way that the Artix Linux team has which means you have to dig a little bit more.
|
||||
I ended up finding in the Arch Linux wiki, that there are Arch Linux sponsored mirrors which contain the debug packages.
|
||||
To enable these you just add:
|
||||
|
||||
```
|
||||
[core-debug]
|
||||
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
|
||||
[extra-debug]
|
||||
Include = https://geo.mirror.pkgbuild.com/$repo/os/$arch
|
||||
|
||||
[multilib-debug]
|
||||
Include = https://geo.mirror.pkgbuild.com/$repo/os/$arch
|
||||
```
|
||||
|
||||
to the bottom of your `/etc/pacman.conf`.
|
||||
Now you are actually good to update with `pacman -Syu` and install debug symbols for glibc, `pacman -S glibc-debug`.
|
||||
Just watch out for incompatible versions again.
|
||||
It may be that on another upgrade, Arch linux will move further ahead on the debug package version number than the Artix Linux version of `glibc`.
|
||||
A workaround for this is to just install glibc from the Arch Linux `[core]` repository from https://geo.mirror.pkgbuild.com instead of the `[system]` repository on Artix.
|
||||
**Be warned** though that this might mess up other Artix programs which depend on the current Artix version of `glibc`.
|
||||
For now I've left it this way so I can get back to figuring out CUDA.
|
||||
Hopefully this helps someone out, happy valgrinding!
|
159
content/posts/web_obesity.md
Normal file
159
content/posts/web_obesity.md
Normal file
|
@ -0,0 +1,159 @@
|
|||
---
|
||||
title: "Fighting the web obesity crisis using Hugo and Skeleton CSS"
|
||||
date: 2023-02-12T12:45:48-05:00
|
||||
toc: true
|
||||
topics: ["css","web design","hugo", 'self-host']
|
||||
---
|
||||
|
||||
|
||||
Now that I've graduated from my PhD, I find that I have more free time that was previously spent working on my dissertation.
|
||||
I also have the desire to continue to publish in some manner.
|
||||
My solution to both of these problems is to revamp my previous website which I only used as a portfolio site for job search purposes into a random blog.
|
||||
|
||||
In my time online I once came across a talk titled [The Website Obesity Crisis](https://webdirections.org/blog/the-website-obesity-crisis/).
|
||||
Since I'm already obsessed with minimalist systems, obligatory "I use [Artix Linux](https://artixlinux.org) and run [dwm](https://dwm.suckless.org/)," I internalized everything immediately and searched for the best way to design a modern and actually minimalist website (both design and size).
|
||||
I decided to try and serve a website which followed the design paradigm of the web pyramid graphic shown below:
|
||||
|
||||
{{< figure src="/img/the_web_pyramid.jpg" width="100%" caption="The ideal design for any website, [source](https://idlewords.com/talks/website_obesity.htm)" >}}
|
||||
|
||||
I found that using [Hugo](https://gohugo.io) combined with the [Skeleton CSS boilerplate](http://getskeleton.com/) was the solution to a modern, minimalist, and "responsive" website.
|
||||
**Read on to learn how I did it!**
|
||||
|
||||
## Website design paradigm
|
||||
|
||||
The rest of this article describes the different components and how I've adjusted them to suit my purposes.
|
||||
There exist a [plethora of themes](https://themes.gohugo.io/) with complex Hugo shortcodes that allow easy customization from the config files.
|
||||
My personal site's Hugo theme does not bother with attempting to offer endless customization options.
|
||||
Instead, if you want to use this theme you should be ready to adjust the CSS files and the Hugo HTML templates.
|
||||
With that in mind let's get started.
|
||||
|
||||
## Skeleton CSS
|
||||
|
||||
The most important component of this site is [Skeleton CSS](http://getskeleton.com), which is a simple CSS boilerplate that serves as the foundation of my site.
|
||||
Detailed documentation can be found at the link previously mentioned but I'll describe the layout succinctly.
|
||||
The fundamental container that everything should go into is `<div class=container>` which responsively scales it's width based on the size of the browser/screen.
|
||||
The next important div is `<div class='row'>` which is a row that contains the`<div class="columns">`.
|
||||
This layout is shown below:
|
||||
|
||||
```
|
||||
<div class="container">
|
||||
| <div class="row">
|
||||
| | <div class="columns">
|
||||
```
|
||||
|
||||
The Skeleton CSS grid has 12 columns, you can specify the number of columns by changing the class, e.g. `<div class="one column"`, `<div class="two columns">`, `,<div class="eleven columns">`, etc.
|
||||
These divs will automatically stack instead of being shown side by side when the browser gets small enough, enabling a nice responsive layout.
|
||||
I use this whenever I need to place items horizontally.
|
||||
|
||||
**Note:** You have to add:
|
||||
|
||||
` <meta name="viewport" content="width=device-width, initial-scale=1">`
|
||||
|
||||
to get this working properly for mobile devices.
|
||||
|
||||
## Notes on some CSS styling I use
|
||||
|
||||
I won't go into too much detail into the styling that I use, but I do want to mention a few things.
|
||||
First, if you want to learn how I wrote the responsive, navigation menu that I use for mobile, [see my other post](/posts/mobile_navbar).
|
||||
The colors for my website are selected from the [Gruvbox color scheme](https://github.com/morhetz/gruvbox), shown below:
|
||||
|
||||
{{< figure src="/img/gruvbox_scheme.png" width="100%" caption="Gruvbox dark color scheme (I use it on everything), [source](https://github.com/morhetz/gruvbox)" >}}
|
||||
|
||||
Since I probably am the only person that will actually be browsing my website, I want some sort of consistency between my terminal and my site.
|
||||
For fonts, I decided to copy [Sakura CSS](https://github.com/oxalorg/sakura) since those fonts looked very nice.
|
||||
If you have any questions about how I style a specific element shoot me an email or just read through the css stylesheet!
|
||||
|
||||
|
||||
## Using Hugo to fill in content
|
||||
|
||||
Now here comes the final step, which is utilizing Hugo.
|
||||
I again won't write the full guide on how to use Hugo.
|
||||
You can check out the [official Hugo guide](https://gohugo.io/getting-started/) for how to setup Hugo and some basic concepts.
|
||||
You can also check out the intro to Hugo by [Luke Smith](https://videos.lukesmith.xyz/w/oz4VV8SrnTEACCndxMASZH).
|
||||
I didn't actually use this video to learn Hugo, but his stuff is usually pretty good so if video format works better for you maybe you can try that.
|
||||
The primary uses I have for Hugo are:
|
||||
|
||||
1. Listing posts
|
||||
2. Tagging
|
||||
3. Table of Contents
|
||||
|
||||
To me these three topics are the biggest strengths of Hugo and justify the hours spent learning this new technology.
|
||||
So lets address each of these in order:
|
||||
|
||||
### 1. Listing posts
|
||||
|
||||
By default, for each of the directories containing .md files (such as content/posts) Hugo will create a list page containing all posts within that directory.
|
||||
If you click on either the "Posts" or "Recipes" link at the top of this website you will see what such a page looks like.
|
||||
The one thing that wasn't as clear was how to include something like your five most recent posts on the front page.
|
||||
I had the additional requirement that I only wanted posts from the actual "Posts" directory and not all posts from my site.
|
||||
Specifically I didn't want my homepage including my latest recipes.
|
||||
The solution is pretty simple, is shown below, and should be included in your base `index.html` at `/path/to/site/themes/{theme}/layout/index.html`:
|
||||
|
||||
```
|
||||
{{ range ( where .Site.RegularPages "Type" "posts" | first 5 ) }}
|
||||
<a href="{{ .Permalink }}">
|
||||
<h4>{{ .Params.title }}</h4>
|
||||
<p style="font-size:1.6rem">{{ dateFormat "Jan 2, 2006" .Date }} </p>
|
||||
<p style="font-size:1.8rem">{{.Summary }}</p>
|
||||
</a>
|
||||
{{end}}
|
||||
```
|
||||
|
||||
You will notice that the important part is the range statement which selects only pages with `Type "posts"` and selects the first five of them.
|
||||
The rest of the code pulls out the various frontmatter of the post being display.
|
||||
I like to show the date of the post as well as a brief summary.
|
||||
|
||||
### 2. Tagging
|
||||
|
||||
The full guide to taxonomies is [on the Hugo site](https://gohugo.io/templates/taxonomy-templates/).
|
||||
I use two types of taxonomies that I define in my config.yaml:
|
||||
|
||||
```
|
||||
taxonomies:
|
||||
tag: "tags"
|
||||
topic: "topics"
|
||||
```
|
||||
|
||||
The format for a taxonomy is that you have to specify the taxonomy as the key and the plural of the taxonomy as the value.
|
||||
I use the `tags` taxonomy for organizing my recipes and the `topics` taxonomy to organize my posts.
|
||||
You can list all values for a specific taxonomy in the list page by including the following code in your `list.html` for the specific topic.
|
||||
Each value for the taxonomy will link to a page that lists all post with that specific value.
|
||||
The example below lists the `topics` taxonomy for my posts, so this is included in `list.html` at `themes/personal/layout/posts/list.html`:
|
||||
|
||||
```
|
||||
{{ range .Site.Taxonomies.topics }}
|
||||
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }} ·
|
||||
{{ end }}
|
||||
|
||||
```
|
||||
|
||||
|
||||
### 3. Table of Contents
|
||||
|
||||
This is another neat little feature that I really enjoy from Hugo.
|
||||
First, I always use `##` to denote section headings while `#` is used only for the page title.
|
||||
To ensure the Hugo table of contents captures the hierarchy correctly, I set the following code in my `config.yaml`:
|
||||
|
||||
```
|
||||
markup:
|
||||
tableOfContents:
|
||||
startLevel: 2
|
||||
```
|
||||
|
||||
The table of contents command creates a `<nav Id="TableOfContents">` element which you can then style.
|
||||
I also want the table of contents to show only when I have `toc: true` in the pages frontmatter.
|
||||
This can be done pretty simply by adding the following code to your `single.html`:
|
||||
|
||||
```
|
||||
{{ if .Params.toc }}
|
||||
{{ .TableOfContents }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Conclusions
|
||||
|
||||
I hope that this provides a decent enough introduction into what I'm using to keep my site looking modern while remaining minimal with regards to size.
|
||||
If you haven't heard of Skeleton CSS before, you should definitely check it out in more detail, especially if you are linking to create a simple and responsive site that isn't full of endless bloat like some of these bigger CSS frameworks.
|
||||
I also highly recommend Hugo to generate static sites as it has a lot of useful functionality.
|
||||
As always, shoot me an email with any thoughts, comments, or to point out my mistakes.
|
||||
Thanks for reading!
|
11
content/posts/xsede_post.md
Normal file
11
content/posts/xsede_post.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
title: "Work featured on San Diego Supercomputer Center website"
|
||||
date: 2022-11-14T23:24:18-05:00
|
||||
|
||||
---
|
||||
|
||||
[My work has been featured on the San Diego Supercomputer Center website!](https://www.sdsc.edu/News%20Items/PR20221010_nanolayer_materials.html) This post highlights my work published with title:
|
||||
|
||||
["Effects of interdiffusion on shear response of semi-coherent {111} interfaces in Ni/Cu"](/publications/interdiffusion)
|
||||
|
||||
which was conducted using XSEDE allocation TG-MSS150010. XSEDE resources were critical for running these simulations as it required significant computational resources.
|
Loading…
Add table
Add a link
Reference in a new issue