blog // ~snubspreker

this is just a test

select color from terminal

May 25, 2020 — ~snubspreker

colorpicker

Use colorpicker from the command line to select colors.

For instance: surf ((echo "https://www.colorhexa.com/")(colorpicker –short –one-shot –preview | tr -d "#"))

As usual, there is most probably a better way to do this, but anyway. We break it down into several steps.

$(colorpicker –short –one-shot –preview | tr -d "#")

What this does is first call colorpicker with *–short which returns html color codes, –one-shot whcih cause colorpicker to exit after one click, and –preview* which displays a small square in the bottom right corner of the screen filled with the color under the cursor.

Pipe this into tr using *-d to delete the hash #*.

Wrap the whole thing in a command substitution.

surf $(echo "https://www.colorhexa.com/" … )

This is simple you echo the url concat with the previous command sub result and generate a url to pass to surf or your favorite browser.

Alternative

colorpicker –short –one-shot –preview | xclip -sel clip

Just pipe the result of colorpicker into xclip or any other clipboard manager, and you can paste the result into your code.

I have a keybinding in stumpwm (define-key top-map (kbd "s-c") "exec colorpicker –short –one-shot –preview | xclip -sel clip") So that I can grab colors on the fly.

stumpwm the most stoopidest, until

May 24, 2020 — ~snubspreker

stoopid stumpwm

I use emacs and loved the idea of configuring my window manager in lisp because lisp is most beautiful. I have been a bspwm user (among others) and years ago was a fan of ratkiller. But stumpwm was a massive let down. For instance, in emacs you can jump right in and start using it. You need to turn some things off and on, but the defaults are more than useable. In fact my personal dots are as close to vanilla as possible. But stumpwm doesn't follow this principle. In order to get stumpwm up and running you need to put in days if not weeks of hard work.

because stoopid is as stoopid does

So, after attempting to get stumpwm running and giving up I switched to dwm. As I said I had been a ratkiller fan and even tinkered with wmii so I thought it would be a no-brainer. But yeah … no.

hurr durr do you even patch bro!

Now before you start running your mouth. Yes. Patching is a thing and it isn't difficult at all. It is a morally reprehensible way to produce software. But whatever. The problem with dwm is that it is only half cooked. The stoopid bar is such a filthy bloat that I can't stand it. I removed all the code for it. I should be able to plug lemonbar right in but no because instead of making dwm work with properly designed software the idiots chose to spend a crap ton of time and code on that disgusting bar thingy that doesn't even do what it is supposed to do well.

Thank goodness for emacs and magit because they made the process of working with dwm easier. It is still a stupid and lazy way to write software but whatever.

So look. After days of futzing around with the crap. Seven patches. Two full days of removing the idiotic bar thing. I get what just barely passes for a window manager. It manages windows and nothing else. But it also won't let you do much else. So I ended up mapping a hotkey to popup conky in a window so that I could get info on my system. No bar thanks to the tireless efforts of the developers of dwm to ensure that dwm is moronic and nearly unuseable.

And just like that. I switched back to stumpwm

The developers did do one thing well. They made stumpwm look great. They forced me to dig in and get stumpwm configured properly. I am tired of bspwm, but my working config is still around in case something goes south. But for now, stumpwm, and dracula theme for all the things is pleasing.

I hate dwm. Not because it is so l33t but because it is trash design by pedantic prats. But, if you want a working dwm I am thinking about putting my branch on github so you can fork it or fork off.

Most Efficent Keybinding for WASD games.

May 24, 2020 — ~snubspreker

Years of testing

Just to get to the point. WASD games wow so inefficent especially for lefties. I am not a leftie, but suffer from carpool tunnel (lol) and switched to a left handed keyboarding stance to compensate for years of computer use. Later I destroyed my mouse altogether because reason. Anyway! WASD should be replaced even by righties, with P[]SPACE.

To see why, just flop you right hand on the keyboard. In a comfortable position.

See how close your first three fingers are to P[]? And how your thumb naturally rests on the space bar.

My setup is simple P=forward, [=look left, ]=look right, SPACE=jump. If I need to I can bind ; to walk backward or some other useful key.

