What are you working on? - Programming On Unix

Users browsing this thread: 2 Guest(s)
seninha
Long time nixers
(07-08-2021, 11:53 AM)zge Wrote: I just finished cleaning up a IRC library I wrote for (GNU) AWK a few years ago, and published it here: https://git.sr.ht/~pkal/irc.awk

Would be interested in seeing what others here think of it.

This shebang is not portable:
Code:
#!/usr/bin/gawk -f irc.awk -f

Posix requires only one argument to the interpreter, more information here.
opfez
Members
(07-08-2021, 06:04 PM)seninha Wrote: This shebang is not portable:
Code:
#!/usr/bin/gawk -f irc.awk -f

Posix requires only one argument to the interpreter, more information here.

I mean, they did specify that it was written in GNU AWK, so POSIX compatibility is already out the window.
pkal
Long time nixers
(07-08-2021, 06:04 PM)seninha Wrote:
(07-08-2021, 11:53 AM)zge Wrote: I just finished cleaning up a IRC library I wrote for (GNU) AWK a few years ago, and published it here: https://git.sr.ht/~pkal/irc.awk

Would be interested in seeing what others here think of it.

This shebang is not portable:
Code:
#!/usr/bin/gawk -f irc.awk -f

Posix requires only one argument to the interpreter, more information here.

Didn't know about that, I can update the README and replace the shebang with a manual invocation. But as Opfez says and the README notes, the library relies on GNU AWK for now, so portability is a lesser priority.
seninha
Long time nixers
Speaking of awk, I formalized a plain text markup language I have been using for ages in a awk script that converts it to troff -ms or html.
I call it incipit, and it is heavily based on non-ASCII Unicode characters for marking things up. For example, the section character (§) is used to mark up section headers, and the bullet character (•) is used to mark up bulleted lists. Since those characters are rarely used in a text, I do not have to escape things out (in Markdown I often had to escape *s, =s and #s). Another feature is that tables are more readable with box drawing characters.
seninha
Long time nixers
I am working again on my X11 File Manager.
This time, after studying pthreads for some time, I'm using another thread to get and cache the thumbnails.
https://0x0.st/-YHg.mp4

I'm also working on the second version of my window manager, shod2. Now it can tile windows in floating containers.
Ssynicil
Registered
(13-06-2015, 08:47 AM)pizzaroll1 Wrote: I've been a bit bored recently, I don't have any ideas on what to program, rice, write on my blog, or anything. So I haven't been working on much.

Are you working on a project at the moment? The next big window manager? A CLI program that solves a problem everyone has? A shell script that does something vaguely useful? Post it here and get some feedback!

I've been trying to increase my knowledge on computers and have began running linux (more specifically the Ubuntu distribution) through a virtual machine.
z3bra
Grey Hair Nixers
(30-09-2021, 04:36 AM)Ssynicil Wrote: I've been trying to increase my knowledge on computers and have began running linux (more specifically the Ubuntu distribution) through a virtual machine.

Pretty cool to have someone that's new to the world of Linux here ! Enjoy your adventure ;)
z3bra
Grey Hair Nixers
I decided to make my email stack more robust, so I built a secondary mail server to queue up mails in the event that my primary server goes down.
Turns out, it's super easy with opensmtp ! I did that an automate it in a couple hours, and as I got some spare time, I setup spamd on both MX servers, and synchronized them together.

Man I love the OpenBSD software stack.
freem
Nixers
(30-09-2021, 04:36 AM)Ssynicil Wrote: I've been trying to increase my knowledge on computers and have began running linux (more specifically the Ubuntu distribution) through a virtual machine.

Nice! Welcome, and do not hesitate to join us on IRC for chatting! At first, our words won't make much sense to you, but if you ask us for explanations, you'll learn stuff faster than by exploring yourself.. or might go lost in one of the rabbit holes... which happens to me regularly, even :)


Not related to softwares, but I'm trying to do the drawing for a desktop case for my mini-ITX motherboard. With an ATX psu, which would have slots for 6 sata HDD, able to take a GPU in the PCIe slot, all that printable in the reasonable volume of 20cm x 25cm x 20 cm.
Old project (around 3 years, maybe older), fairly easy, but required to put some time in it (time in the printer, time in learning CAD, and time to draw the stuff), I'd dare say I finally got a placement to avoid assembling junctions, so maybe I can do even better...
pyratebeard
Long time nixers
(01-10-2021, 02:11 PM)z3bra Wrote: I decided to make my email stack more robust, so I built a secondary mail server to queue up mails in the event that my primary server goes down.
Turns out, it's super easy with opensmtp ! I did that an automate it in a couple hours, and as I got some spare time, I setup spamd on both MX servers, and synchronized them together.

