~ejw

Edwin Wenink

1 Hi

@1582666139

2 Generate this site with pandoc

@1582667366

Generate this whole website from markdown files with a one-liner:

pandoc -s 
--toc 
--metadata title="~ejw"
--metadata author="Edwin Wenink"
 --number-sections
 --section-divs 
--css https://www.edwinwenink.xyz/css/twocolumn.css 
~/public_html/**/*.md ~/public_html/webring.md 
-o ~/public_html/index.html

Quickly create a new post and start editing it:

TIMESTAMP=$(date +%s)
DATE=$(date +%Y-%m-%d)
FILE=~/public_html/content/$DATE-$TIMESTAMP.md
touch $FILE
echo "@$TIMESTAMP" >> $FILE
vim $FILE

Naming convention: 2020-02-25-1582666139.md. This way, all posts with be sorted by order of writing (oldest first).

Create aliases in .bashrc to quickly call these scripts:

alias build="/bin/bash ~/public_html/scripts/build.sh" alias new="/bin/bash ~/public_html/scripts/new.sh"

Get the latest versions of these scripts here.

3 Github repo

@1582668320

I will back up this tilde here.

4 Opening posts in Vim

@1582669093

4.1 Based on filename

Use the naming convention of 2020-02-25-1582669093 (date-timestamp)

4.2 Based on content

grep grep grep

4.3 Searching title with grep

-i flag makes the search case insensitive (optional)

-l is important because it only returns the filename of the match, so you can pass it as an argument to the vim command with xargs.

UPDATE: actually, no you can’t. It will work, but will also mess up your terminal from there on because Vim expects input from interactive terminal. The backtick approach is safe:

vim `grep -il "Opening posts in Vim"`

By the way, I’m assuming you are already in the correct folder. Otherwise, run something like:

vim `grep -il "Opening posts in Vim" content/*`

4.4 Open most recently edited file

This assumes you are in the content directory (i.e. the same directory as the most recently edited file):

!v

Alternatively, you can find the most recently edited file with:

vim `ls -t | head -1`

Be aware of the backticks! ls -t sorts on edit time, with the most recently edited file on top.

4.5 Open latest post

Because all posts are chronologically ordered due to the used naming convention, we can also list all content files and open only the last one:

vim `ls | tail -1`

5 Who is logged in?

@1582673654

  1. w command

Run w to see all logged in users, as well as their current process. To see info of a specific user, type w ejw:

 16:35:48 up 71 days, 19:54, 24 users,  load average: 2.36, 1.81, 1.83
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
ejw      pts/94    13:26    4.00s  0.46s  0.00s tmux
  1. who command
  2. users

Returns a space separated list. This is all on one line, so grep is useless here.

However, if you [tr]anslate each space into a newline, you get a list of users with one user per line:

users | tr ' ' \\n

Often you’ll see the same name multiple times, so we can add uniq to solve that. Combining everything so far we get:

users | tr ' ' \\n | uniq

(to count the number of users, add | wc -l behind it to count the number of lines.

  1. finger

This command is actually for finding out user information and contact details, but also kind of works for this purpose. It looks like it does not matter that some people may not have changed their user information.

6 User information with finger

@1582731836

The phrasing of this command lends itself quite well for stupid jokes.

6.1 Finding information on others

For an overview of all online users: finger

For a specific user: finger [username]

6.2 Setting your own information, plan and project

Use the chfn (change finger) command for this.

The -o and -p flags are used for your office and office phone, but according to ~pfhawkins we use the following convention on this tilde:

chfn -f "Full name" username
chfn -o "Your city here" username
chfn -p "Your country or state here" username

Additionally, you can notify others what you are up to by making a plan at ~/.plan.

You can also indicate others of a project you are working on by making ~/.project.

All this information will be included when people “finger” you.

Output of finger ejw:

Login: ejw                      Name: Edwin Wenink
Directory: /home/ejw                    Shell: /bin/bash
Office: Netherlands
On since Wed Feb 26 08:40 (MST) on pts/18 from 145.116.163.127
   3 seconds idle
No mail.
Project:
Experimenting with old school Unix stuff
Plan:
Think about fun projects to add to my page

Your ~/.plan file can be arbitrarily long, so this is basically the first blogging tool ever. You could “finger” someone and read their latest “blogpost” there.

7 Nicer thread sorting in (neo)mutt

@1583258809

Normally, threads in mutt are sorted by the oldest message. When sorting on threads, this causes mails belonging to an older thread to not show on top of my inbox. I wrote about this here, if you’re interested. This is my preferred setting (~/.muttrc):

set sort= threads
set sort_aux = reverse-last-date-received

8 Weechat settings and scripts

@1583259951

8.1 Issues I encountered

Most default actions using the Alt meta key did not work properly. I could for example not use Alt + Num to quickly jump to a buffer. In the weechat FAQ I found this problem and the solution. Apparently xterm does not play nice with mutt and as it happens I switched to xterm today (from urxvt).

The solution is to set in your .Xresources:

XTerm*metaSendsEscape: true

I found a similar issue and (almost identical) solution in the arch linux wiki.

To reload the .Xresources in place: xrdb .Xresources.

Update: This so far did not solve my issue, I’ll have to do some more testing later. As an ugly workaround, use the actual Esc.

8.2 Some basic settings

Enable the mouse with /set weechat.look.mouse on.

Or in place: /mouse on.

This seems to be a great guide, by the way.

8.3 Scripts

I’m more or less used to Weechat basics, so I’m ready to try out some scripts. I’ll use this post to keep track of what I learn.

List all available scripts with /script.

/script install go.py: allows searching through buffers.

/script install urlgrab.py: shows you the latest urls in the buffer with \url and can be used to grab the latest link shared with you (did not set this up yet).

/script install highmon.pl: opens a buffer where all messages directly mentioning you are displayed. Run /highmon help for configuration tips.

/script autosort.py does what it says.

/scripts grep.py allows you to search buffers with regex with /grep. Tip: /logs opens logs (if you want to search through those).

8.4 For the future