If this is a stretch, you could shift to IOPSPACE if that makes you more comfortable. If you insist on using your left hand you might try QWESPACE or ERTSPACE.

I have even switched my vim key bindings to mimic this setup. The important thing here is to map your most frequent key to your strongest finger. In my case, I had pointer finger after surgery so I switched FORWARD to my middle finger for a time.

Toggle Polybar Visibility in Emacs

April 21, 2020 — ~snubspreker

Write a toggle

ErgoEmacs has a nifty post on something I have done before in numertous ways. This one just feels better. So I attempted something just for fun and this is the result.

(defun toggle-polybar ()
  "Toggle visibility of polybar.
Initial 'state (nil t) is pulled from xdotool."
  (interactive)
  (if (eq (shell-command "xdotool search --onlyvisible --name Polybar" nil nil) 0)
      (progn
    (shell-command "xdo hide -N Polybar" nil nil))
    (progn
      (shell-command "xdo show -N Polybar" nil nil))))

(global-set-key (kbd "C-c t p") #'toggle-polybar)

Originally I was using a plist to set the state, but that is not required since all linux commands return an exit code which you can trap and test. So the if statement first checks to see if polybar is visible. xdotool returns 0 or 1 zero being success. Test that return and execute the show or hide based on that result.

Here is the same functionality in bash. That might show better what is happening.

#!/bin/bash

xdotool search --onlyvisible --name Polybar; ec=$?

case $ec in
    0) xdo hide -N Polybar ;;
    1) xdo show -N Polybar ;;
esac

In anycase, I have been using both versions with no faults…yet.

tags: emacs elisp linux

Lynx Colors

April 18, 2020 — ~snubspreker

Change Lynx ui colors

I have been using Lynx for a good long while and there was always a minor annoyance. The colors. I never thought to investigate how to change the colors…until today.

Turns out that it is a pretty simple gadget. Lynx.lss can be found in /etc and this is where all the colors can be changed. Maybe you are logged into a remote server, if so you'll need to copy that file into your $HOME directory.

cp /etc/lynx.lss $HOME/

After that there are two ways to make Lynx use that file;

The $LYNXLSS environment variable

export LYNX_LSS="$HOME/lynx.lss"

can be added to your [shell]rc file, in my case .bashrc like so

echo "export LYNX_LSS=\"$HOME/lynx.lss\"" >> $HOME/.bashrc

which appends to the end of .bashrc or you could use the -lss command line flag like so:

lynx -lss=~/lynx.lss

But, since I am a $HOME prude, I like to drop these sorts of things into my $HOME/.config and that looks like this:

mkdir -p ~/.config/lynx && cp /etc/lynx.lss ~/.config/lynx
echo "export LYNX_LSS=\"$HOME/.config/lynx/lynx.lss\"" >> $HOME/.bashrc

And, that works for me.

tags: bash lynx cli

Chase a Rabbit Down a Gopherhole

April 15, 2020 — ~snubspreker

A long time ago in an Internet far, far away…

Back in the dawn of the time when the Internet was fun and touted a The Information Superhighway, gopher) was a big thing. But that Wikipedia article will give you much more information than I ever could. Here is the deal in short, gopher) was a protocol that handled the retrieval and display of plaintext documents in a client). You may never have heard of it. There is a reason or two; 1) people really liked blinking, bouncing, and sliding things, 2) greed. But this article from (minnpost) explains the whole thing in detail from start to finish.

I thought gopher) was long dead until I got bored of bouncing and blinking text, and discovered that not only is gopher) not dead, but the pubnix is still alive and well.

In my home town, the local community college ran a bulletin board system (BBS) which provided a gateway to the, at the time, brand new internet and allowed you to apply for a login to a PAUS (public access unix system) and all that came with it; email, ftp, telnet, mud, mush, www, irc, gopher), archie, and veronica, etc. Let me just tell you that the internet is full of nooks and cranies where all these are still available.

So what now?

Well you could investigate these cobweb corners of the internet, and maybe contribute something as well. But how?

Of shoes, and ships, and sealing-wax Of cabbages and kings

