Thanks, @movq@www.uninformativ.de! That seems to be much easier. It’s already implemented in the Python docs as examples of recvmsg(…)
and sendmsg(…)
:
- https://docs.python.org/3/library/socket.html#socket.socket.recvmsg
- https://docs.python.org/3/library/socket.html#socket.socket.sendmsg
I looked at them sooo many times in order to figure out why my SCM_CREDENTIALS
sending code didn’t work. :-D
Nobody want to be a shitty programmer. The question is: Do you do anything not to not be one?
Reading blogs or social media and watching YouTube videos is fun. After them, your code may be a little better, of course. But you need a lot. You need to study! Read good books and study the code of other programmers, for example. Maybe work with a new language, architectures and paradigms. You need break the routine.
If you know Object-oriented programming, you learn functional programming.
If you know Model-View-Controller, you learn Model-View-ViewModel.
If you don’t know anything about architectures, you learn Clean Architecture, Hexagonal Architecture, etc.
If you know Python, you learn Ruby or Go.
If you know Clojure or Lisp… you don’t need to learn anything else. You are already a good programmer. Just kidding. You can learn Elixir or Scala.
Be a good programmer my friend.
We’re all old farts. When we started, there weren’t a lot of options. But today? I’d be completely overwhelmed, I think.
Hence, I’d recommend to start programming with a console program. As for the language, not sure. But Python is probably a good choice
That’s what I usually do (when we have young people at work who never really programmed before), but it doesn’t really “hit” them. They’ve seen so much, crazy graphics, web pages, it’s all fancy. Just some text output is utterly boring these days. ☹️ And that’s my problem: I have no idea how I could possibly spark some interest in things like pointers or something “low-level” like that. And I truly believe that you need to understand things like pointers in order to program, in general.
Wrote some serious Python for the first time in like 10 years 😱 I feel so dirty 🤣
@movq@www.uninformativ.de I started with Delphi in school, the book (that we never ever used even once and I also never looked at) taught Pascal. The UI part felt easy at first but prevented me from understanding fundamental stuff like procedures or functions or even begin
and end
blocks for if
s or loops. For example I always thought that I needed to have a button somewhere, even if hidden. That gave me a handler procedure where I could put code and somehow call it. Two or three years later, a new mate from the parallel class finally told me that this wasn’t necessary and how to do thing better.
You know all too well that back in the day there was not a whole lot of information out there. And the bits that did exist were well hidden. At least from me. Eventually discovering planet-quellcodes.de (I don’t remember if that was the original forum or if that got split off from some other board) via my best schoolmate was like finding the Amber Room. Yeah, reading the ITG book would have been a very good idea for sure. :-)
In hindsight, a console program without the UI overhead might have been better. At least for the very start. Much less things to worry about or get lost.
Hence, I’d recommend to start programming with a console program. As for the language, not sure. But Python is probably a good choice, it doesn’t require a lot of surrounding boilerplate like, say Java or Go. It also does exceptionally well in the principle of least surprise.
nuevos projectos! algunos en python otros en simple html!!
Exciting new for Python 3.14!
t-string
, not to be confused with f-string
, to avoid malicious code and make life easier for web developers.
https://davepeck.org/2025/04/11/pythons-new-t-strings/
#python
si4er3q
. See https://twtxt.dev/exts/twt-hash.html, a timezone offset of +00:00
or -00:00
must be replaced by Z
.
@eaplme@eapl.me you wrote:
“That PHP snippet could be merged into https://twtxt.dev/exts/twt-hash.html”
Why, though? AFAIK @andros@twtxt.andros.dev’s client is on Emacs, @lyse@lyse.isobeef.org’s is on Python (and Golang, for tt2
), @movq@www.uninformativ.de’s is on Python, and @prologic@twtxt.net’s is on Golang. All the client creator needs to know is in the documentation already, coding language agnostic.
si4er3q
. See https://twtxt.dev/exts/twt-hash.html, a timezone offset of +00:00
or -00:00
must be replaced by Z
.
Scratch that, no bug in jenny. There’s actually a test case for this. Python normalizes -00:00
to +00:00
, so the negative case never happens.
Elliptical Python programming
One thing I love about Python is how it comes with its very own built-in zen. In moments of tribulations, when I am wrestling with crooked code and tangled thoughts, I often find solace in its timeless wisdom. ↫ Susam Pal I can’t program and know nothing about Python, but this still made me laugh. ⌘ Read more
Thank you @python_valencia@twtxt.python-valencia.es for letting me show you the secrets of a decentralised plain text social network like twtxt.
I hope you enjoyed the talk! ❤️🐍
#python #twtxt
I want to present the twtxt feed from Python Valencia: https://twtxt.python-valencia.es/
Technical curiosity: It is generated using n8n, using the official rss.
#welcome
tt
reimplementation that I already followed with the old Python tt
. Previously, I just had a few feeds for testing purposes in my new config. While transfering, I "dropped" heaps of feeds that appeared to be inactive.
Thanks, @movq@www.uninformativ.de!
My backing SQLite database with indices is 8.7 MiB in size right now.
The twtxt
cache is 7.6 MiB, it uses Python’s pickle
module. And next to it there is a 16.0 MiB second database with all the read statuses for the old tt
. Wow, super inefficient, it shouldn’t contain anything else, it’s a giant, pickled {"$hash": {"read": True/False}, …}
. What the heck, why is it so big?! O_o
I now subscribed to most feeds in my Go tt
reimplementation that I already followed with the old Python tt
. Previously, I just had a few feeds for testing purposes in my new config. While transfering, I “dropped” heaps of feeds that appeared to be inactive.
This might motivate me to actually “finish” the new client, so that it could become my daily driver. No need to use the old software stack any longer. Let’s see how bad this goes.
@movq@www.uninformativ.de Yeah, most of the graphical applications are actually KDE programs:
- KMail – e-mail client
- Okular – PDF viewer
- Gwenview – image viewer
- Dolphin – file browser
- KWallet – password manager (I want to check out
pass
one day. The most annoying thing is that when I copy a password, it says that the password has been modified and asks me whether I want to save the changes. I never do, because the password is still the same. I don’t get it.)
- KPatience – card game
- Kdenlive – video editor
- Kleopatra – certificate manager
Qt:
- VLC – video player
- Psi – Jabber client (I happily used Kopete in the past, but that is not supported anymore or so. I don’t remember.)
- sqlitebrowser – SQLite browser
Gtk:
- Firefox – web browser
- Quod Libet – music player (I should look for a better alternative. Can’t remember why I had to move away from Amarok, was it dead? There was a fork Clementine or so, but I had to drop that for some unknown reason, too.)
- Audacity – audio editor
- GIMP – image editor
These are the things that are open right now or that I could think of. Most other stuff I actually do in the terminal.
In the past™, I used the Python KDE4 bindings. That was really nice. I could pass most stuff directly in the constructor and didn’t have to call gazillions of setters improving the experience significantly. If I ever wanted to do GUI programming again, I’d definitely go that route. There are also great Qt bindings for Python if one wanted to avoid the KDE stuff on top. The vast majority I do for myself, though, is either CLI or maybe TUI. A few web shit things, but no GUIs anymore. :-)
I have finished 1-9 on Python. If anyone is interested, I could share the code, or in Reddit many people have shared theirs.
In a couple of days I’ll be giving a talk about #twtxt https://www.meetup.com/es-ES/python-valencia-meetup/events/306769708/
@andros@twtxt.andros.dev If something fits in a CSV file, it typically doesn’t require a database. I agree with that. Depending on the application, more complicated queries might benefit from a database, though. I don’t know awk very well, but I could imagine that grep, sed and cut reach their CSV processing limits rather quickly when you have to deal with escaped (multiline) fields.
I only very rarely have to deal with CSV files or databases in my day to day life. Maybe, these classic Unix tools offer some tricks I’m not aware of. When I have some more complicated CSV input, I generally reach for Python.
looks good now!
description = 🏗 Full-Stack developer (Mainly Python) ✍ Writer[...]
I’m developing a tutorial for the Django Girls. Does anyone here have experience with #Django ? #python
The project is a POC (Proof of Concept) that went into production and the company has customers who are using it. The developers had been working for several years, without testing, structure, isolation and so on. The company hired me to transform the project into a real product. There are in my hands 422 python files to transform that they beg me a refactore, architecture and testing. Every developer’s bad dream.
My first step is to read and understand the tree because there are apps inside other apps call each other. I am very determined to work on a new repository.
?
operator in Go 👈 No. For so many reasons.
@prologic@twtxt.net Which one? I don’t mind the ternary operator at all. In fact, I often find myself missing it in Go. I don’t find the two alternatives particularly elegant:
foo := "eggs"
if bar {
foo = "spam"
}
Or:
var foo string
if bar {
foo = "spam"
} else {
foo = "eggs"
}
To my eye, this just would look a lot nicer:
foo := bar ? "spam" : "eggs"
Or at least as the Pythons do it:
foo = "spam" if bar else "eggs"
The ternary operator especially shines with relatively short expressions.
For many years I have found Flask to be too basic a tool for modern development. But since I create APIs using Flask with Pydantic to validate the input data, some middlewares for parsing and Blueprint to separate the code into modules… I must admit that I am super comfortable, fast and easy to test.
#flask #python #pydantic
What is clean architecture? That’s a good question.
You think of a pattern for ordering code with good decisions isolating technologies (you can change the web framework or database without break the business logic), easy to test (you only test interfaces and use cases), sharing code between frameworks (entities and use cases), scalability, modulations and standardizing names. Clean architecture is not perfect, it has a learning curve and some abstraction in each technology. You can even find rejection with yours colleagues.
I have a good article on this topic.
https://programadorwebvalencia.com/implementando-arquitectura-limpia-en-python/
#python
Yes, it’s a mini python cgi script which implements IndieAuth
Yeah, @bender@twtxt.net, I absolutely love it! :-D Monty Python just rocks!
This very knight inspired me to make myself a knight helmet with opening visor out of an old washing machine sheet metal years ago for a theater play. It was really great fun, both making the helmet as well as using it during the week in the play as a silly and shady prince who got all his tracts of land by winning dubious games.
I just couldn’t really hear very well in it. And if somebody hit me on the head or just slightly knocked on the helmet, it was incredibly loud. No fine craftmanship by any means and obviously historically extremely questionable at best, but it did the job well enough. One of the running gags was that I had to open the visor when I wanted to talk. Here are some photos in action, you’ll find many more when surfing through the gallery:
- https://wawuwo.de/2016/woche2/montag/017.html#image
- https://wawuwo.de/2016/woche2/dienstag/019.html#image
- https://wawuwo.de/2016/woche2/mittwoch/156.html#image
- https://wawuwo.de/2016/woche2/donnerstag/008.html#image
- https://wawuwo.de/2016/woche2/freitag/036.html#image In one lunch break my page and I decided to dress up and play a game of dice against the kids. However, we used badly cogged dice. We just added a few dots of paint on one of the two dice, so that it had two fours, two fives and two sixes or something like that. I always told my opponents: “You can choose whatever dice you want. Except for the red one, that’s my lucky dice!” As well-behaved children, they then selected the blue, unbiased one. And usually lost. However, I remember there was one kid that beat me with four sixes in row. :-D Although we thought, we make it halfway obvious that this game is truly not fair, it took them extremely long to figure out that we had messed with my lucky dice. When they finally did, they got super angry. Some of them were on the brink of beating me up. That was really nice to see their sense of justice kick it. :-)
- https://wawuwo.de/2016/woche2/freitag/169.html#image
@prologic@twtxt.net mediacms! it’s janky yeah but it does the job ultimately (even if sometimes videos don’t encode and i gotta do some weird python venv shit to force the encode lol…)
base(2)
or base(16)
in calc to do that. That’s exhausting after a while.
@movq@www.uninformativ.de Thanks! I already found it and patched it to run in my ancient Python version (no match
keyword and exec(…)
only allows globals
and locals
as positional arguments). :-) https://lyse.isobeef.org/tmp/mcalc-patched.py.txt
@movq@www.uninformativ.de Yeah, the Python docs are more like a book. They absolutely shine if you have no idea and read them from top to bottom. The tutorial is baked right in. But they don’t work all that perfect as cheat sheets. I also remember looking for the return types way too long in the past.
I would have thought that this could be easily improved when type hints are in place. And it sure does: https://www.tornadoweb.org/en/stable/httpclient.html#tornado.httpclient.HTTPClient.fetch
For some reason, I was using calc all this time. I mean, it’s good, but I need to do base conversions (dec, hex, bin) very often and you have to type base(2)
or base(16)
in calc to do that. That’s exhausting after a while.
So I now replaced calc with a little Python script which always prints the results in dec/hex/bin, grouped in bytes (if the result is an integer). That’s what I need. It’s basically just a loop around Python’s exec()
.
$ mcalc
> 123
123 0x[7b] 0b[01111011]
> 1234
1234 0x[04 d2] 0b[00000100 11010010]
> 0x7C00 + 0x3F + 512
32319 0x[7e 3f] 0b[01111110 00111111]
> a = 10; b = 0x2b; c = 0b1100101
10 0x[0a] 0b[00001010]
> a + b + 3 * c
356 0x[01 64] 0b[00000001 01100100]
> 2**32 - 1
4294967295 0x[ff ff ff ff] 0b[11111111 11111111 11111111 11111111]
> 4 * atan(1)
3.141592653589793
> cos(pi)
-1.0
The fact that the official Python docs don’t clearly state what a function returns, grinds my gears. This has cost me so much time over the years. You always have to read through a huge block of text.
You could at least put a list of possible return values in there (always at the same location, please!), here’s a mockup:
I want to share the video of my last talk: Creating an Instagram in Django for an Iberian lynx https://www.youtube.com/watch?v=dW69cYIULh8 (Spanish) #django #python
python cgi script which handles micropub and writes content to twtxt file. I was want micropub+microsub for twtverse but seems i burned (due choice wrong stack?): https://privatebin.net/?0b598b91ac186855#BfRKjLUQz5KUFJNekJBb5V2qvtEe8xQN8nenYbkez2XR
testing the bluesky cross-poster i added into my silly python script for posting status updates
@bender@twtxt.net I see. Interesting articles, ta! Have you seen a python or iguana in the wild?
Honestly… not much. Have abandon two projects (both private) on Golang and one related to cryptography. My mostly languages are Python and Javascript (also can PHP). After writing code on Go i spend same time on fixing dumb errors
f
:
@falsifian@www.falsifian.org You are correct, but I ended up switching to /data/data/com.termux/files/usr/tmp
as suggested by @doesnm@doesnm.p.psf.lt in (#66py4ja). there must have been a reason why that file was placed in /tmp/
in the first place, I just don’t know my way around python that much to figure it out 😅.
Now WTF!? Suddenly, @falsifian@www.falsifian.org’s feed renders broken in my tt Python implementation. Exactly what I had with my Go rewrite. I haven’t touched the Python stuff in ages, though. Also, tt and tt2 do not share any data at all.
By any chance, did you remove the ; charset=utf-8
from your Content-Type: text/plain
header, falsifian?
@mckinley@twtxt.net To answer some of your questions:
Are SSH signatures standardized and are there robust software libraries that can handle them? We’ll need a library in at least Python and Go to provide verified feed support with the currently used clients.
We already have this. Ed25519 libraries exist for all major languages. Aside from using ssh-keygen -Y sign
and ssh-keygen -Y verify
, you can also use the salty
CLI itself (https://git.mills.io/prologic/salty), and I’m sure there are other command-line tools that could be used too.
If we all implemented this, every twt hash would suddenly change and every conversation thread we’ve ever had would at least lose its opening post.
Yes. This would happen, so we’d have to make a decision around this, either a) a cut-off point or b) some way to progressively transition.
I love shell scripts because they’re so pragmatic and often allow me to get jobs done really quickly.
But sadly they’re full of pitfalls. Pitfalls everywhere you look.
Today, a coworker – who’s highly skilled, not a newbie by any means – ran into this:
$ bash -c 'set -u; foo=bar; if [[ "$foo" -eq "bar" ]]; then echo it matches; fi'
bash: line 1: bar: unbound variable
Why’s that happening? I know the answer. Do you? 😂
Stuff like that made me stop using shell scripts at work, unless they’re just 4 or 5 lines of absolutely trivial code. It’s now Python instead, even though the code is often much longer and clunkier, but at least people will understand it more easily and not trip over it when they make a tiny change.
If you’re using jenny on Python 3.12, it will spit out a deprecation warning regarding datetime.utcnow()
. This will be fixed in the next release.
Things can get very interesting when we add the iter.Pull function in the mix. It works like pythons yield from.
This day one advantage of code was pretty neat looking.
https://twitter.com/gereleth/status/1730495736070938786?s=09
Code here: https://github.com/gereleth/aoc_python/blob/main/src/year2023/day01vis.py