Man I love the OpenBSD software stack.

This sounds great, and it's always nice when things like this turn out to be easier than anticipated.

The most recent project that I have been working on is migrating my standalone and Docker container online services to LXC. I have used a combination of drist(1) and make(1) to manage and configure (almost) everything. It is still a work in progress but so far everything seems to be running well.
josuah
Long time nixers
(07-08-2021, 11:53 AM)pkal Wrote: I just finished cleaning up a IRC library I wrote for (GNU) AWK a few years ago, and published it here: https://git.sr.ht/~pkal/irc.awk

Would be interested in seeing what others here think of it.

That reminds me the jj irc client: https://github.com/aaronNGi/jj

No matter what I do, I end-up trying to implement something in awk *first*, and then switching to C when it gets too complex.
josuah
Long time nixers
(23-09-2021, 04:15 PM)seninha Wrote: X11 File Manager

Many times, when facing complex software, or crashes, or something they did not understand, I figured users ended-up seeking for two things: the Windows taskbar with the start menu, the file browser (~/Desktop included).

The angle stone of using computers is browsing files, after all, in particular in Unix.
humky
Members
Doing small url/other tokens parser which would feed fzf to pick something from the terminal window without the mouse. Here is regex, any critique is welcomed:

Code:
grep -aEo "(((http|https|git|gopher|gemini|ftp)://|www\\.)[a-zA-Z0-9._-]*[:]?[a-zA-Z0-9./@$&%?\#=_~-]*)|([a-zA-Z0-9._-]*\\.(com|ru|xyz)/*[:]?[a-zA-Z0-9./@$&%?\#=_~-]*)|(tel:[0-9+]*)|(mailto:[a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*)|([a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9./@$&%?\#\(\)=_~-]*)|([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*)"
seninha
Long time nixers
I'm working in a set of utilities for self-organization called orgutils.
It already has an event manager (calendar) and a task manager (todo).
The goal is for those programs to be scriptable. They are non-interactive filters that do not do colored output or other forms of pretty-printing, so their output can be used by other utilities, in a shell pipeline for example.

I am now writing habit, a habit tracking software that will print a report of how the habits are being realized during the user's routine.
I'm thinking in add some kind of gamification to that. The user gains experience when doing good habits and levels up when gaining enough experience.
I am looking for a relation between experience and level, like a mathematical function that makes leveling easier in lower levels and harder in greater levels. I'm also looking for a rate for experience gaining.
I'm thinking in using a logarithmic function for the experience-to-level mapping and make experience being gained at a constant rate every time a good habit is done.

However, after I present this gamification idea to someone, they replied me with:
Quote:do you take into consideration that gamification might cause addiction-like (self-)gratification issues for the user

The main purpose of leveling in a gamificated system is to get some kind of reward when leveling up. However, I don't think a simple CLI utility will cause such kind of addiction.

In any case, other CLI utilities I'm planning for orgutils are:
  • schedule: A utility that convert tasks into events, that is, you describe your tasks and how much effort (in time) it takes and then it will schedule the tasks through the calendar.
  • clock: A utility for clocking time usage and the time spent on activities. I have to check how people do that on orgmode and mimic their workflow.
  • people: A contact manager that works with mutt(1).

I'm also reading orgmode's manual to get ideas to copy.
Orgmode's agenda view is implemented by agenda(1), a shell script that is included with orgutils.
z3bra
Grey Hair Nixers
(22-10-2021, 03:46 PM)humky Wrote: Here is regex, any critique is welcomed:

Code:
grep -aEo "(((http|https|git|gopher|gemini|ftp)://|www\\.)[a-zA-Z0-9._-]*[:]?[a-zA-Z0-9./@$&%?\#=_~-]*)|([a-zA-Z0-9._-]*\\.(com|ru|xyz)/*[:]?[a-zA-Z0-9./@$&%?\#=_~-]*)|(tel:[0-9+]*)|(mailto:[a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*)|([a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9./@$&%?\#\(\)=_~-]*)|([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*)"

Which terminal do you use and how do you spawn the extractor ? Does it handle wrapped URL that are too long for a terminal window ?
z3bra
Grey Hair Nixers
I've been working on a Go based file sharing system (posing as an HTTP server). Result is here: partage.