Maybe the most fun you will have is chasing a rabbit down a gopherhole. But, to do that you need to know where the gopherholes are and you need a vessel in which to travel. There are tons of gopher) clients available for just about any OS, and I have tested most of them. The four I like are gopherus, gild, lynx, and elpher. All have advantages and disadvantages.

gopherus

I like the way gopherus looks. You can configure the colors, even making it look like an old amber terminal (tickles me), but the key commands take a bit of getting used to. They are somewhat non-standard for me, but that is because I use emacs like key bindings for everything. However, once you get used to the keys gopherus has a couple of neat features that are burried or non-existent in the other clients. Those being F9 Download location to disk, and F10 Download all files in current menu to disk. For info hoarding these two gadgets are priceless. One thing I hate, is that BACKSPC is used as back-page which makes entering text in the url difficult since you need to use the delete key to expunge unwanted characters.

Key bindings:
   TAB       - Switch to/from URL bar edition
   ESC       - Quit Gopherus (requires a confirmation)
   UP/DOWN   - Scroll the screen's content up/down by one line
   PGUP/PGDW - Scroll the screen's content up/down by one page
   HOME/END  - Jump to the top/bottom of the document
   BACKSPC   - Go back to the previous location
   B         - Bookmark current location
   DEL       - Delete bookmark (main screen only)
   F1        - Show help (this file)
   F2        - Go to program's main screen
   F5        - Refresh current location
   F9        - Download location to disk
   F10       - Download all files in current menu to disk

I give this a rating of one and a half penguins.

gild

I'm just gonna say I give gild a rating of one full goatse. The only redeeming quality of gild is that it is written in ldpl which is a variant of COBOL and I think that is a neat trick. But gild is so unuseable that I won't even bother describing it. Read the source for fun and education, but don't install it.

lynx

Maybe the best of all the gopher) clients I have tested is lynx. Lynx is not exactly a gopher) client). It is a text based browser that understands the gopher) protocol. Which means that you can bounce back and forth between http:// ftp:// and gopher:// like it was nothing. Plus! It runs in the terminal, is light weight, highly configurable and more than I care to go into feature-wise. I give it a rating of twelve penguins, one unicorn, and a cupcake.

elpher

While elpher isn't the only option for browsing gopherholes in emacs, it is the best. It's only real drawback is that it requires you to run emacs, and that comes with a steep learning curve. Learning emacs is well worth the effort, and not just for elpher. The main positive for elpher is that it is part of emacs which means that you can treat it like any other emacs buffer. You can extend it and configure it to the extent of your lisp knowledge. I give it a rating of four parentheses.

Following a rabbit down a rabbit hole

Now that you know how to get there you need to know where to go. Maybe the best place I've found to start, is gopher.black.

lynx gopher://gopher.black

The above example shows how to get lynx to visit gopher.black. You just open a terminal and type that command and feel elated. Lynx works pretty much as you would expect: arrow keys ↑↓ move the cursor up and down the page, ←→ follow links and return to the previous page, F1 opens a great help screen, TAB moves forward to the next link on the page. You can configure the keys so that they resemble vi or emacs. There is just so much right with this browser, that you could use it daily instead of firefox or chrome, I know because I do.

Some interesting asides

There are many many more clients that I have tinkered with and decided against for various reasons mostly because of buggy behaviour, or difficulty or the interface. Still, they are interesting. One thing I found was that there is a reletively new protocol being developed, and in actual use called gemini.

From the website:

Gemini is a new, collaboratively designed internet protocol, which explores the space inbetween gopher and the web, striving to address (perceived) limitations of one while avoiding the (undeniable) pitfalls of the other.

What that means, I don't know. What I do know is that for the most part, gemini clients and gopher) clients, can be used interchangeably…mostly.

See the links section for more.

This should help get you started.

Links

archie and veronica

archie.icm.edu.pl (active web based archie server) Search Engine History

gemini

Project Gemini Gemini Clients gemini://carcosa.net gemini://gemini.conman.org gemini://typed-hole.org gemini://zaibatsu.circumlunar.space

The Editor and the Tramp

