Re: [dev] A secure wireless protocol

2023-10-16 Thread Josuah Demangeon
Sergey Matveev  wrote:
>*** Josuah Demangeon [2023-10-15 16:43]:
>>Not possible to do "tcpdump -i ipsec0" to see the packets going
>>*over* the VPN as there is no network interface for it
> 
>That depends on OS/configuration. There could be literally "ipsec"
>interface in FreeBSD to see exactly the packets flowing over that VPN.
>https://man.freebsd.org/cgi/man.cgi?query=if_ipsec=4

That is convenient and intuitively named.

>Personally I just used to use gif-tunnels (IP-in-IP) and apply transport
>mode ESP to them. Basically it has more-or-less (if we forget about ECN
>at least) the same behaviour/efficiency as native tunnel mode (that also
>encapsulates IP in IP and encrypts traffic between two tunnel endpoints)
>but at least you have gif-interface you can conveniently tcpdump.

This is some interesting setup. Then it is not needed to change the IPsec
configuration files all of the time, and firewall and routing rules can
be edited normally.



Re: [dev] A secure wireless protocol

2023-10-15 Thread Josuah Demangeon
> (OpenBSD added the pflog interface for tcpdump purpose though)

My bad, it is the enc(4) interface:
https://man.openbsd.org/enc.4

# ifconfig enc0
enc0: flags=0<>
index 2 priority 0 llprio 3
groups: enc
status: active
# tcpdump -i enc0
tcpdump: listening on enc0, link-type ENC
#



Re: [dev] A secure wireless protocol

2023-10-15 Thread Josuah Demangeon

Sergey Matveev  wrote:
> *** Sagar Acharya [2023-10-15 18:00]:
> >How many devices can connect to IPSec VPN?
> 
> Thousands easily. Depends on bandwidth and CPU speed mainly.

You can also find that protocol in almost any 'hardware' router
that claims to support a VPN: Mikrotik, StormShield, Fortinet,
Cisco...

> >What is the private key or secret key for these networks?
> 
> Various. Mostly either PSK (symmetric pre-shared key) or
> X.509-certificate-based keypair are used for authenticaion.
> (Symmetric) Encryption key of course is derived every time
> the IKEv2 session is started with the peer.

In attachment, a small "x509" script that I place in my ~/bin to manage
certificate by wrapping some of the OpenSSL's tedious syntax. Not
prime quality, but could help to get started.

> >Where does it lie?
> 
> Where you wish for. Depends on implementation. IPsec itself, its
> transport part (ESP protocol) generally live inside the kernel itself.
> IKEv2 daemon (like strongSwan for example) lives in userspace.

I forgot about that, good point!

IPsec is a bit particular as it does not have any network interface
for the VPN itself, instead the kernel intercepts the packets going
out if they match the configured rule (from Priv1 to Priv2) then
encrypt/reroute them and directly send them (from Pub1 to Pub2).

Because it all happens in the kernel with no network interface,
troubleshooting is a bit particular.

Not possible to do "tcpdump -i ipsec0" to see the packets going
*over* the VPN as there is no network interface for it (OpenBSD
added the pflog interface for tcpdump purpose though).

So the various tools like tcpdump, firewall config syntax, etc.
have special handling and syntax for it. Keyword: "XFRM".

After some time working with it, it becomes more intuitive, but
on day 1 I was lost! :)

> >Is it secure?
> 
> Depends on configuration parameters, implementation. IKEv2/ESPv3
> protocols in general are secure, yes.

It is used by banks, phone systems, corporate VPNs...

For debugging, you can try "PSK" or "pre-shared key" authentication
which is just a password, to avoid to combine the difficulty of
X.509 and IPsec.

Josuah.


x509
Description: application/shellscript


Re: [dev] Use of sdhcp

2023-10-05 Thread Josuah Demangeon
Sagar Acharya  wrote:
> I tried so much to find resources on learning networking and routing. I still 
> couldn't find any. ip man page is about implementation of several RFCs.

For the theory, you could read the introduction chapter of
Computer Networks by Tanenbaum (less than 80 pages for the intro):
https://csc-knu.github.io/sys-prog/books/Andrew%20S.%20Tanenbaum%20-%20Computer%20Networks.pdf

For the practical aspects, what you could look for is iproute2 (the name
of the project) rather than just "IP" (the name of the command),
which might yield you a bit of everything given how short the name is...

