Squeaky

2.3K posts

Squeaky banner
Squeaky

Squeaky

@squeaky_pl

Python programmer 🐍, Rust apprentice 🦀 DevOps 🛠, PostgreSQL 🐘, Open source, 🪟 Windows Subsystem for Linux 🐧 user. 🤖 he/him

Europe Tham gia Temmuz 2011
170 Đang theo dõi523 Người theo dõi
Squeaky đã retweet
Pablo Galindo Salgado
Pablo Galindo Salgado@pyblogsal·
We are very exited to share with you PEP 768 🐍, which proposes a safe external debugger interface to Python. We think this is a really exciting change that will allow debuggers to safely attach to running Python processes without stopping them. 🐛🔨 peps.python.org/pep-0768/
English
3
32
206
11.6K
Squeaky đã retweet
Irit Katriel
Irit Katriel@IritKatriel·
I conducted an analysis of return-in-finally in real world Python code. TL;DR: - it is not used often - when it is used, it's usually used incorrectly - code authors find it easy to fix Full Report: github.com/iritkatriel/fi…
English
6
11
48
10.8K
Squeaky đã retweet
Will McGugan
Will McGugan@willmcgugan·
Wait. That’s why it is called itertools.tee ?! 🤯
Will McGugan tweet media
English
2
1
26
2K
Squeaky đã retweet
PDM
PDM@pdm_project·
Is someone waiting for PDM to integrate UV? It is still experimental but it's here: $ pdm config use_uv true github.com/pdm-project/pd…
English
0
9
19
3.2K
Squeaky đã retweet
The PyPy Project
The PyPy Project@pypyproject·
Max @tekknolagi just gave his presentation "Dr Wenowdis: Specializing dynamic language C extensions using type information" at Soap at PLDI in Copenhagen. The talk is about how to add type information to C extensions to speed them up in PyPy. Slides: bernsteinbear.com/assets/img/dr-…
The PyPy Project tweet media
English
3
8
23
1.6K
Squeaky đã retweet
Nikita M.
Nikita M.@meln1k·
how I squeeze 60K RPS out of SQLite on a $5 VPS: There are tons of tutorials on how to setup SQLite, and sometimes they contradict each other. Here is what worked for me. 1. Configuring PRAGMAs. We need to send the following PRAGMA commands right after opening the connection: PRAGMA journal_mode = WAL; - enables write-ahead log so that your reads do not block writes and vice-versa. PRAGMA busy_timeout = 5000; - sqlite will wait 5 seconds to obtain a lock before returning SQLITE_BUSY errors, which will significantly reduce them. PRAGMA synchronous = NORMAL; - sqlite will sync less frequently and be more performant, still safe to use because of the enabled WAL mode. PRAGMA cache_size = -20000; - negative number means kilobytes, in this case 20MB of memory for cache. PRAGMA foreign_keys = true; - because of historical reasons foreign keys are disabled by default, we should manually enable them. PRAGMA temp_store = memory; - moves temporary tables from disk into RAM, speeds up performance a lot. Do NOT use cache=shared! Some tutorials recommend configuring it, but this is how you get nasty SQLITE_BUSY errors. It is disabled by default, so you don't have to do anything extra. 2. Use immediate transactions If you know that transaction can possibly do a write, always use BEGIN IMMEDIATE or you can a get SQLITE_BUSY error. Check your framework, you should be able to set this at the connection level. 3. Open two connection pools Another trick is to open 2 connection pools, one for reads only and another for reads/writes. Set the connection limit of write pool to 1, and the connection limit of the read pool to some reasonably high number, e.g. number of your CPU cores. 4. Bonus: how I configure sqlite with Go Here is the code in go I use to configure the sqlite connections: ```go func SQLiteDbString(file string, readonly bool) string { connectionParams := make(url.Values) connectionParams.Add("_journal_mode", "WAL") connectionParams.Add("_busy_timeout", "5000") connectionParams.Add("_synchronous", "NORMAL") connectionParams.Add("_cache_size", "-20000") connectionParams.Add("_foreign_keys", "true") if readonly { connectionParams.Add("mode", "ro") } else { connectionParams.Add("_txlock", "IMMEDIATE") connectionParams.Add("mode", "rwc") } return "file:" + file + "?" + connectionParams.Encode() } func OpenSqliteDatabase(file string, readonly bool) (*sql.DB, error) { dbString := SQLiteDbString(file, readonly) db, err := sql .Open("sqlite3", dbString) pragmasToSet := []string{ "temp_store=memory", } for _, pragma := range pragmasToSet { _, err = db.Exec("PRAGMA " + pragma + ";") if err != nil { return nil, err } } if readonly { db.SetMaxOpenConns(max(4, runtime.NumCPU())) } else { db.SetMaxOpenConns(1) } return db, nil } ```
English
26
132
1.6K
222.8K
Squeaky đã retweet
ravarcheon
ravarcheon@ravarcheon·
im ashamed nobody in 2022 said to me "wake up babe new SI prefixes dropped" ronna and quetta now exist and im 2 years late to it
ravarcheon tweet media
English
67
589
5.4K
145.6K
Squeaky đã retweet
Alex Bradbury
Alex Bradbury@asbradbury·
Stick the following in your ~/.gitconfig to make `git branch` sort by most recently committed (thanks to @andywingo for this one!): [branch] sort = -committerdate
English
0
5
32
1.4K
Squeaky đã retweet
\newcommand{\femb0t}{
\newcommand{\femb0t}{@__femb0t·
> Google has announced that starting in June 2024, ad blockers such as uBlock Origin will be disabled in Chrome 127 and later with the rollout of Manifest V3 Ah.
English
323
1.4K
9.7K
3.4M
Squeaky đã retweet
Brave
Brave@brave·
Why did Apple and Google make it hard to switch default browsers for so many years? Because it's a powerful way to block competitors. Just look at what happened to Brave installs on iPhone in the EU when Apple rolled out a new default browser choice screen on March 6th:
Brave tweet media
English
127
340
2.3K
602.3K
Squeaky đã retweet
Jessie Frazelle
Jessie Frazelle@jessfraz·
ways to stay humble: - code - feel like god when something works - find bug - realize bug was your fault - repeat until you die
English
11
63
474
37.7K
Squeaky đã retweet
Yann LeCun
Yann LeCun@ylecun·
Open source AI foundation models will wipe out closed and proprietary AI models for the same reason Wikipedia wiped out generalist commercial encyclopedia: crowd-sourced human contributions to open platforms can cater to a high diversity of interests, cultures, and languages.
English
217
551
3.8K
564.9K
Squeaky đã retweet
Slava Egorov
Slava Egorov@mraleph·
the problem is not dynamic typing - it's the obscene amounts of code that people write to do simplest things. if you keep simple things simple and avoid proliferating complexity then you would not need to create solutions for managing this complexity.
English
7
11
58
6.6K
Squeaky đã retweet
Pablo Galindo Salgado
Pablo Galindo Salgado@pyblogsal·
In the Cpython core dev sprint we have started a project to improve the CPython REPL for Python 3.13+ 🎉 The first achievement is showing proper exceptions with source, error messages and locations in the REPL tracebacks. You can compare the before and after in these images:
Pablo Galindo Salgado tweet mediaPablo Galindo Salgado tweet media
English
8
45
335
43.4K
Squeaky
Squeaky@squeaky_pl·
@withoutboats I generally work with languages with good error handling mechanisms but I would always use goto in C to kind of emulate "finally clause" cleanups at the end of the function. I guess it depends on the language.
English
0
0
0
70
Patrick Walton
Patrick Walton@pcwalton·
I'm guessing that NTFS' slowness is to blame? Whatever it is, it's a huge difference.
English
3
0
6
2.4K
Patrick Walton
Patrick Walton@pcwalton·
I am really tempted to just see if I can cross compile my Windows Rust apps on my M2 Mac mini, because the linking is so much faster on Mac. 17 s with either link.exe or lld.exe with a top of the line i9 Windows laptop, compared to 5 s with the lowest spec Mac mini.
English
2
1
26
4.9K