I wanted a self-hosted solution for my family to share big files (eg. pictures, videos, …). Introduction post on my Gopher hole (http).
humky
Members
(25-10-2021, 06:29 AM)z3bra Wrote: Which terminal do you use and how do you spawn the extractor ? Does it handle wrapped URL that are too long for a terminal window ?
It does handle wrapped URLs. It also handles emails, valid ipv4 and other tokens. I since altered the script somewhat, there was a problem with " ' and $, because of multiple levels of subshells and multiple level of quotes it was not possible to escape them in grep, I added another pass of sed to escape them that way.

You need st terminal with externalpipe patch applied, launch option in config.def look like this:
Code:
static char *copytokencmd[] = { "/bin/sh", "-c", "fzf-st-copy-token.sh", "externalpipe", "NULL" };

script itself:
Code:
#!/bin/sh
# Substitute ' " and $ with escaped variants, remove trailing white space.
data_after_sed=$(sed 's/\x27/\\\x27/g; s/\x22/\\\x22/g; s/\$/\\$/g; s/.$//' |
                 sort --parallel=4 -b -u)
tokens=$(printf '%b' "$data_after_sed" | grep -Eo "((http|https|git|gopher|gemini|ftp|mailto|tel|chrome|magnet):(|//)(|www.)[[:graph:]]*)|([[:graph:]]*@[[:graph:]]*\.(com|org|dev|io|xyz|ru))|([[:graph:]]*@(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))")

urxvtc -name 'fzf-prompt' -geometry 83x18+938+333 -e /bin/sh -c "printf '%b' \"$tokens\" | fzf --layout=reverse | tr -d '\n' | xsel --clipboard"

"fzf-prompt" name is set to floating in my wm.
I use urxvt instead of another instance of st because urxvt can be demonized and it spawns the window quicker.
jkl
Long time nixers
I uninstalled my last own FreeBSD server (I still am in charge of one for a local community who wants to do it themselves one day) last night, replacing it with another OpenBSD server. There are too many crashes and “surprising behaviors” in recent FreeBSDs (and, as this is a production server, I missed another opportunity to run NetBSD on anything).

The most annoying problem was to get ZNC running. As it turns out, IO::Socket won’t play well with LibreSSL, requiring separate listeners for IPv4 and IPv6. Try to find issues like this on your own!

Also, I successfully (?) fought relayd for the first time. I sincerely hope that I won’t have to do this too often.
seninha
Long time nixers
I have been playing with troff recently.
Motivated on that, I did a presentation on how to create a troff macro package, and I create a macro package.

This macro package contains macro for formatting books: format chapters, generate table of contents, do footnotes, etc.

To experiment the macros, I formatted a book using them.
The book I chose was The Cathedral and the Bazaar, by esr.
You can find the source code of the book (and the book itself, in pdf format) here: https://github.com/phillbush/catb-mb
I formatted it to fit on my ereader screen.
movq
Long time nixers
(19-11-2021, 02:03 AM)seninha Wrote: You can find the source code of the book (and the book itself, in pdf format) here: https://github.com/phillbush/catb-mb

I really want to dig through all that. I want to use troff more often. I have some super large documents (thousands of pages) that are currently turned into PDFs using LaTeX, which is just insanely slow for documents of that size. troff should do the job just as fine and I hope that it’ll be quite a bit faster.

Other than that, I’m working mostly on twtxt stuff these days. I also revisited GPG and added signatures to my release tarballs and future git commits – but I’m not sure if I’ll keep it or have to start over or whatever, because I feel that I might not be smart enough for GPG.
seninha
Long time nixers
(21-11-2021, 02:40 PM)movq Wrote: I really want to dig through all that. I want to use troff more often. I have some super large documents (thousands of pages) that are currently turned into PDFs using LaTeX, which is just insanely slow for documents of that size. troff should do the job just as fine and I hope that it’ll be quite a bit faster.

You asked me about how I do TOC on the document; here I explain how I do that.
You can check my Makefile. It runs troff twice: It first parses some of the source files to generate a index.roff from the stderr of the troff command. The index.roff file describes the contents of the TOC. In a second pass, it processes the title.roff (the pages before the toc), index.roff (the TOC itself) and the other files, and outputs to the post processor (dpost), that will generate the document.

So, I have the following .roff files:
  • mb.tmac: The first argument on both passes. It contain the macro definitions.
  • fonts.roff: The second argument on both passes. It sets the fonts (in heirloom troff style, groff handles fonts differently).
  • title.roff: Only given as argument in the second pass, it describes the pages before the TOC.
  • index.roff: Only given as argument in the second pass, this file is generated by the first pass.
  • ${SRC}: The body of the book (chapters and appendix).

I'm writing a manual for the -mb macro package.
(Yes, I make it work first then write the documentation later...)