In the middle of the desert you can say anything you want
Connected an external screen, it was dark, googled for a solution after resetting redshift
settings didn’t work.
So, there are a lot of ways to change brightness (SO1).
xbacklight
works with hardware-level brightness for the devices that support it.
For the others, software-level changing of gamma values is what’s usually needed, and what I did with a lot of different programs before. This worked this time:
xrandr --output LVDS1 --brightness 0.5
(As a bonus, it uses the already well-know and well-loved xrandr.)
Sad that arandr
can’t do brightness though, but there are reasons (missing –brightness features (#35) · Issues · arandr / ARandR · GitLab)
From there I learned that ddcondrol
is the way to change brightness for external monitors on hardware level, and that Jolmberg/wmbright: Monitor brightness control dockapp is a back-end that tries to do everything.
TODO, this look really really really good. Explanation of the relationship between python logging root logger and other loggers
(+ Love the way it’s split into separate .py
files)
pytest
took seconds at the “Collecting…” stage.
I had a directory with a lot of tiny files (./data_1234/
) in the poetry package folder, and blamed it initially.
SO1 told me that the syntax to ignore a folder is
[tool:pytest]
norecursedirs = subpath/*
Wildcards are nice and data*/*
was the first attempt.
Nothing.
Then I without success tried this:
testpaths="tests"
After a one-hour saga, I found that the culprit was a package that I was using. The tests imported my package, which imported the slow package, and it takes seconds to do so.
‘Collecting’ seems not to be only “find test files”, but it reads them and imports them and all their dependencies.
Waiting time went back to normal as soon as I commented out importing my package from the test.
From within an issue, use the dropdown left of “Create merge request” -> Create branch, will create a branch with the format “issue_n-issue_title”, for example 3-this-is-issue-number-three
.
If you use a directory structure like this:
resources/
src/project_name/
tests/
[...]
then you get these directories in the same order regardless of the name of the project! Then it’s always uniform, muscle memory has a chance, etc.
<Ctrl-C>
of a program running inside pdb (python3 -m pdb myscript.py
or whatever) doesn’t kill the program, but drops you in the debugger!
Useful when you suspect there’s an infinite loop somewhere, and want to see what exactly is the program doing when it starts using 120% of your CPU
Installed noisetorch, it complained about CAP_SYS_RESOURCE like the last time and I fixed it by installing polkit like the last time, didn’t work though.
Issue seems to be that by default Mint has the home partition mounted with nosetuid1, confirmed by doing mount
.
Fix was to put the binary in /opt
, the prompt is the same but after entering the password it works and I see the expected interface.
Use-case - using limited mobile internet.
vnstat
is nice. sudo apt install vnstat
, service has to be started/enabled through systemctl as usual.
Logs traffic with 5-minute granularity, so for the first 5 minutes after install will say that there’s not enough information :)
vnstat -5
returns the last hours in 5-minute interval, -h
/-d
/-m
is hourly/daily/monthly.
-i
selects the interface (otherwise all existing non-zero ones will be shown).
Saw this in the python pandoc cookbook1
holder[index:index+1] = split_home(elt)
Wow.
Never thought I could assign multiple elements to a slice!
pdbpp is a drop-in replacement for pdb
, and I like it more than ipdb
for some reason.
Installing it makes it the default one imported when importing pdb
(incl. by pytest, python’s breakpoint()
etc!)
Really nice tutorial: pdb++, a drop-in replacement for pdb (the Python debugger) | PythonRepo
Vanilla-pdb cheatcheet: Python Debugger Cheat Sheet - Kapeli
Features not present in pdb that I love:
ll
outputs the text of the current functionsticky
updates the function listing with each new line, giving a nice interactive visual feeling to the debugging processpytest -s
works to make it play nice with the stdouts generated by pdbpp.