Notes
Vim Tips
General Tips
vim -p file1 file2
to open multiple files as tabs:qa
to quit out of all open buffers:Ex
to return to netrw (file explorer)
Terminals
:term
to open a terminal in current window- Use
i
to enter insert mode and type into the shell <C-\><C-n>
to return to normal mode to allow scrolling or switching windows- I’ve remapped this to
<C-space>
- I’ve remapped this to
Windows
<C-w>
prefixes all window commands<C-w>
+h,j,k,l
to focus window to left, bottom, up, right, respectively<C-w>s
to split current window horizontally, equivalent to:split
<C-w>v
to split current window vertically, equivalent to:vs
Registers
"c
before a command, wherec
is the register to store the text- Use capital letter to append to the register, e.g.
"C
Macros
- Press
qc
to start recording, wherec
is the register to store the macro - Stop recording with
q
- Replay the macro with
@c
Retrieving status.cafe Updates During Hugo Builds
status.cafe provides you with a JavaScript snippet to include your status on your site. I don’t update my status super often, so I don’t need to be hitting m15o’s servers on every page load. To get around this, I wanted to see if I could update my status as a build step in Hugo.
This is the script status.cafe provides:
document.writeln('<div id="statuscafe"><div id="statuscafe-username"></div><div id="statuscafe-content"></div></div>');
fetch("https://status.cafe/users/yequari/status.json")
.then( r => r.json() )
.then( r => {
if (!r.content.length) {
document.getElementById("statuscafe-content").innerHTML = "No status yet."
return
}
document.getElementById("statuscafe-username").innerHTML = '<a href="https://status.cafe/users/yequari" target="_blank">' + r.author + '</a> ' + r.face + ' ' + r.timeAgo
document.getElementById("statuscafe-content").innerHTML = r.content
})
This takes just over a second to fully load. Fetching the above script takes 478ms, then running the script fetches a json file, which takes 680ms. Now this is asynchronous, which means a user is not waiting on this for the rest of the page to load, but it is noticeable that the status pops in later than everything else. The entire page loads in 1.22s
Example Systemd Service
System units go in /etc/systemd/system
User units go in $HOME/.config/systemd/user
[Unit]
Description=Webring test service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
WorkingDir=/code/webring
ExecStart=/code/webring/webring --dsn /code/webring/webring.db --addr :8000
[Install]
WantedBy=multi-user.target
Example .desktop File
Example
[Desktop Entry]
# The type as listed above
Type=Application
# The version of the desktop entry specification to which this file complies
Version=1.0
# The name of the application
Name=jMemorize
# A comment which can/will be used as a tooltip
Comment=Flash card based learning tool
# The path to the folder in which the executable is run
Path=/opt/jmemorise
# The executable of the application, possibly with arguments.
Exec=jmemorize
# The name of the icon that will be used to display this entry
Icon=jmemorize
# Describes whether this application needs to be run in a terminal or not
Terminal=false
# Describes the categories in which this entry should be shown
Categories=Education;Languages;Java;
Arch Linux Secure Boot
I needed to enable Secure Boot so that I could play League of Legends with Riot’s Vanguard Anti Cheat. It seemed complex at first but was actually easier than I expected. The Arch Wiki is both helpful and confusing here, it provides a bunch of different ways to do this, but doesn’t always do a great job of differentiating them as logically separate processes.
My basic understanding of Secure Boot is that when your computer first loads up, it loads the motherboard firmware, which then boots a bootloader. I remember from my OS classes that historically, the bootloader is 512 bytes, specifically the first 512 bytes on the boot disk. The bootloader can be anything, the computer will just run it because of its location in storage, which means malicious actors could run any arbitrary code there and compromise the system. Secure boot mitigates this by only allowing cryptographically signed bootloaders to run. The process outlined here is to sign our bootloaders so that Secure Boot will allow them to run. We are doing this by using our own keys (see Assisted process with sbctl), rather than using a pre-signed boot loader. Note that “firmware” here refers to the motherboard firmware, commonly referred to as “the BIOS”
Dockerized ZNC
Setting Up ZNC with Docker
ZNC is an IRC bouncer, which is a program that acts as a middleman between your IRC client and any servers you connect to. This provides a number of benefits, the most notable of which is chat history while your client is closed. This guide is how I set up
I have a Raspberry Pi connected to my network that I use as a DNS server with Pi-hole and nginx-proxy, as well as a host for several web-based services. Each service is a Docker container, which I manage through a single Docker Compose file. To install ZNC, I simply add a container to the Compose file.
League on Linux
League of Legends on Linux
LoLoL for short
Important update
With Vanguard coming to League in the near future, League on Linux is no more.
These are my notes on how I got League of Legends running on my Linux system. It runs almost flawlessly, the only issues I have are with the client, but even on Windows the client is garbage. The game itself runs even better on Linux than it does Windows.