For instance, this one has some short overview of some of its usage
(skip anything like 'ip rule') this page alongwith the few "Next >"
ones that follow:
https://www.lartc.org/howto/lartc.iproute2.html

The Wikipedia page has some short overview, of a few useful commands:
https://en.wikipedia.org/wiki/Iproute2

This one is a more complete guide oriented towards a lot of operations.
You might not need everything, but if you need to do *something* this
is where to look at.
https://www.baturin.org/docs/iproute2/

Remember: if you use the ip command directly and do not write things to a file,
things will be temporary, you can reboot to get a fresh environment.
 
> It's at eth1. Initially, do I have to flush settings pr clear those of eth1? 
> How do I enable this on startup?

There are various ways to setup this at boot time, and an easier way

> Is the setup below like that of host 1 as a master and host 2 as slave? Which 
> port will the network work on?

Master/Slave is present in many locations in hardware,
but for networking, things tends to be a bit more symmetrical:
only nodes: a typical home ISP internet modem/router is often
*both* a DHCP server and DHCP client.

Everything can be called a "computer".

Some computers have a very boring role: "routers", they cannot
be used to play video games like DooM (unless you try hard enough! :P)
but usually only forward the traffic from one end to the other end.

But any "personal" or "user" device can be turned into a router!

For instance, a phone is typically a DHCP client device (receives
an Internet connection from WiFi or LTE), but you can turn on
WiFi or USB tethering and suddenly it is a DHCP server, and acts
as a router!

A "network" is the imaginary area *between* several interfaces
(such as wlan0 and eth0 and eth1). And a computer can be part
of two networks: If you have both WiFi and Ethernet, your
WiFi interface (wlan0) will be in the WiFi network (for instance
192.168.1.0/24) and your Ethernet interface (wlan0) will be in
the Ethernet network (for instance 192.168.2.0/24).

So interesting thing to realize when doing networking, is that
IP addresses are put onto *interfaces* rather than *network*

Remember "ip addr add 192.168.43.1/24 dev eth0"? Notice how
the device (= network interface) was specified?

See how "ip addr show" the IP addresses are listed under each
*network interface* rather than all along for one computer?

This is really this: addresses are added to network *interfaces*.

More on a next episode :) (I need to go back to work)...

> Say I wget host_1_public_ipv4:80 , will it reach host 2?

Once static routing is setup, then yes, although your host 2 will
need some software listenning on port 80 for that to work.

What I propose is to run the ping command on one side,
and tcpdump on the other to see the traffic.

Then even if you have something misconfigured, you might still be
able to deduce what is going wrong thanks to tcpdump.

> Thanking you
> Sagar Acharya
> 
> On 5 October 2023 7:55:25 pm IST, Josuah Demangeon  wrote:
> >Hello Sagar Acharya,
> >
> >Let me know if I misunderstood, but I believe you are mixing two things:
> >
> >If you have a cat6 ethernet cable, then you likely already have a network 
> >card.
> >You do not need DHCP to get two computers communicate, you can use static 
> >addressing, which is easier to use than DHCP.
> >
> ># on host 1, as user "root", assuming your network interface is "eth0"
> >ip link set eth0 up   # turn it on
> >ip addr add eth0 192.168.34.1/24 dev eth0 # put an address on it
> >ip addr show  # review the configuration
> >
> ># on host 2, as user "root", assuming your network interface is "eth0"
> >ip link set eth0 up   # turn it on
> >ip addr add eth0 192.168.34.2/24 dev eth0 # put an address on it
> >ip addr show  # review the configuration
> >
> >I used 34 as subnetwork, but you can use anything else.
> >If you have just a few computers, you can manage the addresses like above.
> >a bit more ma

Re: [dev] Use of sdhcp

2023-10-05 Thread Josuah Demangeon
Sean MacLennan  wrote:
> On Thu, 05 Oct 2023 16:25:25 +0200
> Josuah Demangeon  wrote:
> 
> > Which would provide something acting like Ethernet,
> > but out of a serial cable instead of a cat6 cable.
> 
> They could be running serial over a cat6 cable. Some of the embedded
> systems I am using do this. There is no ethernet involved, they are
> just re-purposing the cable.
> 
> Cheers,
>Sean

Good point, that went out of my mind!

This reminds me of this:
https://yost.com/computers/RJ45-serial/

Cheers,
   Josuah



Re: [dev] Use of sdhcp

2023-10-05 Thread Josuah Demangeon
Hello Sagar Acharya,

Let me know if I misunderstood, but I believe you are mixing two things:

If you have a cat6 ethernet cable, then you likely already have a network card.
You do not need DHCP to get two computers communicate, you can use static 
addressing, which is easier to use than DHCP.

# on host 1, as user "root", assuming your network interface is "eth0"
ip link set eth0 up   # turn it on
ip addr add eth0 192.168.34.1/24 dev eth0 # put an address on it
ip addr show  # review the configuration

# on host 2, as user "root", assuming your network interface is "eth0"
ip link set eth0 up   # turn it on
ip addr add eth0 192.168.34.2/24 dev eth0 # put an address on it
ip addr show  # review the configuration

I used 34 as subnetwork, but you can use anything else.
If you have just a few computers, you can manage the addresses like above.
a bit more manual work, but much less effort to debug.

But you can also use sdhcp (as an example) so that you have fewer
operations to do manually.

You would need a DHCP server on one host (acting as a router),
and a DHCP client (such as sdhcp) on the other host.

Sagar Acharya  wrote:
> How to use sdhcp? Can it be used to create an internal network where a cat6 
> cable is connected via /dev/ttyS1 to another PC.
> Is it possible to run a daemon which provides network in system 1 to the one 
> connected across /dev/ttyS1?

If you want to use networking out of a serial console, such as /dev/ttyS1,
you would need something like pppd (point-to-point daemon)
https://linux.die.net/man/8/pppd

Which would provide something acting like Ethernet,
but out of a serial cable instead of a cat6 cable.

Best luck with your experiments!



Re: [dev] Simpler WiFi alternatives

2023-05-14 Thread Josuah Demangeon
To anyone who was genuinely interested in the topic:

Since Arduino was pointed out, something on that level that is very widely used 
is the ESP32:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html

It happens that WiFi is cheap: a piece of PCB trace does an antenna, and a tiny 
inductor acts as a balun, that's it, you mostly have your WiFi transceiver.

The other way around is also possible: An MCU supporting Ethernet, and adding 
WiFi to it:

https://community.st.com/s/question/0D53W05qaHySAI/adding-wifi-to-stm32

Maybe some MCU with both Ethernet and a WiFi interface would work too:

https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-radiobr-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-radios:RW610

Ultimately, looking at what an existing product has could be insightful:

https://mikrotik.com/product/RB911-5HnD

> These days even embedded systems will likely use an RTOS which may
> include an existing protocol stack, e.g. RTEMS [2] uses a port of the
> FreeBSD stack.

RTEMS is doing great work! Never tried it though.

Zephyr is getting a lot of contributions/popularity.
Possibly because it got a fancy website and is having the Linux Foundation logo 
on it.
Possibly because a few vendors (Nordic in particular) dropped their own 
proprietary
RTOS in favor of it.

There might eventually be examples on how to plug things together and get 
something like that working.

Last but not least, it is always possible to try to find a part with both 
ethernet and wifi support:

https://octopart.com/electronic-parts/integrated-circuits-ics/embedded-processors-and-controllers/microcontrollers
https://octopart.com/electronic-parts/integrated-circuits-ics/embedded-processors-and-controllers/microprocessors


Sagar Acharya  wrote:
> Yep. That is true. I didn't think of that at all! But then, why do current 
> WiFi, etc. work at 2.4GHz, if device speeds aren't at those levels?
> 
> I'll try wireless transmissions of files at 10MHz then in the lower frequency 
> regions. Then by replacing hardware, maybe I'll just have to change a single 
> number!
> 
> I already use just wired connections but today's extreme use of mobile phones 
> has made securing wireless networks a compulsion!
> Thanking you
> Sagar Acharya
> http://humaaraartha.in 
> 
> 
> 
> 13 May 2023, 15:20 by d...@dbrooke.me.uk:
> 
> > A simpler alternative to WiFi is to use wires 8-)
> >
> > Seriously, the radio frequency techniques necessary to provide
> > sufficient throughput for today's applications are inevitably complex.
> >
> > On Fri, May 12, 2023 at 05:43:04PM +0200, Sagar Acharya wrote:
> >
> >> What I'm trying to find is a simple C program which can be run on Arduino 
> >> and analog pins connected to an antenna.
> >>
> >
> > The lowest frequency at which WiFi operates is the 2.4GHz band, an
> > Arduino (there are many variants, of which some will be faster) is
> > likely to be clocked at 10s of MHz so will be unable to generate
> > suitable radio frequency signals at its analogue pins.
> >
> > Back in the '90s I was running TCP/IP over amateur radio at low data
> > rates (9600 bps) using KA9Q NOS [1] which was a single C program for
> > DOS. It's probably close to the minimum needed for a router, although it
> > does typically include some application level features.
> >
> > These days even embedded systems will likely use an RTOS which may
> > include an existing protocol stack, e.g. RTEMS [2] uses a port of the
> > FreeBSD stack.
> >
> > David
> >
> > [1] http://www.ka9q.net/code/ka9qnos/
> > [2] https://www.rtems.org/



