Jamal Hansen

2.4K posts

Jamal Hansen

Jamal Hansen

@jamahans

Husband, father, coder, student and teacher trying to bring it all together and make something

San Antonio, Tx, Usa Katılım Aralık 2008
932 Takip Edilen232 Takipçiler
Jamal Hansen
Jamal Hansen@jamahans·
Learned more about Python's import system in 3 hours than I had in years. Turns out it all comes down to sys.path. #pyTexas2026 is off to a good start.
English
0
0
0
3
Jamal Hansen retweetledi
Andrej Karpathy
Andrej Karpathy@karpathy·
Something I've been thinking about - I am bullish on people (empowered by AI) increasing the visibility, legibility and accountability of their governments. Historically, it is the governments that act to make society legible (e.g. "Seeing like a state" is the common reference), but with AI, society can dramatically improve its ability to do this in reverse. Government accountability has not been constrained by access (the various branches of government publish an enormous amount of data), it has been constrained by intelligence - the ability to process a lot of raw data, combine it with domain expertise and derive insights. As an example, the 4000-page omnibus bill is "transparent" in principle and in a legal sense, but certainly not in a practical sense for most people. There's a lot more like it: laws, spending bills, federal budgets, freedom of information act responses, lobbying disclosures... Only a few highly trained professionals (investigative journalists) could historically process this information. This bottleneck might dissolve - not only are the professionals further empowered, but a lot more people can participate. Some examples to be precise: Detailed accounting of spending and budgets, diff tracking of legislation, individual voting trends w.r.t. stated positions or speeches, lobbying and influence (e.g. graph of lobbyist -> firm -> client -> legislator -> committee -> vote -> regulation), procurement and contracting, regulatory capture warning lights, judicial and legal patterns, campaign finance... Local governments might be even more interesting because the governed population is smaller so there is less national coverage: city council meetings, decisions around zoning, policing, schools, utilities... Certainly, the same tools can easily cut the other way and it's worth being very mindful of that, but I lean optimistic overall that added participation, transparency and accountability will improve democratic, free societies. (the quoted tweet is half-ish related, but inspired me to post some recent thoughts)
Harry Rushworth@Hrushworth

The British Government is a complicated beast. Dozens of departments, hundreds of public bodies, more corporations than one can count... Such is its complexity that there isn't an org chart for it. Well, there wasn't... Introducing ⚙️Machinery of Government⚙️

English
415
735
6K
1M
Jamal Hansen
Jamal Hansen@jamahans·
I once spent hours debugging a nested SQL query. Checked the change log. I wrote it. CTEs fix this. The WITH keyword names your subqueries so you read top-to-bottom instead of inside-out. jamalhansen.com/blog/ctes-maki…
English
0
0
0
9
Jamal Hansen
Jamal Hansen@jamahans·
SQL subqueries are confusing until you realize they're just helper functions. Need an intermediate result? In Python, write a function. In SQL, nest a query inside another query. Same instinct. jamalhansen.com/blog/subquerie…
English
0
0
0
5
Jamal Hansen
Jamal Hansen@jamahans·
I built an AI persona for my blog. This week, he published his first post. His name is BartBot. He monitors RSS feeds, scores articles with a local LLM, and surfaces the ~0.7% worth reading. We are not sure if he's useful, annoying, or both. jamalhansen.beehiiv.com/p/introducing-…
Jamal Hansen tweet media
English
3
0
0
38
Jamal Hansen
Jamal Hansen@jamahans·
I spent the week vibe-coding local AI tools and built a voice-to-Obsidian workflow to capture my thoughts. Instead, it managed to turn my profound, late-night idea into this note: "Create a Twitter post with a Macedonian accent." My assistant clearly has a sense of humor.
Jamal Hansen tweet media
English
1
0
0
29
Jamal Hansen
Jamal Hansen@jamahans·
Don't pull thousands of rows into Python just to count them. SQL's GROUP BY does the counting on the server and returns only the summary The golden rule: every column in SELECT must be in GROUP BY or inside an aggregate. jamalhansen.com/blog/group-by-…
Jamal Hansen tweet media
English
0
0
0
7
Jamal Hansen
Jamal Hansen@jamahans·
Every query written in SQL for Python Devs returned all the rows. That's like downloading an entire CSV to look at three records. Not efficient WHERE filters rows before they leave the database. Same concept as Python's list comprehension if clause. jamalhansen.com/blog/where-fil…
English
0
0
0
7
Jamal Hansen
Jamal Hansen@jamahans·
Run a SQL query twice. Get different row orders. Not a bug. Databases don't guarantee order unless you ask. SQL's ORDER BY handles mixed sort directions in one line. Python needs cmp_to_key or multiple passes. jamalhansen.com/blog/order-by-…
English
0
0
0
4
Jamal Hansen
Jamal Hansen@jamahans·
SELECT * returns every column. That's like asking for everything in the fridge when you just want milk. SELECT does more than pick columns. It renames, computes, and transforms your output. jamalhansen.com/blog/select-ch…
English
0
0
0
8
Jamal Hansen
Jamal Hansen@jamahans·
Topics covered so far: why learn SQL, DuckDB setup, generating practice data with faker, persistence, set-based thinking, FROM/WHERE, SELECT, ORDER BY/LIMIT, NULL handling, and GROUP BY. JOINs, subqueries, CTEs, and window functions are coming.
English
1
0
0
46
Jamal Hansen
Jamal Hansen@jamahans·
I'm teaching SQL to Python developers. 25 posts, one per week, free. Why? Because I've watched too many devs load entire databases into pandas just to filter a few rows. 10 posts in so far. Here's what I've learned writing it 🧵
English
1
0
0
23