Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Cybernetic Vermin
Apr 18, 2005

BobHoward posted:

every time i have to write tcl (which i sometimes do, because it did kinda win in certain niches), i have to google for information about how to do poo poo. all this ever seems to find is mailing list arguments between tcl graybeards which got copied into a wiki article and called "documentation". not really the language's fault but trying to suss the truth out of that pile of noise is an extremely irritating way to try to learn how to write tcl, lol

this really surprises me, as tcl docs are to my experience excellent. but it might be connected to the second.

BobHoward posted:

also tcl somehow manages to be less straightforward than perl. idk, maybe my brain is broke, but i just don't get tcl or see why anyone would want to use it. my go-to plang is python3 because even though it sucks, the magnitude of its suckage is mostly less than perl

this does not surprise me though, tcl is really different, and while it is actually really simple there's an intervening "brain damage" moment before it clicks.

it's main feature to my mind though is that it is pretty much the ultimate "gradual" shell-like language, a normal person can very easily use the trivial core of running commands, and you can build your way up into real programs in a confident way, everything making sense each step. it is when you *start* with writing a real program it all looks bonkers.

as noted i specifically think tcl would have done a lot to make configuration and simple macro dsl's real graspable, while also being *vastly* more legit a programming language than any shell.

Adbot
ADBOT LOVES YOU

Cybernetic Vermin
Apr 18, 2005

for those who don't know it tcl basically goes "everything is a string" combined with "pretty much everything is a command with commandline flags etc." it is less sugar than bash, basic tcl programs look an awful lot like you've just grabbed your .zhistory except with some unusual programs.

i to be clear don't advice anyone to learn or use it, just that it would have been cool had it won out over a lot of crap we're still dragging along.

FlapYoJacks
Feb 12, 2009

Cybernetic Vermin posted:

for those who don't know it tcl basically goes "everything is a string" combined with "pretty much everything is a command with commandline flags etc." it is less sugar than bash, basic tcl programs look like you've just grabbed your .zhistory

wow, that sounds awful.

Cybernetic Vermin
Apr 18, 2005

FlapYoJacks posted:

wow, that sounds awful.

not much of a terminal user huh?

FlapYoJacks
Feb 12, 2009

Cybernetic Vermin posted:

not much of a terminal user huh?

I’m an embedded Linux engineer lol.

Cybernetic Vermin
Apr 18, 2005

FlapYoJacks posted:

I’m an embedded Linux engineer lol.

i know, and you should know that i know, or the slam might not work

it is good. if you want structured general programming sure it won't be it, but there's nothing bash does better than tcl, especially not as an analogue of shell use as programming.

FlapYoJacks
Feb 12, 2009

Cybernetic Vermin posted:

i know, and you should know that i know, or the slam might not work

it is good. if you want structured general programming sure it won't be it, but there's nothing bash does better than tcl, especially not as an analogue of shell use as programming.

Oh don’t get me wrong, I hate bash as well. We use zsh mostly because it’s gplv2 licensed and not ash, which is way worse most of the time.

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
Bash code:
$ function urlencode {   python3 -c "import urllib.parse; import sys; print(urllib.parse.quote(sys.argv[1]))" "$1"; }
$ ldapsearch -H "ldap:///$(urlencode DC=example,DC=com)" -b 'DC=example,DC=com' -Y GSSAPI \
   "(sAMAccountName=$(whoami))"
:shepface:


I am mad! Hahahaha! Completely mad!

FlapYoJacks
Feb 12, 2009

Antigravitas posted:

Bash code:
$ function urlencode {   python3 -c "import urllib.parse; import sys; print(urllib.parse.quote(sys.argv[1]))" "$1"; }
$ ldapsearch -H "ldap:///$(urlencode DC=example,DC=com)" -b 'DC=example,DC=com' -Y GSSAPI \
   "(sAMAccountName=$(whoami))"
:shepface:


I am mad! Hahahaha! Completely mad!

Are you my boss?

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
No.


-H ldapuri
Specify URI(s) referring to the ldap server(s); a list of URI, separated by whitespace or commas is expected; only the protocol/host/port fields are allowed. As an exception, if no host/port is specified, but a DN is, the DN is used to look up the corresponding host(s) using the DNS SRV
records
, according to RFC 2782. The DN must be a non‐empty sequence of AVAs whose attribute type is "dc" (domain component), and must be escaped according to RFC 2396.