Re: [dev] Simpler WiFi alternatives

2023-05-12 Thread Josuah Demangeon
fo...@dnmx.org wrote:
> > On 23/05/11 04:03PM, fo...@dnmx.org wrote:
> > 
> 
> How am I a troll, and more importantly: so what if you don't like
> swearwords? I
> also don't like many things about you, for example you being a little
> worthless
> snowflake.
> 
> Sweardwords is literally just a list of words that are taboo-ed by the
> majority.
> I see no valid reason for me to stop swearing, unless this is like
> Facebook or
> some shit, otherwise get the fuck off, or ignore me.
> 
> 
> > This list needs moderation ASAP, otherwise it risks turning into another
> Reddit (which, for those who might not know, is a veritable cesspool).
> 
> Moderation is literally why Reddit sucks ;).
> I said I was horny as a child, and I got banned for 'sexualizing children'.
> If you think that is a valid reason, then you are seriously mentally demented
> and a banana has higher IQ than you.
> 
> Because of people like you YouTube is the way it is.. or at least for
> people like you* ;)
> If you think that YouTube is all nice and cool and "wow so for me", then
> you need to stop wasting my time and go consoome ShitTube until you die,
> censorship addict!

People able to implement routers and willing to work on unpaid open
source projects is a scarce resource.

I am not one of them (I have a banana IQ), but assume whoever is
choose to work with people not insulting them.



Re: [dev] Simpler WiFi alternatives

2023-05-12 Thread Josuah Demangeon
Страхиња Радић  wrote:
> On 23/05/11 04:03PM, fo...@dnmx.org wrote:
> 

Good point: if the author cares about the project presented,
why would he interleave every sentense with swearing.

> This list needs moderation ASAP, otherwise it risks turning into another 
> Reddit (which, for those who might not know, is a veritable cesspool).

Agreed, [dev] is not [rant]. This was not pleasant to read.

> [shittily-put rant]{1} which [should be useful]{2}

{1} does not work well with {2}... how about rewriting this draft
sent too early into a document that you can present to the firmware,
hardware, software, and gateware developers, and antenna designers
(essential if you want a bit of range, you talked about kilometers)
you'd need to team-up with to get such a project done?

Eventually on its own repo to synthesize the infirmation about it.

Even if you end-up finding a device that matches, the research about
it can then be useful to people interested in it.



Re: [dev] ii: how to process out in a pipeline and still page with less

2022-05-30 Thread Josuah Demangeon
Rodrigo Martins wrote:
> What if instead of changing every program we changed the standard
> library? We could make stdio line buffered by setting an environment
> variable.

I applaude this idea! Environment variables seems to be the right spot
for any config a library could need: are unobstrusive, can be set by the
program calling it, yet keep each program configurable by default.

Markus Wichmann  wrote:
> The problem you run into here is that there is more than one standard
> library.

The problem was stated here for libc's stdio, but I still like the idea
for new libraries: A call to getenv (which never fails), into xyz_init().

What about $DISPLAY, $MALLOC_OPTIONS (OpenBSD), or $LIBV4LCONTROL_FLAGS[1]
or some LIBXYZ_DEFAULT_DEV_FILE=/dev/xyz3?

Insane and breaking some important concept?
To keep for debugging purposes only?
Not to use for every kind of configuration?
Better let the programmer control the entirety of the library?

Although, if a library (or any program really) does not *require* any
configuration or environment variable and always works without that,
I like it even better.

[1]: 
https://github.com/philips/libv4l/blob/cdfd29/libv4lconvert/control/libv4lcontrol.c#L369-L371



Re: [dev] Status of compilers that suck less for riscv

2022-02-27 Thread Josuah Demangeon
> > What are some compilers for riscv architecture that suck less?
> Short answer: not for now, but I wish I would!

I should reword: I do not *know* any for now, but maybe there are some around!

Like this work for TCC: https://github.com/sellicott/tcc-riscv32
or maybe other small projects like this one: https://github.com/jserv/shecc



Re: [dev] Status of compilers that suck less for riscv

2022-02-27 Thread Josuah Demangeon
> I need support for riscv32. 

By the way, I am curious about what you are working on.



Re: [dev] Status of compilers that suck less for riscv

2022-02-27 Thread Josuah Demangeon
> What are some compilers for riscv architecture that suck less?
> I checked the 5 mentioned on suckless website and only tcc has riscv64 files 
> in it.
> I need support for riscv32. 

Short answer: not for now, but I wish I would!

For cross-compiling for embedded, I tried riscv64-unknown-elf-gcc
(which might be riscv32-unknown-elf-gcc on other systems).

It is as good and bad as GCC can be. Bugs (or me using it wrong?)
led me to try LLVM/Clang.

Clang, the other elephant in the room also worked, slightly better,
but it is also much known for its very large code base, taking ages
to compile.

After a while night compiling clang, all I could get is:

[ 83%] Linking CXX executable ../../bin/llvm-lto
ld: error: undefined symbol: llvm::PassBuilder::OptimizationLevel::O0

Therefore, if I do a full clean rebuild of everything, I need to wait
another night to get the next error.

The LLVM people might each have a $1 computer/server or have
robust patience.

I have not looked much further for now (getting ARM devices to blink
for now).

If I encounter something saner, I will let you know here.



Re: [dev] [surf] segmentation fault

2022-01-13 Thread Josuah Demangeon
m...@datameer.com wrote:
> Does that mean I have to compile surf incl all dependencies with
> https://github.com/void-linux/void-packages?
> 
> Or do you have any other hint for me?

Страхиња did show you the way : config.h is the user configuration
file, distributions might also want packages with reasonable config.h
letting other packages putting dependencies on i.e. surf, dmenu, st...

Given the error message:

> segfault at 570 ip 7f3e80b76a34 sp 7ffce08e3148 error 4 in 
> libwebkit2gtk-4.0.so.37.55.5[7f3e806d+2387000]

If you feel like there is something going wrong at surf level rather
than webkit itself (such as wrong use or configuration of webkit),
comparing how webkit is used in another browser could tell.

Another thing to try: first compiling surf from git with the packaged
webkit you already have, then check again to see if it still carshes.
This will tell if the bug can be fixed on surf or webkit level.



Re: [dev] Privilege escalation on remote hosts. MANY remote hosts.

2017-09-26 Thread Josuah Demangeon

Other people make different choices than you.


That is great.


Imagine that! Especially if they have other priorities than you.


This as well, but I feel large side effects of these choice is being
hidden to the people that make them: the cost of maintaining
all of these different languages in a same system.


P.S.: My stance is that whatever language gets the job done and works
for the developers involved is best, and don't let people from outside
the project convince you otherwise. I just noticed that all the
languages I learned except C don't get the job done for me.


I want to stick to C both because I like it (matter of tastes), but
also because it is the language the system is written in.

If all we had was OS written in Lisps for hardware efficient at
executing Lisp, I guess I would learn to love Lisp and write
everything in Lisp for not raising the complexity of the system
while writing programs...



Re: [dev] Opinions on GNU stow

2017-09-01 Thread Josuah Demangeon

In fact, I was thinking of writing a GNU Stow drop in replacement in
Suckless-style C when I find some time (GNU Stow is written in Perl, I
believe).


I am always a bit confused when I hear about GNU stow.  Does it provide 
more feature than this:


ETC=$(cd "${0%/*}" && pwd)
find "$ETC" -name .git -prune -o -path "$ETC/.*" | while IFS='' read -r 
path

do
[ -d "$path" ] && mkdir -p   "$HOME/${path#$ETC}"
[ -f "$path" ] && ln -sf "$path" "$HOME/${path#$ETC}"
done



Re: [dev] announcing edit-pipe

2017-08-27 Thread Josuah Demangeon

A similar tool made for the dvtm pager:
https://github.com/martanne/dvtm/raw/master/dvtm-editor.c

It saves stdin to a file and open an editor on it, then
if the file has changed since its creation, it print all
the content of the file to stdout.

It is used to copy a fragment of a file: select the
fragment and save it with :\<,\>w



Re: Re: [dev] Interesting Web Browser Decoupling Concept

2017-06-13 Thread Josuah Demangeon


sylvain.bertr...@gmail.com:
> worst: it is an obvious troll.
> 
> going to shorten it:
> 
> He's right, computer systems are ultra-secure: viruses and hacks (software and
> hardware) are a very rare thing, they do not happen all the time, at best this
> is an illuminaty conspiracy to make us believe the privilege escalation
> is a fallacy. Java is secure as all web browsers are. Ransomware is vaporware.

Now I reallize that I deeply lacked tact: that question was highly unapropriate.



Re: Re: [dev] Interesting Web Browser Decoupling Concept

2017-06-13 Thread Josuah Demangeon


On June 13, 2017 7:39:28 PM GMT+02:00, hiro <23h...@gmail.com> wrote:
> this is not a philosophy list, go back to school please.

You are right.  I fooled myself into believing it was for some technical 
reasons.



Re: Re: [dev] Interesting Web Browser Decoupling Concept

2017-06-13 Thread Josuah Demangeon


On June 13, 2017 7:29:14 PM GMT+02:00, sylvain.bertr...@gmail.com wrote:
> Only fools believe in computer security.
> I'm not one of them.

I am curious about the reasons as I am a total beginner
in that domain.  Do you mind to develop about it ?



Re: [dev] slconfigure

2017-05-29 Thread Josuah Demangeon
I am not disappointed when I see a simple ./configure script that generate a 
clean config.mk.  Would something like this be acceptable to for a suckless 
project ?

case "$(uname -a)" in
*Linux* )
XXXINC=/...
;;
*OpenBSD* )
XXXINC=/...
;;
*FreeBSD* )
XXXINC=/...
;;
esac

tee config.mk << EOF
XXXINC = $XXXINC
EOF

I just read this post about portability:
http://nullprogram.com/blog/2017/03/30/
"How to Write Portable C Without Complicating Your Build"



Re: [dev] [st] [PATCH 2/2] Keep end of lines in memory when resizing terminal

2017-03-27 Thread Josuah Demangeon


> Only recording raw output from commands, logging it to a text file
> like the script(1) command and calling a pager on this file while
> asking for scrollback.

man.openbsd.org/script:
> BUGS
>
> script places everything in the log file, including linefeeds and
> backspaces. This is not what the naive user expects.

There could still be still be some significant processing to do, though.



Re: [dev] [st] [PATCH 2/2] Keep end of lines in memory when resizing terminal

2017-03-27 Thread Josuah Demangeon
Of course some tool like acme would solve the problem, but it is a different 
approach.

For acme, the editor is a plain-text-only multiplexer (much easier to 
implement), and replaces every ncurses interfaces, so it is skipping the 
problem.

For sam, the editor '!' command, pipes the output to a dedicated buffer,  omly 
if it is too long, a bit like this in the end:


> I've played around a tiny bit with dumping
> everything that goes through st to a file [...]

Nothing that can handle arbitrary placement of the cursor on the terminal grid, 
like "\033[3;6H", just plain text.

But maybe a scrollback of just plain text (and text properties like 
"\033[m") would be good enough.

Only recording raw output from commands, logging it to a text file like the 
script(1) command and calling a pager on this file while asking for scrollback.

I rarely want to get a scrollback of an ncurses program.  Some of them sets an 
"alternate screen" signal cleaning the screen ("\033[?1049h") and restoring it 
afterward ("\033[?1049l") it ran.  Stripping everything in-between would strip 
most ncurses programs out of the feed.



Re: [dev] [st] [PATCH 2/2] Keep end of lines in memory when resizing terminal

2017-03-27 Thread Josuah Demangeon
In-between tmux and nothing, there is abduco(1): only attach/detach features.

One could set some $ABDUCO to the session name, and if not set, attach to 
latest abduco session.

Here is what I currently use [2]:


if [ "$ABDUCO" ]; then
printf 'session already active: %s\n' "$ABDUCO"
exit 1
fi

name="$(abduco | tail -n +2 | iomenu -l 10 | sed -r 's/[^\t]*\t[^\t]*\t//')"

printf '\033[H\033[J'

[ "$SSH_CLIENT" ] && detach_key='^\' || detach_key='^Z'
[ "$name" ] && ABDUCO="$name" exec abduco -e "$detach_key" -A "$name" "$SHELL"


iomenu [3] is dmenu for the terminal (yet another).

[1]: https://github.com/martanne/abduco
[2]: https://github.com/josuah/etc/raw/master/bin/io-abduco
[3]: https://github.com/josuah/iomenu



Re: [dev] [sltar] Listed project idea to extend sltar with compression

2017-02-10 Thread Josuah Demangeon

On 2017-02-10 20:47, Hiltjo Posthuma wrote:
On Fri, Feb 10, 2017 at 2:54 PM, yamada yohei  
wrote:

Why we have to specify -z -j -a -Z or -J when decompress tar ball?
Why doesn't tar distinguish them automatically? (It should achieve
using file(1) or magic(5) database.)  I cannot remember all these
options and always use pipeline e.g. bzcat | tar x.  I don't sltar to
have these useless options.


Nothing prevents you to write a shellscript wrapper [...]


It could be done with extensions:

case "$1" in
( *.tar.gz  ) tar -xzf "$1" ;;
( *.tgz ) tar -xzf "$1" ;;
( *.tar.bz2 ) tar -xjf "$1" ;;
( *.tbz2) tar -xjf "$1" ;;
( *.tar ) tar -xf  "$1" ;;
esac



Re: [dev] [ubase] pager

2017-02-09 Thread Josuah Demangeon
roqbin.a.t.peder...@gmail.com:

> I vaguely remember pagers discussed in a thread, and the conclusion was
> that pagers are unecessary because its the job of something like dvtm or
> tmux.

I also like to have the multiplexer managing the scrolling, but for dvtm, what 
provides the scrolling (and copy) is the $PAGER (and the $EDITOR) itself.



Re: [dev] looking for a simple music player

2017-02-07 Thread Josuah Demangeon
Simple Audio Daemon may be interesting:

http://git.2f30.org/sad/files.html



Re: [dev] looking for a simple music player

2017-02-07 Thread Josuah Demangeon
I would also be interested by such a program if one of you already know one.  
My workaround is this script:

http://github.com/josuah/config/raw/master/bin/play



Re: [dev] [ubase] pager

2017-02-04 Thread Josuah Demangeon


On February 4, 2017 10:49:52 AM GMT+01:00, "Mattias Andrée" <maand...@kth.se> 
wrote:
> On Sat, 4 Feb 2017 10:22:24 +0100
> Josuah Demangeon <m...@josuah.net> wrote:
> 
> > On February 4, 2017 2:03:16 AM GMT+01:00, "Mattias
> > Andrée" <maand...@kth.se> wrote:
> > > 
> > > Well, this is embarrassing, I forgot to check you
> > > program before starting on ul(1). However, I just ran
> > >
> > >   MAN_KEEP_FORMATTING=y man man | ./iode  
> > 
> > I made escape sequences tooglable with flags, maybe that
> > is the reason.
> > 
> > You can try enabling colour interpreting with +R (or
> > disabling it with -R).  Either as command-line flag or as
> > keybinding.
> 
> Silly me, I thought it was -R.

It is what is written on the man page and what less does.  I should update it.

Maybe -R is a better idea.  Maybe it is what sbase used to have.

>It works, but if you place
> util-linux's ul(1) between man(1) and iode you will see
> a problem.

I see ^O (shift-in) characters at the end of bold sequences.  Is that what you 
mean?  Less does not handle these neither, but I can, I could just set it to 
ignore them.

> I'm working on libgraffiti which ul(1) will use, it will
> support all escape sequences (I have
 read long lists of
> escape sequences to find a pattern that recognise all
> of them) along will things like combining marks. This
> library will also be useful for pagers, terminals, and
> similar programs.
>
> iode seem to be able to do everything needed to view
> man pages, but unlike ul(1) and most(1) it doesn't
> support e.g. `printf 'aaa\r___'`, but it doesn't have
> to as ul(1) can be used.

This will be very convenient, I was not aware of such a diversity

> I would recommend making +R the default, what would
> probably reduce confusion for users.

Yes, I will change it after line folding.

Do not hesitate to ask for explanation if something is unclear in the source.



Re: [dev] [ubase] pager

2017-02-04 Thread Josuah Demangeon


On February 4, 2017 2:03:16 AM GMT+01:00, "Mattias Andrée"  
wrote:
> 
> Well, this is embarrassing, I forgot to check you program
> before starting on ul(1). However, I just ran
>
>   MAN_KEEP_FORMATTING=y man man | ./iode

I made escape sequences tooglable with flags, maybe that is the reason.

