<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[nixers - Programming On Unix]]></title>
		<link>https://nixers.net/</link>
		<description><![CDATA[nixers - https://nixers.net]]></description>
		<pubDate>Fri, 08 May 2026 00:29:31 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[text coordinate systems]]></title>
			<link>https://nixers.net/Thread-text-coordinate-systems</link>
			<pubDate>Thu, 27 Jun 2024 18:13:44 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1973">ckester</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-text-coordinate-systems</guid>
			<description><![CDATA[Interesting discussion of some of the subtleties which come up when writing code to display and manipulate text:<br />
<br />
<a href="https://zed.dev/blog/zed-decoded-text-coordinate-systems" target="_blank" rel="noopener" class="mycode_url">https://zed.dev/blog/zed-decoded-text-co...te-systems</a><br />
<br />
Much of this echoes Finseth's classic book on implementing emacs-style editors, but with updates to reflect our Unicoded world.<br />
<br />
(Many people will avoid dealing with these issues by simply dropping in whatever text widget their favorite library provides, but I enjoy cooking from scratch.)]]></description>
			<content:encoded><![CDATA[Interesting discussion of some of the subtleties which come up when writing code to display and manipulate text:<br />
<br />
<a href="https://zed.dev/blog/zed-decoded-text-coordinate-systems" target="_blank" rel="noopener" class="mycode_url">https://zed.dev/blog/zed-decoded-text-co...te-systems</a><br />
<br />
Much of this echoes Finseth's classic book on implementing emacs-style editors, but with updates to reflect our Unicoded world.<br />
<br />
(Many people will avoid dealing with these issues by simply dropping in whatever text widget their favorite library provides, but I enjoy cooking from scratch.)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Assembly] Need a good resources to start]]></title>
			<link>https://nixers.net/Thread-Assembly-Need-a-good-resources-to-start</link>
			<pubDate>Fri, 25 Mar 2022 01:11:12 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=2201">strawman2511</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Assembly-Need-a-good-resources-to-start</guid>
			<description><![CDATA[Well, I am back and I guess need you guys to help me again? Does anyone here know Assembly and know good place to start and learn it. I currently know how to read C, HTML, CSS, a little JavaScript, Go and Python. And seem like Assembly is the last piece I need to know before I can start learning about Operating System and Web browser and etc.. stuff like that. But before go further I must build my strong background in bit and Assembly through hope that someone in here will give good advice for me.]]></description>
			<content:encoded><![CDATA[Well, I am back and I guess need you guys to help me again? Does anyone here know Assembly and know good place to start and learn it. I currently know how to read C, HTML, CSS, a little JavaScript, Go and Python. And seem like Assembly is the last piece I need to know before I can start learning about Operating System and Web browser and etc.. stuff like that. But before go further I must build my strong background in bit and Assembly through hope that someone in here will give good advice for me.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Command-line interface on GUI programs.]]></title>
			<link>https://nixers.net/Thread-Command-line-interface-on-GUI-programs</link>
			<pubDate>Thu, 24 Jun 2021 23:12:01 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1965">seninha</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Command-line-interface-on-GUI-programs</guid>
			<description><![CDATA[The standard input and output have no use on most GUI applications.<br />
I have found, however, an application that makes use of the standard input for the user to type commands: gnubg, GNU's backgammon game.<br />
<br />
Here's a sample video.  On the video, I first type "new game" to start a new game, then "roll" to roll the dice, "help" to get a dialog window listing known commands, and "move" to move the tokens.  Then, I type ^D (Control+D) to send EOF and close the game.<br />
<br />
<a href="https://0x0.st/-pop.mp4" target="_blank" rel="noopener" class="mycode_url">Here's the video.</a><br />
<br />
This command-based interface is not available when the user opens gnubg(1) from the application menu/start menu, only when the stdin is connected to a terminal.<br />
<br />
However, the commands are fundamental to the game operations: menu entries and the icons on the toolbar are bound to commands (clicking in one of them has the same effect as entering a command on stdin).  You can also run a game from a script either by pipeing it to the stdin; or by running gnubg(1) with the -c option; or from the menu bar on File/Open Commands.<br />
<br />
I found that interface really interesting, because it can be extended and composed with other applications.  The user can run gnubg(1) from a script and call dmenu to run commands from it and/or get a list of commands within dmenu (mimicking HUD on the Unity DE from Ubuntu).<br />
<br />
MacOS' global menu bar can also be mimicked.  We can have a global menu bar in which clicking on a option on the menu bar sends commands to the stdin of the process of the active window.<br />
<br />
This kind of interface: a regular user interface that also interprets command is nothing new on TUI (aka roguelike interfaces): Vim and emacs have a command-line interpreter at the bottom of their windows.  Ranger, lf and other file managers can also interpret commands while also being controlled by usual keybindings.<br />
<br />
With this kind of interface we can bind commands to menu entries, icons, and hotkeys with separate programs like dmenu and sxhkd.<br />
<br />
Something like a command-line interface is being implemented in <a href="https://www.debugpoint.com/2021/05/kcommandbar-kde-feature/" target="_blank" rel="noopener" class="mycode_url">QT5 applications for KDE</a>.  The user can enter commands in a dmenu-like prompt, those commands are interpreted by the toolkit, which will run the corresponding action for the application.<br />
<br />
That kind of GUI interface, so unexplored, influenced me in projecting two different, but related applications: control and xfiles.  Xfiles will be a GUI file manager that reads commands from the stdin.  Control will have server and client processes.  The server is a macOS-like bar with global menu that changes its menus based on the current active window.  The client is a wrapper; calling "control xfiles" will open xfiles with its stdin bound to control, allowing the user to control xfiles (ie., send commands to its stdin) from the global menu bar.  Control will know which process stdin corresponds to which window by means of <a href="https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt" target="_blank" rel="noopener" class="mycode_url">startup notification</a>.<br />
<br />
Control and xfiles are still in my mind, and will be there for a long time, as I do not have time to work on them (my uni is returning next semester).<br />
<br />
What do you think of a command-line interface (CLI) for GUI applications?<br />
And what do you think in implementing CLI in GUI by means of the standard interface (as gnubg does)?<br />
Are CLI and GUI unrelated or can they be used together?<br />
What do you think of KDE way of implementing CLI in GUI by means of the QT toolkit?<br />
What solution is better: including CLI in GUI via stdin or via toolkit?<br />
<br />
I think that implementing CLI in GUI, while not caring about implementing menu bars, toolbars and keybindings in the application, is the UNIXy way of GUI interfaces: let the actual interface to be done by other programs (dmenu, sxhkd, macos-like global menu, etc), concentrate only on interpreting a little language and separate the interface from the engine.]]></description>
			<content:encoded><![CDATA[The standard input and output have no use on most GUI applications.<br />
I have found, however, an application that makes use of the standard input for the user to type commands: gnubg, GNU's backgammon game.<br />
<br />
Here's a sample video.  On the video, I first type "new game" to start a new game, then "roll" to roll the dice, "help" to get a dialog window listing known commands, and "move" to move the tokens.  Then, I type ^D (Control+D) to send EOF and close the game.<br />
<br />
<a href="https://0x0.st/-pop.mp4" target="_blank" rel="noopener" class="mycode_url">Here's the video.</a><br />
<br />
This command-based interface is not available when the user opens gnubg(1) from the application menu/start menu, only when the stdin is connected to a terminal.<br />
<br />
However, the commands are fundamental to the game operations: menu entries and the icons on the toolbar are bound to commands (clicking in one of them has the same effect as entering a command on stdin).  You can also run a game from a script either by pipeing it to the stdin; or by running gnubg(1) with the -c option; or from the menu bar on File/Open Commands.<br />
<br />
I found that interface really interesting, because it can be extended and composed with other applications.  The user can run gnubg(1) from a script and call dmenu to run commands from it and/or get a list of commands within dmenu (mimicking HUD on the Unity DE from Ubuntu).<br />
<br />
MacOS' global menu bar can also be mimicked.  We can have a global menu bar in which clicking on a option on the menu bar sends commands to the stdin of the process of the active window.<br />
<br />
This kind of interface: a regular user interface that also interprets command is nothing new on TUI (aka roguelike interfaces): Vim and emacs have a command-line interpreter at the bottom of their windows.  Ranger, lf and other file managers can also interpret commands while also being controlled by usual keybindings.<br />
<br />
With this kind of interface we can bind commands to menu entries, icons, and hotkeys with separate programs like dmenu and sxhkd.<br />
<br />
Something like a command-line interface is being implemented in <a href="https://www.debugpoint.com/2021/05/kcommandbar-kde-feature/" target="_blank" rel="noopener" class="mycode_url">QT5 applications for KDE</a>.  The user can enter commands in a dmenu-like prompt, those commands are interpreted by the toolkit, which will run the corresponding action for the application.<br />
<br />
That kind of GUI interface, so unexplored, influenced me in projecting two different, but related applications: control and xfiles.  Xfiles will be a GUI file manager that reads commands from the stdin.  Control will have server and client processes.  The server is a macOS-like bar with global menu that changes its menus based on the current active window.  The client is a wrapper; calling "control xfiles" will open xfiles with its stdin bound to control, allowing the user to control xfiles (ie., send commands to its stdin) from the global menu bar.  Control will know which process stdin corresponds to which window by means of <a href="https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt" target="_blank" rel="noopener" class="mycode_url">startup notification</a>.<br />
<br />
Control and xfiles are still in my mind, and will be there for a long time, as I do not have time to work on them (my uni is returning next semester).<br />
<br />
What do you think of a command-line interface (CLI) for GUI applications?<br />
And what do you think in implementing CLI in GUI by means of the standard interface (as gnubg does)?<br />
Are CLI and GUI unrelated or can they be used together?<br />
What do you think of KDE way of implementing CLI in GUI by means of the QT toolkit?<br />
What solution is better: including CLI in GUI via stdin or via toolkit?<br />
<br />
I think that implementing CLI in GUI, while not caring about implementing menu bars, toolbars and keybindings in the application, is the UNIXy way of GUI interfaces: let the actual interface to be done by other programs (dmenu, sxhkd, macos-like global menu, etc), concentrate only on interpreting a little language and separate the interface from the engine.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[What is your coding style?]]></title>
			<link>https://nixers.net/Thread-What-is-your-coding-style</link>
			<pubDate>Tue, 25 May 2021 14:43:41 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1965">seninha</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-What-is-your-coding-style</guid>
			<description><![CDATA[Recently I have been reading other people's coding style.<br />
I have read <a href="http://doc.cat-v.org/bell_labs/pikestyle" target="_blank" rel="noopener" class="mycode_url">Rob Pike's</a>, <a href="https://suckless.org/coding_style/" target="_blank" rel="noopener" class="mycode_url">suckless'</a>, some <a href="http://aiju.de/misc/c-style" target="_blank" rel="noopener" class="mycode_url">9front</a> <a href="https://ftrv.se/3" target="_blank" rel="noopener" class="mycode_url">developers'</a>, and <a href="https://nxr.netbsd.org/xref/src/share/misc/style" target="_blank" rel="noopener" class="mycode_url">NetBSD</a> and <a href="https://man.openbsd.org/style.9" target="_blank" rel="noopener" class="mycode_url">OpenBSD</a> coding styles.<br />
Those documents inspired me to write down all the subjective practices I have in my mind into objective conventions. And thus I wrote <a href="https://github.com/phillbush/home/blob/master/style.txt" target="_blank" rel="noopener" class="mycode_url">my coding style</a>.<br />
<br />
What do you think of those coding styles?<br />
Do they enforce good practice or are they too normative to be feasible?<br />
Do you have a coding style you follow in your projects? If yes, why not writing it down?]]></description>
			<content:encoded><![CDATA[Recently I have been reading other people's coding style.<br />
I have read <a href="http://doc.cat-v.org/bell_labs/pikestyle" target="_blank" rel="noopener" class="mycode_url">Rob Pike's</a>, <a href="https://suckless.org/coding_style/" target="_blank" rel="noopener" class="mycode_url">suckless'</a>, some <a href="http://aiju.de/misc/c-style" target="_blank" rel="noopener" class="mycode_url">9front</a> <a href="https://ftrv.se/3" target="_blank" rel="noopener" class="mycode_url">developers'</a>, and <a href="https://nxr.netbsd.org/xref/src/share/misc/style" target="_blank" rel="noopener" class="mycode_url">NetBSD</a> and <a href="https://man.openbsd.org/style.9" target="_blank" rel="noopener" class="mycode_url">OpenBSD</a> coding styles.<br />
Those documents inspired me to write down all the subjective practices I have in my mind into objective conventions. And thus I wrote <a href="https://github.com/phillbush/home/blob/master/style.txt" target="_blank" rel="noopener" class="mycode_url">my coding style</a>.<br />
<br />
What do you think of those coding styles?<br />
Do they enforce good practice or are they too normative to be feasible?<br />
Do you have a coding style you follow in your projects? If yes, why not writing it down?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[POSIX Shell Programming Challenge]]></title>
			<link>https://nixers.net/Thread-POSIX-Shell-Programming-Challenge</link>
			<pubDate>Mon, 12 Apr 2021 13:36:27 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1162">mort</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-POSIX-Shell-Programming-Challenge</guid>
			<description><![CDATA[Hi,<br />
<br />
I thought it would be fun to have a small shell programming challenge on here. The challenge is to iterate over <span style="font-style: italic;" class="mycode_i">all</span> the files in a directory and print their path, without looking at the internet for guidance. We will then try to come up with ways in which proposed solutions are incorrect.<br />
<br />
Here are the criteria:<br />
<ul class="mycode_list"><li>Iterate over all the files in the directory "test" (assume it exists) and print their names<br />
</li>
<li>Include hidden files, but exclude "." and ".."<br />
</li>
<li>All legal file names must be supported, so the only characters you may assume are not in a file name are "/" and the 0 byte<br />
</li>
<li>Don't be recursive, directories should be treated as files<br />
</li>
<li>The body of the loop must be in the same process as the rest of the script<br />
</li>
<li>You may only use POSIX shell syntax, no bashisms<br />
</li>
</ul>
<br />
Here's an example:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for f in test/*; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo "&#36;f"<br />
done</code></div></div><br />
And some possible critiques:<br />
<ul class="mycode_list"><li>The solution only considers visible files, it wouldn't see a file prefixed with "."<br />
</li>
<li>The solution doesn't work if there are no (non-hidden) files in the directory; the loop will end up printing "test/*"<br />
</li>
</ul>
<br />
Looking forwards to seeing what solutions and non-solutions y'all come up with 🤓<br />
<br />
EDIT: The idea behind the challenge is to end up with a shell loop over all the file names in a directory; printing the file names is just an example use case. Imagine replacing "echo" with some shell function or anything else. Also, it's not important whether the file name is prefixed with the path to the directory or not, because adding or removing a path prefix is trivial and not the point of the challenge.]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
I thought it would be fun to have a small shell programming challenge on here. The challenge is to iterate over <span style="font-style: italic;" class="mycode_i">all</span> the files in a directory and print their path, without looking at the internet for guidance. We will then try to come up with ways in which proposed solutions are incorrect.<br />
<br />
Here are the criteria:<br />
<ul class="mycode_list"><li>Iterate over all the files in the directory "test" (assume it exists) and print their names<br />
</li>
<li>Include hidden files, but exclude "." and ".."<br />
</li>
<li>All legal file names must be supported, so the only characters you may assume are not in a file name are "/" and the 0 byte<br />
</li>
<li>Don't be recursive, directories should be treated as files<br />
</li>
<li>The body of the loop must be in the same process as the rest of the script<br />
</li>
<li>You may only use POSIX shell syntax, no bashisms<br />
</li>
</ul>
<br />
Here's an example:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for f in test/*; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo "&#36;f"<br />
done</code></div></div><br />
And some possible critiques:<br />
<ul class="mycode_list"><li>The solution only considers visible files, it wouldn't see a file prefixed with "."<br />
</li>
<li>The solution doesn't work if there are no (non-hidden) files in the directory; the loop will end up printing "test/*"<br />
</li>
</ul>
<br />
Looking forwards to seeing what solutions and non-solutions y'all come up with 🤓<br />
<br />
EDIT: The idea behind the challenge is to end up with a shell loop over all the file names in a directory; printing the file names is just an example use case. Imagine replacing "echo" with some shell function or anything else. Also, it's not important whether the file name is prefixed with the path to the directory or not, because adding or removing a path prefix is trivial and not the point of the challenge.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Favourite Scripting Languages]]></title>
			<link>https://nixers.net/Thread-Favourite-Scripting-Languages</link>
			<pubDate>Wed, 24 Mar 2021 09:40:11 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=529">sulami</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Favourite-Scripting-Languages</guid>
			<description><![CDATA[I, and I imagine many others, have a wide collection of miscellaneous scripts to perform various tasks. "Scripts" in this case is defined as interpreted/not compiled/fast startup over runtime performance, shorter than ~150 LoC, and interacting heavily with the file system and/or other processes.<br />
<br />
The go-to language for this in the past has been shell scripts, but I keep getting annoyed by weird bashisms, the way it handles errors, the way it handles any kind of non-string data (numbers are already a pain, and don't get me started on associative arrays). Which means I now have a hodgepodge of languages, including Ruby, Racket, and Janet, (and more bash) with no clear idea of which to use when.<br />
<br />
Ruby has the backtick syntax which allows running shell commands without a lot of hassle. Contrary to Python, where subprocess includes a lot of ceremony for basic tasks.<br />
<br />
Janet is explicitly meant for scripting, but (1) I haven't really gotten into it, and (2) I have some doubts about the ecosystem and portability.<br />
<br />
Racket has been quite nice, as it has a very fully featured standard library &amp; package ecosystem, and is reasonably widely supported.<br />
<br />
I have also looked at:<br />
<br />
- Elvish: seems to be more focussed on being a rich interactive shell, and somewhat niche<br />
- Python: see the subprocess note above<br />
- Oil: looks promising, but not sure about stability yet<br />
- Haskell with shebang: just too much in every way<br />
- Common Lisp with Roswell: might be an okay option? Haven't really tried<br />
<br />
Another consideration I have not explored yet is the ability to build a library of useful utility functions, i.e. a decent module system.<br />
<br />
All of this is a long-winded way of saying:<br />
<br />
What do you use for scripting, and why?]]></description>
			<content:encoded><![CDATA[I, and I imagine many others, have a wide collection of miscellaneous scripts to perform various tasks. "Scripts" in this case is defined as interpreted/not compiled/fast startup over runtime performance, shorter than ~150 LoC, and interacting heavily with the file system and/or other processes.<br />
<br />
The go-to language for this in the past has been shell scripts, but I keep getting annoyed by weird bashisms, the way it handles errors, the way it handles any kind of non-string data (numbers are already a pain, and don't get me started on associative arrays). Which means I now have a hodgepodge of languages, including Ruby, Racket, and Janet, (and more bash) with no clear idea of which to use when.<br />
<br />
Ruby has the backtick syntax which allows running shell commands without a lot of hassle. Contrary to Python, where subprocess includes a lot of ceremony for basic tasks.<br />
<br />
Janet is explicitly meant for scripting, but (1) I haven't really gotten into it, and (2) I have some doubts about the ecosystem and portability.<br />
<br />
Racket has been quite nice, as it has a very fully featured standard library &amp; package ecosystem, and is reasonably widely supported.<br />
<br />
I have also looked at:<br />
<br />
- Elvish: seems to be more focussed on being a rich interactive shell, and somewhat niche<br />
- Python: see the subprocess note above<br />
- Oil: looks promising, but not sure about stability yet<br />
- Haskell with shebang: just too much in every way<br />
- Common Lisp with Roswell: might be an okay option? Haven't really tried<br />
<br />
Another consideration I have not explored yet is the ability to build a library of useful utility functions, i.e. a decent module system.<br />
<br />
All of this is a long-winded way of saying:<br />
<br />
What do you use for scripting, and why?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ffmpeg script to convert files]]></title>
			<link>https://nixers.net/Thread-ffmpeg-script-to-convert-files</link>
			<pubDate>Mon, 15 Mar 2021 03:22:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=2034">pfr</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-ffmpeg-script-to-convert-files</guid>
			<description><![CDATA[Hey nixers, I'm trying to figure out how to write a short script to convert all the media files in a directory and delete the old files.<br />
<br />
I found this on the web looking for answers<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php <br />
</span><span style="color: #FF8000">#!/bin/bash<br />
</span><span style="color: #007700">for </span><span style="color: #0000BB">i in </span><span style="color: #007700">*.</span><span style="color: #0000BB">mkv</span><span style="color: #007700">; do<br />
    </span><span style="color: #0000BB">ffmpeg </span><span style="color: #007700">-</span><span style="color: #0000BB">i </span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;i</span><span style="color: #DD0000">" </span><span style="color: #007700">-</span><span style="color: #0000BB">codec copy </span><span style="color: #DD0000">"</span><span style="color: #007700">&#36;{</span><span style="color: #0000BB">i</span><span style="color: #007700">%.*}</span><span style="color: #DD0000">.mp4"<br />
</span><span style="color: #0000BB">done <br />
</code></div></pre></div></div><br />
So, my question is, how do I add other file types to the fist line so that if I have a folder which contains .mkv &amp; .webm files then both file types will be converted to .mp4.<br />
<br />
Lastly, as this will create newly converted files, how can I have all old files deleted within this same script?]]></description>
			<content:encoded><![CDATA[Hey nixers, I'm trying to figure out how to write a short script to convert all the media files in a directory and delete the old files.<br />
<br />
I found this on the web looking for answers<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php <br />
</span><span style="color: #FF8000">#!/bin/bash<br />
</span><span style="color: #007700">for </span><span style="color: #0000BB">i in </span><span style="color: #007700">*.</span><span style="color: #0000BB">mkv</span><span style="color: #007700">; do<br />
    </span><span style="color: #0000BB">ffmpeg </span><span style="color: #007700">-</span><span style="color: #0000BB">i </span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;i</span><span style="color: #DD0000">" </span><span style="color: #007700">-</span><span style="color: #0000BB">codec copy </span><span style="color: #DD0000">"</span><span style="color: #007700">&#36;{</span><span style="color: #0000BB">i</span><span style="color: #007700">%.*}</span><span style="color: #DD0000">.mp4"<br />
</span><span style="color: #0000BB">done <br />
</code></div></pre></div></div><br />
So, my question is, how do I add other file types to the fist line so that if I have a folder which contains .mkv &amp; .webm files then both file types will be converted to .mp4.<br />
<br />
Lastly, as this will create newly converted files, how can I have all old files deleted within this same script?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[how many projects per repository?]]></title>
			<link>https://nixers.net/Thread-how-many-projects-per-repository</link>
			<pubDate>Tue, 23 Feb 2021 01:12:06 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=2054">freem</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-how-many-projects-per-repository</guid>
			<description><![CDATA[Hello.<br />
<br />
I wanted to ask a question: what do you think about "mono-repos", aka: one repo for a bunch of projects.<br />
One of the alternatives, which seems to me the more common solution, is to have one repo per project (say, "project-repo").<br />
And the other alternative, which is also quite common, is to have projects divided into sub-projects: repos which depends on other repos, this mostly happens within big projects (say, "split-repo"?).<br />
<br />
Personally, I've worked with mono-repos at work. It ended that, because of some peoples lack of skill, mono-repo was split, with repos depending on other repos (split-repo, since our codes had to work together anyway, and even shared code I wrote as libraries). Well, it was not really a sub-project division, but rather a per-dev division, since the unskilled one kept all his projects into a single repo (but at least could not pollute other's repos...).<br />
<br />
I have also contributed to "project-repos", and am still contributing to some "split-repos", which are kind of "encouraged" by git's submodule (shitty) system.<br />
<br />
My personal preference clearly goes to mono-repo, because it makes things easy as a dev: I have code I share between my projects. I put it in a subdirectory, each project have own directory. They even usually have their own branches (since I use git), that, when they have a changeset ready, gets rebased (so that I can keep a sane history) and then merged into master.<br />
This makes things pretty easy from both my side (which I consider most important one, since I'm the one working on it) and on user's side which have to bother about less dependencies.<br />
But, this approach also have disadvantages:<br />
* it makes it hard to point others at a specific project, since everything is in the same repo,<br />
* if a project grows too much, it can become quite heavy, which can become a problem depending on connnection,<br />
* history is "polluted", as in, it will not only be the history of the single part you're interested in. I try to workaround that by using prefix in commits' title, and with git it can be solved by specifying the directory you want history of, but that's still not easy/practical,<br />
* it requires discipline, in order to keep things organized. In my case, I forbid myself to touch multiple project's source-code in a single commit. Note that I don't consider the build system as code, to the contrary, I think it makes a lot of sense to have build system considered a project in it's own.<br />
<br />
The "project-repo" approach, which is probably the most common one, requires less discipline, but require more user's intervention, since it is then required to clone all required repositories.<br />
<br />
Both of those approaches have a big issue, though. If the project have some sub-parts with heavy files, like a game, there are technical issues when you try to clone or update the repo: bandwidth requirements, even if you don't intend to work on graphical, audio, or gameplay parts (usually called assets, but a recent discussion made me think it's a bad idea to call those assets, because that implies that the engine is worth nothing. Programmers are worth nothing...).<br />
This problems is solved by the "split-repo" approach, but this approach usually also introduces difficulties when someone tries to work with the whole project.<br />
<br />
So, which approach do you use?<br />
Why?<br />
In all situations?]]></description>
			<content:encoded><![CDATA[Hello.<br />
<br />
I wanted to ask a question: what do you think about "mono-repos", aka: one repo for a bunch of projects.<br />
One of the alternatives, which seems to me the more common solution, is to have one repo per project (say, "project-repo").<br />
And the other alternative, which is also quite common, is to have projects divided into sub-projects: repos which depends on other repos, this mostly happens within big projects (say, "split-repo"?).<br />
<br />
Personally, I've worked with mono-repos at work. It ended that, because of some peoples lack of skill, mono-repo was split, with repos depending on other repos (split-repo, since our codes had to work together anyway, and even shared code I wrote as libraries). Well, it was not really a sub-project division, but rather a per-dev division, since the unskilled one kept all his projects into a single repo (but at least could not pollute other's repos...).<br />
<br />
I have also contributed to "project-repos", and am still contributing to some "split-repos", which are kind of "encouraged" by git's submodule (shitty) system.<br />
<br />
My personal preference clearly goes to mono-repo, because it makes things easy as a dev: I have code I share between my projects. I put it in a subdirectory, each project have own directory. They even usually have their own branches (since I use git), that, when they have a changeset ready, gets rebased (so that I can keep a sane history) and then merged into master.<br />
This makes things pretty easy from both my side (which I consider most important one, since I'm the one working on it) and on user's side which have to bother about less dependencies.<br />
But, this approach also have disadvantages:<br />
* it makes it hard to point others at a specific project, since everything is in the same repo,<br />
* if a project grows too much, it can become quite heavy, which can become a problem depending on connnection,<br />
* history is "polluted", as in, it will not only be the history of the single part you're interested in. I try to workaround that by using prefix in commits' title, and with git it can be solved by specifying the directory you want history of, but that's still not easy/practical,<br />
* it requires discipline, in order to keep things organized. In my case, I forbid myself to touch multiple project's source-code in a single commit. Note that I don't consider the build system as code, to the contrary, I think it makes a lot of sense to have build system considered a project in it's own.<br />
<br />
The "project-repo" approach, which is probably the most common one, requires less discipline, but require more user's intervention, since it is then required to clone all required repositories.<br />
<br />
Both of those approaches have a big issue, though. If the project have some sub-parts with heavy files, like a game, there are technical issues when you try to clone or update the repo: bandwidth requirements, even if you don't intend to work on graphical, audio, or gameplay parts (usually called assets, but a recent discussion made me think it's a bad idea to call those assets, because that implies that the engine is worth nothing. Programmers are worth nothing...).<br />
This problems is solved by the "split-repo" approach, but this approach usually also introduces difficulties when someone tries to work with the whole project.<br />
<br />
So, which approach do you use?<br />
Why?<br />
In all situations?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Why is modular code so hard to implement?]]></title>
			<link>https://nixers.net/Thread-Why-is-modular-code-so-hard-to-implement</link>
			<pubDate>Mon, 09 Nov 2020 05:51:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1548">jkl</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Why-is-modular-code-so-hard-to-implement</guid>
			<description><![CDATA[I wrote a <a href="https://code.rosaelefanten.org/yaydl" target="_blank" rel="noopener" class="mycode_url">YouTube downloader</a> recently and I made an observation: While it is rather easy to dynamically load libraries during runtime, writing statically linked software that makes it easy to add new “libraries” (classes) is rather complicated. There seems to be no obvious way in most programming languages to automatically embed all files in a certain directory.<br />
<br />
My original plan was to simulate the default behavior of Go: Adding a new site to the list of supported sites would only require to add one file, the compiler would pick it up automatically. In Rust (yes, I am a software masochist, why do you ask?), this won’t work: I’ll still need to specify the new module in another file. (Arguably, this is already a relatively easy approach, but it took me a while to figure it out.)<br />
<br />
So I wonder why most languages don’t have Go’s “plug-in” compilation system that wouldn’t require additional files. Is this really an unusual use case?]]></description>
			<content:encoded><![CDATA[I wrote a <a href="https://code.rosaelefanten.org/yaydl" target="_blank" rel="noopener" class="mycode_url">YouTube downloader</a> recently and I made an observation: While it is rather easy to dynamically load libraries during runtime, writing statically linked software that makes it easy to add new “libraries” (classes) is rather complicated. There seems to be no obvious way in most programming languages to automatically embed all files in a certain directory.<br />
<br />
My original plan was to simulate the default behavior of Go: Adding a new site to the list of supported sites would only require to add one file, the compiler would pick it up automatically. In Rust (yes, I am a software masochist, why do you ask?), this won’t work: I’ll still need to specify the new module in another file. (Arguably, this is already a relatively easy approach, but it took me a while to figure it out.)<br />
<br />
So I wonder why most languages don’t have Go’s “plug-in” compilation system that wouldn’t require additional files. Is this really an unusual use case?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Benchmarking Pthread]]></title>
			<link>https://nixers.net/Thread-Benchmarking-Pthread</link>
			<pubDate>Tue, 03 Nov 2020 19:02:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=80">venam</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Benchmarking-Pthread</guid>
			<description><![CDATA[Hello nixers,<br />
I've been recently wondering about the effect of different pthread implementations, especially when it comes to scheduling between threads either CPU bound or not, different scheduling algorithms, and most importantly if using process contention scope or system contention scope affects normal usage "snappiness" and how much.<br />
<br />
I've been trying to find benchmarks à la TPC or SPEC, but I've only found this 20+ year old paper, <a href="https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1041.5809&amp;rep=rep1&amp;type=pdf" target="_blank" rel="noopener" class="mycode_url">Benchmarking Pthreads Performance</a>.<br />
According to it, process bound threads are faster to create, on all 4 machines tested, than system bound ones. However, there's no indication of the effect it would have on the normal computing. You could only guess what it would do.<br />
<br />
I find this especially important in a world where single processes now have hundreds of threads for themselves, and if ran in system contention scope could starve other processes.<br />
Especially that Linux only supports PTHREAD_SCOPE_SYSTEM, see man 3 pthread_attr_setscope.<br />
<br />
I'm wondering if anyone has more info on this or interesting benchmarks to share, especially from companies switching from Linux to FreeBSD or other types of system with different pthread default behavior. Or software that have modified their software to take advantage of certain facilities.<br />
<br />
<br />
<hr class="mycode_hr" />
Brief background info:<br />
There are two types of threads: kernel-level threads and user-level threads.<br />
Kernel-level threads are responsible for kernel stuff and handling system calls.<br />
User-level threads are the threads user create.<br />
<br />
User-level threads need to be mapped with kernel-level threads to be able to do anything useful. This could either be a one-to-one, one-to-many, or many-to-many relation. On most Unix-like system it's a one-to-one relation, for every thread there's a kernel thread (other than Solaris which is many-to-one).<br />
See <a href="https://en.wikipedia.org/wiki/Light-weight_process" target="_blank" rel="noopener" class="mycode_url">https://en.wikipedia.org/wiki/Light-weight_process</a><br />
<br />
The kernel schedules the priority of the kernel-level thread according to whatever scheme it has in place.<br />
What schedules the user-level thread is the thread library, in our case pthread.<br />
<br />
There are two big ways to take care of threads, either all threads from all processes are considered equals, system contention scope. Or threads from a single process are grouped together and considered a single thread block, all processes being scheduled as is, process contention scope.<br />
<br />
So if you have a 100 unit of processing time, 5 threads per process, and 3 processes, that would be.<br />
System contention scope: 6.66 units per thread regardless of the process.<br />
Process contention scope: 33.3 units per process, internally the process schedule these 33.3 between 5 threads.<br />
<br />
Obviously CPU bounding also plays a role, along with the type of pthread scheduling policy.<br />
<br />
Additional link: <a href="https://www.icir.org/gregor/tools/pthread-scheduling.html" target="_blank" rel="noopener" class="mycode_url">https://www.icir.org/gregor/tools/pthrea...uling.html</a>]]></description>
			<content:encoded><![CDATA[Hello nixers,<br />
I've been recently wondering about the effect of different pthread implementations, especially when it comes to scheduling between threads either CPU bound or not, different scheduling algorithms, and most importantly if using process contention scope or system contention scope affects normal usage "snappiness" and how much.<br />
<br />
I've been trying to find benchmarks à la TPC or SPEC, but I've only found this 20+ year old paper, <a href="https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1041.5809&amp;rep=rep1&amp;type=pdf" target="_blank" rel="noopener" class="mycode_url">Benchmarking Pthreads Performance</a>.<br />
According to it, process bound threads are faster to create, on all 4 machines tested, than system bound ones. However, there's no indication of the effect it would have on the normal computing. You could only guess what it would do.<br />
<br />
I find this especially important in a world where single processes now have hundreds of threads for themselves, and if ran in system contention scope could starve other processes.<br />
Especially that Linux only supports PTHREAD_SCOPE_SYSTEM, see man 3 pthread_attr_setscope.<br />
<br />
I'm wondering if anyone has more info on this or interesting benchmarks to share, especially from companies switching from Linux to FreeBSD or other types of system with different pthread default behavior. Or software that have modified their software to take advantage of certain facilities.<br />
<br />
<br />
<hr class="mycode_hr" />
Brief background info:<br />
There are two types of threads: kernel-level threads and user-level threads.<br />
Kernel-level threads are responsible for kernel stuff and handling system calls.<br />
User-level threads are the threads user create.<br />
<br />
User-level threads need to be mapped with kernel-level threads to be able to do anything useful. This could either be a one-to-one, one-to-many, or many-to-many relation. On most Unix-like system it's a one-to-one relation, for every thread there's a kernel thread (other than Solaris which is many-to-one).<br />
See <a href="https://en.wikipedia.org/wiki/Light-weight_process" target="_blank" rel="noopener" class="mycode_url">https://en.wikipedia.org/wiki/Light-weight_process</a><br />
<br />
The kernel schedules the priority of the kernel-level thread according to whatever scheme it has in place.<br />
What schedules the user-level thread is the thread library, in our case pthread.<br />
<br />
There are two big ways to take care of threads, either all threads from all processes are considered equals, system contention scope. Or threads from a single process are grouped together and considered a single thread block, all processes being scheduled as is, process contention scope.<br />
<br />
So if you have a 100 unit of processing time, 5 threads per process, and 3 processes, that would be.<br />
System contention scope: 6.66 units per thread regardless of the process.<br />
Process contention scope: 33.3 units per process, internally the process schedule these 33.3 between 5 threads.<br />
<br />
Obviously CPU bounding also plays a role, along with the type of pthread scheduling policy.<br />
<br />
Additional link: <a href="https://www.icir.org/gregor/tools/pthread-scheduling.html" target="_blank" rel="noopener" class="mycode_url">https://www.icir.org/gregor/tools/pthrea...uling.html</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Alternative programming languages and their usability on *nix]]></title>
			<link>https://nixers.net/Thread-Alternative-programming-languages-and-their-usability-on-nix</link>
			<pubDate>Fri, 23 Oct 2020 07:36:53 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=2045">opfez</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Alternative-programming-languages-and-their-usability-on-nix</guid>
			<description><![CDATA[Hello!<br />
I've been trying out a bunch of languages the past months, and wanted to start some discussion on the usage of other languages than traditional ones (C/++, Perl, Python, etc.).<br />
One of the most interesting ones is Common Lisp. I've written a phlog post on programming in it on the gopher://g.nixers.net, but the main take away is that it is incredibly fun to work with. It's cool because it's not as simple as recompiling your project when you make changes, you can individually compile parts of your program, like a function, and try it out in the REPL afterwards. The downside is that it is very much dpendent on the REPL and it's hard to get a nice binary to send to others. I also find it not very *nix friendly as it isn't good to work with stdin and stdout like most (good) Unix tools.<br />
Another one is Zig. My best description of it is "a modern C". It is basically a huge fork of C, but it's very different. The preprocessor, for example, is gone. One of the most interesting things with Zig is the ability to execute code in compile time. Asserts, if/else checks, anything can be executed at compile time, making it great for debugging. It's completely compatible with the C ABI, so you can use any of your favorite C libraries with it. Therefore, it has great *nix compatibility. Hooray!<br />
Other languages I'm a bit interested in is Julia, with it's multiple dispatch-oriented design and Scheme, being a more simplistic Lisp with the ability to time travel in your programs (?!).<br />
<br />
What languages are you most excited about, and how are they to work with in *nix?<br />
<br />
Edit: Got an idea for a follow up question: What language do you think future *nix tools will be written in? Will they be written in C, or something more modern like Go?]]></description>
			<content:encoded><![CDATA[Hello!<br />
I've been trying out a bunch of languages the past months, and wanted to start some discussion on the usage of other languages than traditional ones (C/++, Perl, Python, etc.).<br />
One of the most interesting ones is Common Lisp. I've written a phlog post on programming in it on the gopher://g.nixers.net, but the main take away is that it is incredibly fun to work with. It's cool because it's not as simple as recompiling your project when you make changes, you can individually compile parts of your program, like a function, and try it out in the REPL afterwards. The downside is that it is very much dpendent on the REPL and it's hard to get a nice binary to send to others. I also find it not very *nix friendly as it isn't good to work with stdin and stdout like most (good) Unix tools.<br />
Another one is Zig. My best description of it is "a modern C". It is basically a huge fork of C, but it's very different. The preprocessor, for example, is gone. One of the most interesting things with Zig is the ability to execute code in compile time. Asserts, if/else checks, anything can be executed at compile time, making it great for debugging. It's completely compatible with the C ABI, so you can use any of your favorite C libraries with it. Therefore, it has great *nix compatibility. Hooray!<br />
Other languages I'm a bit interested in is Julia, with it's multiple dispatch-oriented design and Scheme, being a more simplistic Lisp with the ability to time travel in your programs (?!).<br />
<br />
What languages are you most excited about, and how are they to work with in *nix?<br />
<br />
Edit: Got an idea for a follow up question: What language do you think future *nix tools will be written in? Will they be written in C, or something more modern like Go?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[What can a password contain]]></title>
			<link>https://nixers.net/Thread-What-can-a-password-contain</link>
			<pubDate>Tue, 20 Oct 2020 13:03:44 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=80">venam</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-What-can-a-password-contain</guid>
			<description><![CDATA[Hello nixers,<br />
Let me throw a brainstorming session on a question I've always wondered about.<br />
Can a unix password contain special characters, especially spaces.<br />
I know that this is feasible, as I've tested it on the command line. It can contain anything utf-8, even non-printable characters as long as it doesn't have the default erase or kill characters.<br />
<br />
However, the next question is: Which utilities are going to break and which ones are going to still function properly.<br />
Another question is, what happens when a password doesn't initially have an erase or kill character and the terminal settings are changed to make one of the character one of these. Will it then be impossible to type the password as it would erase or stop the readline? What about sending the password via other types of inputs than readline, does it still work?<br />
<br />
Let's have a go at testing this, the downsides and upsides.]]></description>
			<content:encoded><![CDATA[Hello nixers,<br />
Let me throw a brainstorming session on a question I've always wondered about.<br />
Can a unix password contain special characters, especially spaces.<br />
I know that this is feasible, as I've tested it on the command line. It can contain anything utf-8, even non-printable characters as long as it doesn't have the default erase or kill characters.<br />
<br />
However, the next question is: Which utilities are going to break and which ones are going to still function properly.<br />
Another question is, what happens when a password doesn't initially have an erase or kill character and the terminal settings are changed to make one of the character one of these. Will it then be impossible to type the password as it would erase or stop the readline? What about sending the password via other types of inputs than readline, does it still work?<br />
<br />
Let's have a go at testing this, the downsides and upsides.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Netflix from the command line?]]></title>
			<link>https://nixers.net/Thread-Netflix-from-the-command-line</link>
			<pubDate>Thu, 15 Oct 2020 23:35:50 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=2034">pfr</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Netflix-from-the-command-line</guid>
			<description><![CDATA[I didn't really know where to post this so venam please move it if necessary.<br />
<br />
I am wondering if there are yet any ncurses/cli/tui netflix apps? I have done a bit of a search but elgoog isn't showing me much. <br />
<br />
I was thinking, I can log into Spotify using their API and listen to music from my terminal using ncspot, surely there is an ncurses netflix tool that would allow me to browse through thumbnails (possibly displayed with w3m-img or even sixel) and then simply launch streams in mpv? Provided Netflix has an API..<br />
<br />
Someone please tell me this app exists already because it would change my life :) <br />
<br />
So far the only thing I've come across that looks interesting is <a href="https://github.com/magiruuvelvet/LightweightQtDRMStreamViewer" target="_blank" rel="noopener" class="mycode_url">QtDRMStreamViewer</a> but this still uses the the Qt Web engine and requires glibC to run it.]]></description>
			<content:encoded><![CDATA[I didn't really know where to post this so venam please move it if necessary.<br />
<br />
I am wondering if there are yet any ncurses/cli/tui netflix apps? I have done a bit of a search but elgoog isn't showing me much. <br />
<br />
I was thinking, I can log into Spotify using their API and listen to music from my terminal using ncspot, surely there is an ncurses netflix tool that would allow me to browse through thumbnails (possibly displayed with w3m-img or even sixel) and then simply launch streams in mpv? Provided Netflix has an API..<br />
<br />
Someone please tell me this app exists already because it would change my life :) <br />
<br />
So far the only thing I've come across that looks interesting is <a href="https://github.com/magiruuvelvet/LightweightQtDRMStreamViewer" target="_blank" rel="noopener" class="mycode_url">QtDRMStreamViewer</a> but this still uses the the Qt Web engine and requires glibC to run it.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[xnotify: popup a notification on your screen]]></title>
			<link>https://nixers.net/Thread-xnotify-popup-a-notification-on-your-screen</link>
			<pubDate>Mon, 21 Sep 2020 14:20:29 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1965">seninha</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-xnotify-popup-a-notification-on-your-screen</guid>
			<description><![CDATA[I dedicated the last weekend to write yet another X11 utility: <a href="https://github.com/phillbush/xnotify" target="_blank" rel="noopener" class="mycode_url">xnotify</a>.<br />
It is a notification launcher that reads notification from the stdin and displays it on your screen.<br />
You can create a fifo in order to echo stuff into it.<br />
<br />
For example:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>echo "Hello World" &gt; /tmp/xnotify.fifo</code></div></div><br />
Would create a notification with “Hello World” as its content.<br />
<br />
Here's a demo gif that illustrates its usage.<br />
<br />
<div ><div class="quotetitle"><input type="button" ckass="spoilerbutton" value="Show" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div class="quotecontent"><div style="display: none;">
<img src="https://user-images.githubusercontent.com/63266536/93690391-49b11780-fac7-11ea-96da-ab850dca1b9f.gif" alt="[Image: 93690391-49b11780-fac7-11ea-96da-ab850dca1b9f.gif]" class="mycode_img" loading="lazy" /><br />
</div></div></div>
<br />
To launch xnotify, add the following to your ~/.xinitrc:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>rm -f /tmp/xnotify.fifo<br />
mkfifo /tmp/xnotify.fifo<br />
xnotify &lt;/tmp/xnotify.fifo 3&lt;&gt;/tmp/xnotify.fifo &amp;</code></div></div><br />
You can use it together with <a href="https://github.com/Sweets/tiramisu" target="_blank" rel="noopener" class="mycode_url">tiramisu</a>, an application that outputs notifications to the stdout.<br />
<br />
I still have to improve the text and image placement on the notification window, so any idea is welcome.<br />
<br />
So, what do you think?]]></description>
			<content:encoded><![CDATA[I dedicated the last weekend to write yet another X11 utility: <a href="https://github.com/phillbush/xnotify" target="_blank" rel="noopener" class="mycode_url">xnotify</a>.<br />
It is a notification launcher that reads notification from the stdin and displays it on your screen.<br />
You can create a fifo in order to echo stuff into it.<br />
<br />
For example:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>echo "Hello World" &gt; /tmp/xnotify.fifo</code></div></div><br />
Would create a notification with “Hello World” as its content.<br />
<br />
Here's a demo gif that illustrates its usage.<br />
<br />
<div ><div class="quotetitle"><input type="button" ckass="spoilerbutton" value="Show" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div class="quotecontent"><div style="display: none;">
<img src="https://user-images.githubusercontent.com/63266536/93690391-49b11780-fac7-11ea-96da-ab850dca1b9f.gif" alt="[Image: 93690391-49b11780-fac7-11ea-96da-ab850dca1b9f.gif]" class="mycode_img" loading="lazy" /><br />
</div></div></div>
<br />
To launch xnotify, add the following to your ~/.xinitrc:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>rm -f /tmp/xnotify.fifo<br />
mkfifo /tmp/xnotify.fifo<br />
xnotify &lt;/tmp/xnotify.fifo 3&lt;&gt;/tmp/xnotify.fifo &amp;</code></div></div><br />
You can use it together with <a href="https://github.com/Sweets/tiramisu" target="_blank" rel="noopener" class="mycode_url">tiramisu</a>, an application that outputs notifications to the stdout.<br />
<br />
I still have to improve the text and image placement on the notification window, so any idea is welcome.<br />
<br />
So, what do you think?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Git updater shell script]]></title>
			<link>https://nixers.net/Thread-Git-updater-shell-script</link>
			<pubDate>Thu, 10 Sep 2020 05:30:13 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://nixers.net/member.php?action=profile&uid=1548">jkl</a>]]></dc:creator>
			<guid isPermaLink="false">https://nixers.net/Thread-Git-updater-shell-script</guid>
			<description><![CDATA[I have mentioned a couple of times that I refuse to use Git for versioning my files. Yet, I sometimes need to compile something which resides in a Git repository, usually from GitHub. I keep those repositories in <span style="font-style: italic;" class="mycode_i">&#36;HOME/github</span> and (randomly) other folders below <span style="font-style: italic;" class="mycode_i">&#36;HOME</span>. Keeping them updated is relatively annoying though, so I automatized it.<br />
<br />
You might want to modify &#36;BLACKLIST and &#36;GITDIRS, especially if you don’t use the <span style="font-style: italic;" class="mycode_i">bosh</span> for scripting and/or you keep your repositories elsewhere. (On standard POSIX shells, &#36;GITDIRS won’t work like this. Sorry. I might rewrite that line some day.)<br />
<br />
Usage: <span style="font-style: italic;" class="mycode_i">./gitup.sh</span>.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#!/opt/schily/bin/bosh<br />
# Update all Git repositories in/below &#36;HOME.<br />
<br />
# ---- VARIABLES<br />
<br />
# Contains a list of (substrings of) directories to skip.<br />
# It makes sense to not interfere with Go's own version control,<br />
# and on macOS the ~/Library folder should not be traversed<br />
# either.<br />
BLACKLIST="&#36;HOME/go/ &#36;HOME/Library"<br />
<br />
# Contains a list of Git repository directories.<br />
# Currently, this is collected automatically, but it can be a<br />
# manual list as well. Note that "find" on non-Schily shells<br />
# usually does not have a "-call" parameter.<br />
GITDIRS=`find &#36;HOME/git -maxdepth 3 -name '.?*' -prune -o -type d -call '[ -e "&#36;1/.git" ]' {} &#92;; -prune -print`<br />
<br />
# ---- CODE<br />
<br />
repocount=0<br />
for DIR in &#36;{GITDIRS}; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Blacklist check:<br />
&nbsp;&nbsp;&nbsp;&nbsp;allowed=1<br />
&nbsp;&nbsp;&nbsp;&nbsp;for BAN in &#36;{BLACKLIST}; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;substrings=`expr "&#36;DIR" : "&#36;BAN"`<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;substrings -ne 0 ] ; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This directory is in/below a blacklisted one.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allowed=0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
&nbsp;&nbsp;&nbsp;&nbsp;done<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;allowed -eq 0 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;# This directory is promised to be not blacklisted.<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Process it.<br />
&nbsp;&nbsp;&nbsp;&nbsp;repocount=`expr &#36;repocount + 1`<br />
&nbsp;&nbsp;&nbsp;&nbsp;cd &#36;DIR<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Check the remote state:<br />
&nbsp;&nbsp;&nbsp;&nbsp;git fetch -q<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;UPSTREAM=&#36;{1:-'@{u}'}<br />
&nbsp;&nbsp;&nbsp;&nbsp;LOCAL=`git rev-parse @`<br />
&nbsp;&nbsp;&nbsp;&nbsp;REMOTE=`git rev-parse "&#36;UPSTREAM"`<br />
&nbsp;&nbsp;&nbsp;&nbsp;BASE=`git merge-base @ "&#36;UPSTREAM"`<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;LOCAL = &#36;REMOTE ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This repository is up-to-date.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Do nothing with it.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
&nbsp;&nbsp;&nbsp;&nbsp;elif [ &#36;LOCAL = &#36;BASE ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# The remote version is newer.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "Updating Git repository: &#36;DIR"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git submodule sync -q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git pull -q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git submodule update --init --recursive<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git log &#36;LOCAL..&#36;REMOTE --date=short --pretty=format:"&nbsp;&nbsp;&nbsp;&nbsp; - New [%ad] : %s"<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Something is different.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "The Git repository in &#36;DIR needs to be merged."<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "This cannot be done automatically."<br />
&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
done</code></div></div><br />
Enjoy. Or modify as you need.]]></description>
			<content:encoded><![CDATA[I have mentioned a couple of times that I refuse to use Git for versioning my files. Yet, I sometimes need to compile something which resides in a Git repository, usually from GitHub. I keep those repositories in <span style="font-style: italic;" class="mycode_i">&#36;HOME/github</span> and (randomly) other folders below <span style="font-style: italic;" class="mycode_i">&#36;HOME</span>. Keeping them updated is relatively annoying though, so I automatized it.<br />
<br />
You might want to modify &#36;BLACKLIST and &#36;GITDIRS, especially if you don’t use the <span style="font-style: italic;" class="mycode_i">bosh</span> for scripting and/or you keep your repositories elsewhere. (On standard POSIX shells, &#36;GITDIRS won’t work like this. Sorry. I might rewrite that line some day.)<br />
<br />
Usage: <span style="font-style: italic;" class="mycode_i">./gitup.sh</span>.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#!/opt/schily/bin/bosh<br />
# Update all Git repositories in/below &#36;HOME.<br />
<br />
# ---- VARIABLES<br />
<br />
# Contains a list of (substrings of) directories to skip.<br />
# It makes sense to not interfere with Go's own version control,<br />
# and on macOS the ~/Library folder should not be traversed<br />
# either.<br />
BLACKLIST="&#36;HOME/go/ &#36;HOME/Library"<br />
<br />
# Contains a list of Git repository directories.<br />
# Currently, this is collected automatically, but it can be a<br />
# manual list as well. Note that "find" on non-Schily shells<br />
# usually does not have a "-call" parameter.<br />
GITDIRS=`find &#36;HOME/git -maxdepth 3 -name '.?*' -prune -o -type d -call '[ -e "&#36;1/.git" ]' {} &#92;; -prune -print`<br />
<br />
# ---- CODE<br />
<br />
repocount=0<br />
for DIR in &#36;{GITDIRS}; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Blacklist check:<br />
&nbsp;&nbsp;&nbsp;&nbsp;allowed=1<br />
&nbsp;&nbsp;&nbsp;&nbsp;for BAN in &#36;{BLACKLIST}; do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;substrings=`expr "&#36;DIR" : "&#36;BAN"`<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;substrings -ne 0 ] ; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This directory is in/below a blacklisted one.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allowed=0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
&nbsp;&nbsp;&nbsp;&nbsp;done<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;allowed -eq 0 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;# This directory is promised to be not blacklisted.<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Process it.<br />
&nbsp;&nbsp;&nbsp;&nbsp;repocount=`expr &#36;repocount + 1`<br />
&nbsp;&nbsp;&nbsp;&nbsp;cd &#36;DIR<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Check the remote state:<br />
&nbsp;&nbsp;&nbsp;&nbsp;git fetch -q<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;UPSTREAM=&#36;{1:-'@{u}'}<br />
&nbsp;&nbsp;&nbsp;&nbsp;LOCAL=`git rev-parse @`<br />
&nbsp;&nbsp;&nbsp;&nbsp;REMOTE=`git rev-parse "&#36;UPSTREAM"`<br />
&nbsp;&nbsp;&nbsp;&nbsp;BASE=`git merge-base @ "&#36;UPSTREAM"`<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if [ &#36;LOCAL = &#36;REMOTE ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This repository is up-to-date.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Do nothing with it.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
&nbsp;&nbsp;&nbsp;&nbsp;elif [ &#36;LOCAL = &#36;BASE ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# The remote version is newer.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "Updating Git repository: &#36;DIR"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git submodule sync -q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git pull -q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git submodule update --init --recursive<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;git log &#36;LOCAL..&#36;REMOTE --date=short --pretty=format:"&nbsp;&nbsp;&nbsp;&nbsp; - New [%ad] : %s"<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Something is different.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "The Git repository in &#36;DIR needs to be merged."<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "This cannot be done automatically."<br />
&nbsp;&nbsp;&nbsp;&nbsp;fi<br />
done</code></div></div><br />
Enjoy. Or modify as you need.]]></content:encoded>
		</item>
	</channel>
</rss>