And it actually works. Resolves responsible AD DCs via DNS just from the DN, grabs a ticket for the ldap/$DC SPN, and goes on to make the query without ever asking for a user name or password. It's also automatically encrypted and signed via Kerberos.

Reaching into Python just to urlencode a string in a shell script feels hysterical to me, but it works, lmao.

big black turnout
Jan 13, 2009



Fallen Rib
tcl rules as a host for making small DSLs for embedding in applications

Progressive JPEG
Feb 19, 2003

my order of escalation is:
- shell: max 20 lines, maybe with one or two if statements or functions, maybe one loop. literally "run this sequence of commands"
- python: single file, max 200 lines or so, with stdlib only
- rust: the rest (if it's a hobby project)

Progressive JPEG
Feb 19, 2003

i last touched tcl when running an eggdrop bot 15 years ago and even then it seemed pretty awful

Cybernetic Vermin
Apr 18, 2005

Progressive JPEG posted:

my order of escalation is:
- shell: max 20 lines, maybe with one or two if statements or functions, maybe one loop. literally "run this sequence of commands"
- python: single file, max 200 lines or so, with stdlib only
- rust: the rest (if it's a hobby project)

tbh same, with the addendum that i think i am wrong to stick with shell that long. if i ever (again) wreck something through software nonsense it'll probably be having written one line too many of shellscript

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
I just stay with Python for anything that can't trivially be done with a shell script. I bail on shell scripts as soon as the task I am trying to accomplish requires more than a trivial amount of logic. Shell is fine as glue for other programs to do the work.

FlapYoJacks
Feb 12, 2009

Progressive JPEG posted:

my order of escalation is:
- shell: max 20 lines, maybe with one or two if statements or functions, maybe one loop. literally "run this sequence of commands"
- python: single file, max 200 lines or so, with stdlib only
- rust: the rest (if it's a hobby project)

- Shell: Normally max of 100~ lines. A lot of post-build/post-image scripts when building Yocto/Buildroot images may take a few extra lines to make everything pretty and perfect. Vagrant may be several hundred lines and I hate it but it's a client and I can't say no.

- Python: Build everything in Python if you can if speed isn't a concern. Even in embedded land.

- Rust: The rest.

Tankakern
Jul 25, 2007

Shaggar posted:

they guy who made the good XPSes left Dell and they turned bad pretty much immediately


sigh

i got a xps 13 from 2022, at least it hasn't got that copilot key

wont buy again. god drat it dell

Cybernetic Vermin
Apr 18, 2005

every xps 13 has been garbage and i am glad they're dead

mystes
May 31, 2006

Progressive JPEG posted:

my order of escalation is:
- shell: max 20 lines, maybe with one or two if statements or functions, maybe one loop. literally "run this sequence of commands"
- python: single file, max 200 lines or so, with stdlib only
- rust: the rest (if it's a hobby project)
My limit for shell is like 5 lines

As much as I'm not generally a big python fan, using python and click or something ends up being really good for short things that require any sort of command line options, and once you're doing anything like that shell scripts often aren't even any faster to write.

I guess python isn't even that bad now except for the package management situation and the type hinting syntax sucking. I know that poetry has some issues but it has caused me to tend to reach for python more often lately (having to choose between installing poo poo globally or manually janitoring venvs was probably the single worst thing in python).

mystes fucked around with this message at 20:10 on Feb 23, 2024

Kazinsal
Dec 13, 2011
I've got a few shell scripts that are over 100 lines but they're fairly complicated build scripts that do things like poo poo out bootable ISOs and do transforms on debug information in ELF files so they get a pass

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
Python is good, actually. It's easy to get poo poo done, and that's all I care about at the end of the day.

Shaggar
Apr 26, 2006

Tankakern posted:

sigh

i got a xps 13 from 2022, at least it hasn't got that copilot key

wont buy again. god drat it dell

yeah but that one probably doesnt have sleep

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
I work in embedded Linux, and I've shipped a ton of shell scripts. Even some complicated ones.

When you're targetting an embedded system made with Busybox, shell is nice because it doesn't have any dependencies other than making sure the right Busybox applets are enabled. Python might or might not be on the production system. It's not included by default in a lot of Buildroot/Yocto configs. But a shell-script with minimal dependencies will work every time, and won't introduce large deps that you don't already have.

You can go into Guitar Center today and buy a product I designed that has a 350-line shell script that configures its USB-gadget interface.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
if I'd put Python into the rootfs, it would have doubled the size of firmware releases. That translates into slower firmware updates, more expensive flash memory, and higher bandwidth costs in serving up the file to customers.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
don't get me wrong, shell scripting is bad and I hate it.

But also I kind of love it, and it's still the best way to end up with a result that has the smallest overall footprint.

outhole surfer
Mar 18, 2003

Poopernickel posted:

if I'd put Python into the rootfs, it would have doubled the size of firmware releases. That translates into slower firmware updates, more expensive flash memory, and higher bandwidth costs in serving up the file to customers.

gb2embeddedinuxthread

Beeftweeter
Jun 28, 2005

OFFICIAL #1 GNOME FAN

Truga posted:

yeah don't use ls in scripts what the hell

generally you're right but i think for something like that it's fine, you know what the contents of the directory are supposed to be already

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Poopernickel posted:

don't get me wrong, shell scripting is bad and I hate it.

But also I kind of love it, and it's still the best way to end up with a result that has the smallest overall footprint.

awk is in posix and a considerable improvement over shell, imo. i like awk and I'm normally a weenie super high level declarative "programmer"

though i have no idea if busybox's awk impl is nerfed compared to gawk

Beeftweeter
Jun 28, 2005

OFFICIAL #1 GNOME FAN

BobHoward posted:

every time i have to write tcl (which i sometimes do, because it did kinda win in certain niches), i have to google for information about how to do poo poo. all this ever seems to find is mailing list arguments between tcl graybeards which got copied into a wiki article and called "documentation". not really the language's fault but trying to suss the truth out of that pile of noise is an extremely irritating way to try to learn how to write tcl, lol

also tcl somehow manages to be less straightforward than perl. idk, maybe my brain is broke, but i just don't get tcl or see why anyone would want to use it. my go-to plang is python3 because even though it sucks, the magnitude of its suckage is mostly less than perl

fwiw my mandb on darwin is completely littered with tcl documentation. haven't really seen the same on linux (which tends to be littered with perl, incidentally)

i don't really know where it came from either, but my guess would be one of the old xquartz packages that probably survived multiple systems

Beeftweeter fucked around with this message at 22:08 on Feb 23, 2024

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

god help me I'm contemplating buying a framework laptop to diddle around with modern linux on

FlapYoJacks
Feb 12, 2009

outhole surfer posted:

gb2embeddedinuxthread

Embedded Linux is Linux. :colbert:

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I’m thinking of buying an old hp probook to put a lightweight Linux on

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
awk sits in this weird spot for me where I know it is really powerful, but its power becomes useful at the exact point where I start to use Python instead.

Beeftweeter
Jun 28, 2005

OFFICIAL #1 GNOME FAN
i just threw linux on some old chromebooks i picked up real cheap :shrug:

small, dense screens, good hardware compatibility and all day battery

the value proposition isn't what it once was though, they kinda stopped making the higher end ones (which i also run windows on, but still)

mystes
May 31, 2006

Beeftweeter posted:

i just threw linux on some old chromebooks i picked up real cheap :shrug:

small, dense screens, good hardware compatibility and all day battery

the value proposition isn't what it once was though, they kinda stopped making the higher end ones (which i also run windows on, but still)
how many old chromebooks do you have?

Beeftweeter
Jun 28, 2005

OFFICIAL #1 GNOME FAN

mystes posted:

how many old chromebooks do you have?

3 if you count one my wife uses, two if you're taking me personally

they're both samsungs. the 11" one is 1920x1200 and the 12" is 4k (and oled, and much better specs)

all together they were under $400

sb hermit
Dec 13, 2016





Beeftweeter posted:

i just threw linux on some old chromebooks i picked up real cheap :shrug:

small, dense screens, good hardware compatibility and all day battery

the value proposition isn't what it once was though, they kinda stopped making the higher end ones (which i also run windows on, but still)

chromebook os is linux

:goonsay:

pseudorandom name
May 6, 2007

that's like saying android is linux

sb hermit
Dec 13, 2016





android is linux

Adbot
ADBOT LOVES YOU

sb hermit
Dec 13, 2016





anime is good

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply