In the middle of the desert you can say anything you want
Yet another time qtbrowser started crashing, yet another time fixed it by removing state
and sessions
from ~/.local/share/qutebrowser/
. I blame me messing with qt versions last week.
Somehow magically I don’t have to escape anything in the regexes when using it!
ag "(VISION_|short)" *
python - Passing empty string to argparse - Stack Overflow:
python test.py --mode=
I’ve been using args a la -w is
, but -w=is
also works, and therefore python3 myprogram.py -w -another=opt
is perfectly valid! Python parses it as empty string (that casts to False
).
fc
linux meaningTIL fc stands for “fix command”!
s/
replacing stuffDiscovered that if you just want to remove something, %s/from
works (without the second //
part at all)
Seems the best current default way to do cli options! Docs tutorial is as accessible as usual: Argparse Tutorial — Python 3.9.1 documentation
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) # show default args in help
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) # allow newlines in help text
parser.add_argument("-lp", "--localpath", help="Local path. \n %(default)s", default=local_path) # add default text in help text manually
When creating argparse.py, don’t be surprised if you can’t use argparse from import argparse
. 1
Nice article: PyFormat: Using % and .format() for great good!
I should make an effort to learn it and use it.
ag -G "component.*yaml" regex
- searches for regex inside all files whose path matches the regex after -G
ag --python "myregex"
automatically looks for it in all python files, and really nicely outputs matches!
g!/pattern/d
, as opposed to the usual g
without exclamation mark.
less
to copy cli stuff with weird linebreaksIf command
returns output with newline breaks that are ignored when copypasting directly, using command | less
seems to make it work - I can copypaste from there without problems.
I wasn’t able to do it the usual amixer
way, because:
You are running Pulseaudio, which uses ALSA to drive soundcards, but which connects to Bluetooth speakers without involving ALSA. When you set ALSA volumes with
amixer
, Pulseaudio notices and corrects the source/sink volumes[…] 1
Command to do it directly through pulseaudio is:
pactl set-sink-volume name_of_bluetooth_speaker +3%
Added this to ~/.config/i3/config:
bindsym Mod1+r exec pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink +5%
bindsym Mod1+c exec pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink -5%
<F10>
leaves only the current picture (‘frameless’), a la scrot
; Though in this mode drag-n-drop doesn’t work!Found this when autocompleting something else:
(12:36:26/10136)~/ $ which spectrum_ls
spectrum_ls () {
for code in {000..255}
do
print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}
Returns 255 lines with 255 colors, they look neat:
TODO: The Many Ways To Call Axes In Matplotlib | by Jun | Towards Data Science And in general
das wasserzeichen - Watermark! (Heard at work) die dringlichkeit - urgency. “Besondere Dringlichkeit”. Verschiedene Dringlichkeiten. (heard at work)
blueman
is a nice semi-gui suite for everything. bluetoothctl
is an interactive cli.
lawl/NoiseTorch: Real-time microphone noise suppression on Linux. - creates virtual devices that are the same as inpucts, but filter the noise. Works really well for me! (Single binary). Works also for filtering voice in outputs! Listening to songs through it is weird.
Changed date
format from %+V
to just %V
, which gives a sprint like 01 instead of 1 (which in turn removes the need for sprint.is:1
filtering in taskwarrior, now sprint:01
is a unique identifier)
~/.zshrc
:
export SPRINT=$(date +%V)
For this, a subset has to become bad values, and a cmap has to set what to do with them.
my_cmap = copy.copy(plt.cm.get_cmap('gray')) # get a copy of the gray color map
my_cmap.set_bad(alpha=0) # set how the colormap handles 'bad' values
plt.imshow(thing, cmap=my_cmap)
As for bad values, I wrote a function similar to this to make them arbitrary:
def get_bad_values(matr, value=0):
new_matr = matr.astype(np.float)
new_matr[new_matr == value] = np.nan
return new_matr
Note that np.nan
can only replace a np.float
, never an int!
Made everything simpler, based on what I usually really need:
bindsym $ms+s layout toggle tabbed stacking
bindsym $ms+Shift+s layout toggle split
TODO - something for “focus tab N in currently focused container”, a la what I have in qutebrowser/intellij.
.. TODO - fix this, finally.
+DAY=$(((365)*2+10#$(date +%j)))
Added this to ~/.ideavimrc
for moving between splits
map <leader>h :action PrevSplitter<CR>
map <leader>l :action NextSplitter<CR>
map <leader>o :action MoveEditorToOppositeTabGroup<CR>
script
The script
utility exists, and is installed by default on at least two systems I have access to. Works really well for interactive sessions!
script --timing=time.txt script.log
scriptreplay --timing=time.txt script.log
Seems to work when ran through screen, even when the screen is detached!
How to Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands
This is really cool: command line - How to have a terminal mirrored onto a second screen in a two-monitor setup? - Ask Ubuntu
script -f /tmp/lecture1.scrpt
tail -F /tmp/lecture1.scrpt
-f
is for “Flush output after each write.” (as opposed to “write everything to the file when script
is terminated”)
Couldn’t understand why there are newlinen in my yearly review blog post from last year. So - in markdown, two spaces and then a line break create a line break.
So, like this:
One
two
Three
Four
Fine, no spaces Six, no spaces
Highlight to see spaces:
So, like this:
One
*two*
> Three
> Four
> Fine, no spaces
> Six, no spaces
In connection to the above, yes. Updated ~/.vimrc
with the following:
set listchars=tab:\:\
set listchars+=trail:◦
Looks like this:
For the above had to convert my ~/.vimrc to utf-8, not the default latin-1:
:w ++enc=utf-8
<C-v> u25e6
(for “◦”/U+25E6, for example)This makes a screenshot as usual, opens it, opens the jekyll dtb assets folder, and puts the screenhsot name in the primary clipboard. I look at the screenshot, if I like it - I drag it directly to the folder, then use the vim/jekyll binding to insert it in the markdown.
bindsym Mod3+Shift+s --release exec scrot -s -e 'mv $f ~/s/screenshots && nomacs ~/s/screenshots/$f & echo -n $f | xclip -selection c && thunar ~/o/dtb/assets/pics/screenshots/'
echo -n
is echo without newline (otherwise it gets fed to xc with newline appended). Added to ~/.config/i3/config
.
Feels incredibly ugly and unstable but works for me I guess. Ideally it’s long enough to be replaced with a bash script, but not sure it’s worth it. But if I end up doing more of these, I’ll create a one custom big parametrized bash script that I’ll call like ./big-script.sh screenshot
.
map <leader>p i![](/assets/pics/screenshots/<esc>pa)<esc>0lli
in ~/.vimrc
Inserts a picture with filename from primary selection, then goes back to the description. Used with new i3 screenshot keybinding from above. a
in vim is “insert from next character”, so like A
but with words.
I really do need to use a
/e
etc in vim more often.
I seem to use more of-this-notation
lately, instead of this_notation
. Formalize this, not just for consistency, but to use this to my advantage - vim and company see these-words as separate, and this_word as one.
echo
without newline at the endecho -n
doesn’t add a newline. Especially useful combined with xclip
.
WKD - Matsuo Basho Archives: - Timeline -:
1662 or 1663 寛文二年
His first known hokku at age 19:春や来し年や行きけん小晦日
haru ya koshi toshi ya yukiken kotsugomori
has spring come
or has the year gone?
second-to-last-day
Tr. Barnhillwhat is spring that came
or was it the year that went?
the Second Last Day
Tr. UedaIst das Frühjahr gekommen
oder das Jahr vergangen?
Der vorletzte Tag.
Tr. Udo Wenzel
The Ukrainian translation seems imprecise, but still remains my favourite: Аніяких думок не лишилось в моїй голові наприкінці року!
Чи вже про весну, чи про минулий рік думати? Передостанній день року.
Переклад Геннадія Туркова
Послание к Римлянам 13:4 – Рим 13:4:
ибо начальник есть Божий слуга, тебе на добро. Если же делаешь зло, бойся, ибо он не напрасно носит меч: он Божий слуга, отмститель в наказание делающему злое.
Послание к Римлянам 13:4 – Рим 13:4: https://bible.by/verse/52/13/4/
Updated zsh alias to include non-work tasks tagged +A
or +O
from current sprint:
s () {task s \(project:w or \(sprint:$(date +%-V) \(+A or +O\)\) \) "$*"}
or
has to be lowercase, brackets in taskwarrior’s filtering have to be escaped.
Use a formula like this:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1xrGsOD-yXuORqd8cFg21XOo3ZIw9QbSiNDcnSEatlPM/edit#gid=0", "Sheet1!A:A")
1
For me it was ;
as separator; may need to confirm connecting sheets.