Nelson Amaral

@onelsonsenna
8 Followers
70 Following
171 Posts
Proud husband and father and extremely grumpy when it comes to coding and software development.
PronounsHe/Him

This is absolutely nuts: hackers are hijacking high-profile Instagram accounts by simply asking Meta's AI chatbot to change the email on the account. Meta's AI does it, hacker gets password reset code, they're in. A staggering security issue

https://www.404media.co/hackers-simply-asked-meta-ai-to-give-them-access-to-high-profile-instagram-accounts-it-worked/

Hackers Simply Asked Meta AI to Give Them Access to High-Profile Instagram Accounts. It Worked

The exploit shows the extreme risk of offloading technical support to AI.

404 Media

Whether I'm using mypy or one of the faster type checkers, I prefer to use it:

β€’ On file save in my editor, so mistakes surface quickly
β€’ In CI, so they don't sneak into production

If you find type annotations too challenging to fully embrace, that's fine. Don't use them! I often don't.

Type annotations can add extra safety, but they're optional.

Just be sure to make an intentional project-wide decision rather than ending up with a confusing mix of typed and untyped code.

🧡 (2/2)

Python Tip #152 (of 365):

Be consistent about your type annotations: skip them entirely or run a type checker.

An unchecked annotation is really just a comment, and it may be a confusingly incorrect comment. A type checker keeps your annotations honest.

Annotations can add noise to code, but they can also increase correctness.

Half-annotated code that isn't type checked adds visual noise WITHOUT adding the safety of type checking.

🧡 (1/2)

#Python #DailyPythonTip

For some reason Claude always go for an approach using Python's `global` πŸ€¦β€β™‚οΈ
I'm starting to get suspicious when people say they're #agile enthusiasts... Lately they are more interested in Markdown πŸ˜…
@trondhjort happened with me not so long ago, in the end what was thought as a disruptive new idea, super strategic is now discontinued because no one really understood what it should do...

Organisational Dysfunction of the Day

Outsourcing the future

Context: The organisation wants a new strategy. Leadership does not have the bandwidth, or perhaps the confidence, to lead the process internally. A consulting firm is brought in. They are smart, experienced, and methodologically rigorous. They interview the leadership team, benchmark against competitors, analyse market trends, and run workshops with selected stakeholders. A few months later, a strategy document arrives. It is well-structured and credible. The organisation begins implementing it. Some things work. Others do not land the way the consultants predicted. The people doing the implementation have questions that the document does not answer. The consultants are gone. Two years later, a new consulting firm is brought in to develop the next strategy.

OST explains: Strategy is not a document. It is a shared understanding of where a system is, where it needs to go, and why. That understanding cannot be imported from outside because it depends on knowledge that only exists inside the system, distributed across the people who operate it, the relationships they hold, and the environment they transact with daily. A consulting firm can bring analytical frameworks, comparative data, and an external perspective. What they cannot do is replace the participative process through which an organisation develops genuine strategic ownership. The Search Conference exists because Emery understood this. An effective strategy requires the whole system in the room, not a representative sample interviewed by outsiders. A strategy people helped build is one they will adapt when reality diverges from the plan. A strategy handed down, however well-researched, will be executed literally until it fails and then replaced by the next one. The cycle is not a strategy problem. It is a participation problem.

#OpenSystemsTheory #SocioTechnical #OrgDesign #strategy

Python Tip #149 (of 365):

Sort by specific attributes with operator.attrgetter.

Have an iterable of dataclasses, namedtuples, or some other record-like object?

Want to sort them by a specific attribute?

Use operator.attrgetter:

from operator import attrgetter

For example, if we had an iterable of Book objects that have a title attribute, we could sort them by that:

sorted_books = sorted(books, key=attrgetter("title"))

🧡 (1/2)

#Python #DailyPythonTip

Like itemgetter (tip 148), attrgetter also accepts multiple attributes to sort by.

Here we're sorting by year first and then by title:

sorted_books = sorted(books, key=attrgetter("year", "title"))

If you need to sort by deeply nested attributes (an attribute of an attribute) attrgetter can handle that too.

Here we're sorting by book.‍author.‍name for each book object in the books iterable:

sorted_books = sorted(books, key=attrgetter("author.‍name"))

🧡 (2/2)

Python Tip #148 (of 365):

Sort by specific sequence items with operator.itemgetter.

Have an iterable of sequences (tuples, lists, etc.)?

You can sort them by one or more of their indexes using itemgetter from Python's operator module.

from operator import itemgetter

For example, say we have CSV rows:

rows = list(csv.reader(file))

And we want to sort these rows by their second column.

We can do this:

sorted_rows = sorted(rows, key=itemgetter(1))

🧡 (1/2)

#Python #DailyPythonTip