Rust meme I guess. You borrow through a reference, and references have the & symbol like C++.
- 0 Posts
- 87 Comments
There’s a new web site called gogool which may have some answers for you.
6nk06@sh.itjust.worksto
Selfhosted@lemmy.world•Here is a more polished release of nanogram. Fully compatible on raspberry pi now.English
14·12 days agoAnd it’s worse because they hide the Python code, which means that they can’t use tools like uv or ruff to check that everything works properly. I don’t understand why people do this.
6nk06@sh.itjust.worksto
Selfhosted@lemmy.world•Here is a more polished release of nanogram. Fully compatible on raspberry pi now.English
7·12 days agoWhy put all the Python code in the script?
Some people say that HFT is about small optimizations and avoiding copies. You can do that if you have a deep knowledge of C++.
Or try something like QuantLib, it is a tradings’ library that I used aeons ago in some stock market company. https://www.quantlib.org/
They have a book too https://www.quantlibguide.com/A taste of QuantLib.html and Python bindings.
ActualBudget. It solves my problem of not budgeting.
6nk06@sh.itjust.worksto
Programming@programming.dev•Kinda proud of this python script I wrote
1·17 days agoYes. You can say
"Session\\Port (lots of space here) = 12345"(formatting sucks, sorry) to align your values properly. Also are you sure that there is a double backslash here because you are using a raw string here?
6nk06@sh.itjust.worksto
Programming@programming.dev•Kinda proud of this python script I wrote
1·17 days agoYes (and I’m sorry for not having more time to study this but):
logDateTime
That thing should be automatically printed by the logger somehow (most of the time, timestamps and log levels are inside the logger itself). If it’s not, check the configuration of the logger. Anyway. logDateTime has got to go. IMHO a logger is a magical object that you don’t control. It’s the user of the application who should set the rules one way or the other, like:
logger.info("qbittorrent listen port set to...IIRC the logger can be set from the command-line, which you don’t control anyway. It’s the same thing in C++ and with any library on the planet (trust me), someone sets up the logging system for you outside of the application (in the main function or on the command-line or with environment variables or in a library/DLL) and all you can do is call “log.debug()” or “log.warning()” and hope for the best. Some libraries have huge systems to handle logs (rotating logs, serial ports, files, network…) and you shouldn’t give yourself headaches while using those things. Think of a logger as a pre-configured system that does way more that you should and want to know.
logger = logging.getLogger(…
Put that outside of main, after the imports. You can prepend it with an underscore to show that it’s a “private or protected” object belonging to your module. If it’s in main, you can’t use it in the other functions. You should do something like:
from qbittorrent import Client _logger = logging.getLogger(...)This way your logger is independent on whether you’re using it from the command line (with main) or not (with an import).
QB_PASSWORD
Same thing with all the
QB_variables IF they don’t change, you can put them globally for such a module, like_QB_PASSWORD = ...and use it everywhere if your module were to change in the future. But only if the variables are constants across the usage of the script.a40124291102d
Last but not least, use argparse if you can, it’s a simple module to handle command-line arguments. I guess that the container ID can change, you can either detect it with the subprocess module, or write
def get_current_forwarded_port(container_id = "a40124291102d"):or use argparse. Feel free to ask if argparse if too weird, but it’s the best module out there and it’s built-in.TL;DR:
- change logFilePath, what if I don’t have a filesystem or a hard drive?
- change logDateTime and “message”, what if I (the user of your script) want another format?
- change qbConfigUrl to be configurable, what if I use your script on a weird custom Linux or a BSD, or macOS or Windows?
Anyway, great job, writing weird stuff for my own needs is how I started coding. Have fun.
6nk06@sh.itjust.worksto
Programming@programming.dev•Kinda proud of this python script I wrote
7·17 days agoMake the logger a global variable. This may be the only case where its acceptable to be global. And remove the log function. You can call the logger directly.
Also wrap the main code (after BEGIN SCRIPT) in a main function.
Last but not least log everything to the standard output (logging should do that by default), or configure the path in main(), it’s cleaner. If you log to stdout, the shell can redirect the logs to any path like
python script.py > mylogs.txt
What is the value of x in the Good example before the loop?
6nk06@sh.itjust.worksto
Programming@programming.dev•Fresh CKS (and CKA) tips and takeaways
1·19 days agoThat’s annoying. Don’t do that.
6nk06@sh.itjust.worksto
Programming@programming.dev•Ruby Is Not a Serious Programming Language
141·23 days agoYep, it’s trash.
6nk06@sh.itjust.worksto
Programming@programming.dev•Ruby Is Not a Serious Programming Language
252·23 days agoPaywalled clickbaity trash of an article.
6nk06@sh.itjust.worksto
Linux@programming.dev•Linux Kernel 6.19 Will Introduce the Terminus 10x18 Console Bitmap Font
16·23 days agoHe wants pixels instead of fonts I guess. Not the sharpest drawer in the toolbox.
6nk06@sh.itjust.worksto
Programmer Humor@programming.dev•JPEG XL is Dead. Long Live JPEG XL
134·1 month agoGiven these positive signals
Those idiots waited for 4 years because they followed the hype of the moment. I’m glad I removed Google from my life.
I wouldn’t use this and most people will forget that it exists. Most of the time you have do use the language and avoid hacks like that.
Don’t you have alternatives in Dart?
It feels very complicated. The whole theory is better explained with any Lisp.
6nk06@sh.itjust.worksto
Linux@programming.dev•I just wanted to compare FOSS Linux budgeting software
5·1 month agoAbout what?
6nk06@sh.itjust.worksto
Linux@programming.dev•I just wanted to compare FOSS Linux budgeting software
33·1 month agoI’m a lazy bastard and I don’t self host for a lot of reasons. I use Actual because it’s close to the old YNAB and has a desktop version (AppImage, I know it sucks, I don’t care).
It has a list of transactions, and a budget with envelopes. That’s all I need and it’s fine.
As for the others:
- Firefly wants me to use Docker, I don’t have time for that and I don’t have a server
- Homebank has a weird dev process on launchpad, no releases, and wants me to disable uBlock Origin, fuck it
And the slop is the reason I don’t use YouTube anymore. People seem to enjoy that dead internet because it looks like TV.

I tell people not to do that all the time. They’d rather listen to the statistical vomit machine.