You can try enabling colour interpreting with +R (or disabling it with -R).  
Either as command-line flag or as keybinding.

> and it is not able to display it properly, which is the
> only thing I have implemented in ul(1) so far. But I'll
> see if there are parts that can be reused.
> 
> maandree

There is also +/-N for line number, and I am trying line wrapping / stripping 
with +/-S in a "folding" branch.

I will iddle in #suckless if that helps.



Re: [dev] [ubase] pager

2017-02-02 Thread Josuah Demangeon
I started such a tool recently.  It is probably not suckless, as it is already 
1600 loc, but can properly display a man page, colour escape codes and content 
from UTF-8-test.txt and UTF8-demo.txt without ncurses.

http://github.com/josuah/iode

If this one sucks, I would be glad to see the implementation, as I will learn a 
lot from it.

I have also seen rirc (irc client) that does not use ncurses for its interface.

http://github.com/rcr/rirc/blob/master/draw.c



Re: [dev] Re: Linux distros that don't suck too too much

2017-02-02 Thread Josuah Demangeon


sylvain.bertr...@gmail.com:
>
> Write it in simple C, it's the best compromise. Compose C programs with 
> simple sh scripts.

It is fine this way, I will take this route.

> If you are here, you are looking for a cure to those diseases.

Yes, and am glad of what I already found here.  Thank you all for those efforts.

> If you cannot "see" this and want to keep your way: try "swift" from our dear
> friend apple corporation, which is better than "lua", of course!  [...]

Definetely not suckless.

Thank you for this answer, I think I got the point.



Re: [dev] Re: Linux distros that don't suck too too much

2017-02-01 Thread Josuah Demangeon


sylvain.bertr...@gmail.com:

> Useless to spend time on this, since guile is not suckless.

I am curious about the languages that you  would consider suckless.

I learned POSIX shell scripting and awk, I am also trying C and a few lua.

Is there something else you would advise to learn or something to avoid in 
properly used sh / awk / C / lua?  Myrddin is on my to-do list.



Re: [dev] [surf] Webkit2 with proxy server

2016-12-23 Thread Josuah Demangeon

On 2016-12-17 20:22, Cág wrote:
And this is why the web engine should be in C, hackable, simple and 
small enough

to be compiled with tcc/pcc/scc, just like other suckless software
(I haven't tried scc though, looks like active work is in progress by 
glancing

at the log and hackers list).


I just found this engine [1], it seems to have a better approach, even 
if I did not run it yet.  It is not a finished software, but at least 
there are ongoing efforts to write a C99 HTML renderer without 
dependencies.


[1]: https://lexborisov.github.io/Modest/



Re: [dev] [lnanosmtp]

2016-06-12 Thread Josuah Demangeon
Sorry, I was trying s-nail, and answered by mistake.

Have a nice day!

Re: [dev] Re: Linux distros that don't suck too too much

2016-05-12 Thread Josuah Demangeon
> The reason many people does not regard activities performed with
> computers as "complex" in the modern age is because they have been
> exposed to them long enough to learn how to use them up to some point.
> It is worth noticing that people with actually zero exposition to
> computers - like old people in rural isolated areas - is not able to
> create an email account or launch a preinstalled game without a great
> effort (which counts as learning experience).

An anecdote on this point:  In a mildly rural isolated area, there were
some kind of swap shop [1], so custommers can both sell and buy.


To check how their purchases were going, and how much they earned, they
have to use one very old computer: CRT screen, text mode, monospace
bitmap font, light gray background and dark blue foreground, blinking
cursor...

Although, people did not seem to have difficulty to use it:

Enter your custommer number with the keyboard then press the ENTER key:
 |_

*screen wipes out*

Your current balance is: $320
Do you want to use it for the next payment?
Press 'y' key to answer yes or 'n' key to answer no: |_

I have seen someone using maybe faster than what I would do, used to it,
, reading the onscreen indications and doing what was asked.  The whole
interface could be reproduced in a shell script only with printf and
read (not an ncurse one).

So it could be simple by its implementation, by its design, and simple
to use even for persons rarely using computers if at all, even
indication on how to interact with the keyboard are provided.

It does not give the impression of being the latest modern software and
it may not look attractive to the majority of nowadays computer users.
This may shift a large amount of user from simple, rather trivial
systems, to much more complex ones, sacrificing sanity.

[1]: http://www.brocantiq.fr/images/midi/31/troc7101.jpg