April 14, 2020 — ~snubspreker

The Editor and the Tramp

You have most likely logged into the tilde.team server with something like:

yourusername@tilde.team

You may be editing files, posting to a blog with bb or something like that, but you don't need to log in just to edit files. Emacs has a builtin feature called tramp that allows you to create and edit files on a remote server using (rlogin, telnet, or ssh)

TRAMP (Transparent Remote Access, Multiple Protocols) is a package for editing remote files, similar to AngeFtp or efs. Whereas the others use FTP to connect to the remote host and to transfer the files, TRAMP uses a remote shell connection (rlogin, telnet, ssh). It can transfer the files using rcp or a similar program, or it can encode the file contents (using uuencode or base64) and transfer them right through the shell connection.

EmacsWiki: Tramp Mode

The how

How is pretty simple. Normally in emacs, to open or create a file you would press C-x C-f then enter the path and file name when prompted. Say I have a file on my local system called:

~/public_html/test.html

I would enter that path and press enter when prompted. But to edit the same file on a remote system, you would type:

ssh:yourusername@tilde.team

then press enter. You'll be prompted for a password and then presented with a list of files on the remote system to which you have access.

Emacs now treats this new, remote file system just like your local file system. You can basically forget that you are logged into this remote system and just do the work you set out to do.

Using emacs in the terminal on tilde.team is great, but if you like emacs and want to use it on your own system with your own personalizations, and cut down on the steps required to do the stuff you want, this is a great way to have your cake and emacs it too.

Maybe you want to finger me

April 13, 2020 — ~snubspreker

It sounds filthy

There are much worse ways to spend your day than noodling around in linux fingering other users. It sounds way more fun than it is, but it can be very useful.

What the heck is finger anyway?

From the man page:

NAME
     finger — user information lookup program

SYNOPSIS
     finger [-lmsp] [user ...] [user@host ...]

DESCRIPTION
     The finger displays information about the system users.

man: finger

Basically, finger is a way of learning a little bit about your fellow tilde.team users. Only the bits they are willing to share.

For instance, if you finger me:

finger snubspreker

You'll get:

Login: snubspreker              Name: 
Directory: /home/snubspreker            Shell: /bin/bash
On since Mon Apr 13 11:20 (EDT) on pts/98 from 2600:1702:1220:e450::2f
    5 seconds idle
On since Sun Apr 12 22:51 (EDT) on pts/220 from tmux(16145).%67
   30 minutes 35 seconds idle
On since Wed Apr  8 16:46 (EDT) on pts/236 from tmux(16145).%1
   4 days 2 hours idle
On since Wed Apr  8 16:46 (EDT) on pts/239 from tmux(16145).%3
   3 days 3 hours idle
On since Sat Apr 11 18:44 (EDT) on pts/251 from tmux(16145).%60
   2 hours 21 minutes idle
No mail.
Project:
Right now, just tinkering with tilde.team and remembering the good old days.

Plan:
Writing a little about chaos and butterflies. Maybe contributing a little too.
snubspreker@tilde.team

If you insist upon being rediculous, I'm gonna make it difficult for you.

But, if you finger another user, you might find that either Plan: or Project: maybe both are missing.

.project and .plan

If you want other users to know a little bit more than finger provides, you can populate these two files in your $HOME directory with that information. What you choose to include is up to you, but creating them is easy.

touch ~/.plan ~/.project
chmod o+rx ~/.plan ~/.project

Now anybody can finger you.

Remote fingering

You don't need to be logged in to your tilde.team account to finger your favorite user, you don't even need an account. You can remotely finger a user from your own system. You just need a finger client and if you are a linux user, chances are good that you have one already. Unless you are an arch user. The reason is simple, with arch you may need it and you may not but that is for you to decide. If you decide you need it then you can install it. Very simply.

To install finger on arch (which is all I care about because that is what I use) use pacman.

pacman -Syu netkit-bsd-finger

man: pacman(8)

Your system may require you to sudo pacman but pacman will let you know if that is the case.

Now, from your laptop/desktop terminal window just type:

finger snubspreker@tilde.team

to finger me long distance. I am boring so you will not be entertained.

Well, I think that is all for now.

Better resources

There are much better resources than me for detailed information on finger.

HowtoGeek: How to Use the finger Command on Linux Indiana University: ARCHIVED: In Unix, how do I make plan and project files that will show up when people finger my account?

Maybe you wanna try emacs

April 13, 2020 — ~snubspreker

Intro

I know, you are a vim, Atom, SublimeText, etc. user and you don't see the need to change. Well yeah, if you have an editor and you are happy then just ignore me. But maybe you are curious about emacs or maybe you've heard about org-mode.

Well, there are much better blogs about emacs than anything you will get here. I will probably include a few links. But maybe you just want to tinker, and if you are like me, you only need a little info to get you going.

So, here is a little info.

Emacs is ugly

Yep. Plain old emacs is U.G.L.Y. no joke. There are tons of packages available that will fix this ugliness issue in one way or another. But you don't need all that to use emacs.

Toward a really useful emacs

When I first started using emacs the main thing I hated about it was scroll bars, menu bars, buttons, and the colors.

Well, if you are using emacs from a terminal logged into your tilde.team account you don't have to worry about the buttons or scroll bars, but the menu is still there and the colors could be better.

When you start emacs, the first thing you see is a splash screen the GNU Emacs buffer. It has lots of great info and you really will benefit from any time spent reading or following the tutorials.

However, if you press q on the keyboard, that buffer will go away because q is bound to a function exit-splash-screen.

The next buffer you see

The scratch buffer is a kind of swiss army knife. You can use it for notes or for testing little scraps of elisp like those below.

(menu-bar-mode -1)                ;; don't need the menu bar especially in terminal
(load-theme 'wombat)              ;; but you want some color
(defalias 'yes-or-no-p 'y-or-n-p) ;; change yes or no to y or n
(show-paren-mode 1)               ;; show matching parens

Type those statements in the scratch buffer (or just copy and paste. Then press and hold the Alt and the letter x. This puts you in the mini-buffer. Just type eval-buffer and press enter.

You should see an immediate change. Emacs should look much nicer.

Make it semi-permanent

If you have a tilde.team login you have emacs available as one of many choices. Nano is the default, but you can edit you ~.bashrc

# set EDITOR just in case
export EDITOR=emacs     # Just change this line that used to say nano
export PATH=$PATH:~/.local/bin

Of course if you aren't that committed you can just call it from the command line.

You emacs init.el

But say you like what you see and you want to play around with it. In the scratch buffer, just press Ctrl + x, followed by Ctrl + w. You'll be asked where youd like to save it. There are a couple of places you could save it, but for now just save it to ~.emacs.d/init.el/ and the next time you start emacs these changes will load automatically.

This is a very simplistic walk-through, but should get you started. I hope to keep going with these sorts of things. And I might make a git repo.

Posting to bash-blog in emacs

April 12, 2020 — ~snubspreker

WTF?!

Just tinkering around a little. I like the idea of bash-blog. What I don't like is that it wants to control the creation of posts for you. If you type:

bb post my-test-post.md

then bb will search for that file, and if found, will present that to you in $EDITOR for editing. Save the file, and bb resumes, asking if you want to post, edit again, or save as draft. Cool. But, I use emacs. I'm already editing the file. Most likely I am using org-mode, exporting as markdown, then calling bb and passsing that file name.

What should happen, if you pass a file name to bb, is that it just posts the damned entry. Don't reopen the file that I just edited unless I ask you to.

The offensive piece of code I think is:

post_status="E"
filename=""
while [[ $post_status != "p" && $post_status != "P" ]]; do
    [[ -n $filename ]] && rm "$filename" # Delete the generated html file, if any
    $EDITOR "$TMPFILE"
    if [[ $fmt == md ]]; then
        html_from_md=$(markdown "$TMPFILE")
        parse_file "$html_from_md"
        rm "$html_from_md"
    else
        parse_file "$TMPFILE" # this command sets $filename as the html processed file
    fi

So maybe I will make some changes to a local copy of bb and bend it to my will. Or maybe do something in elisp. Who knows. This is just a test.