In the middle of the desert you can say anything you want
Had issues with NoiseTorch microphone not working, fixed by changing the microphone and then back. (…) While I’m at it, updated NoiseTorch, and added this snippet to the polkit config to not-enter passwords: I don’t want to enter my password everytime · lawl/NoiseTorch Wiki
Still exists and still works!
sshfs me@server:/some/folder /my/local/folder -p 12345
umount /my/local/folder
An insecure faster version is: sshfs -o Ciphers=aes128-ctr -o Compression=no me@server:/some/folder /my/local/folder -p 12345
(In my case, most of my lag was from zsh git prompt plugin, removing it made it much faster)
When a monitor stops working, sometimes it is fixed by deactivating/applying/activating/applying in arandr, or doing any changes to it intead of deactivating it. I’ve been changing its resolution, but to maximally preserve the layout, just inverting it (and back) works too!
Nomacs is extremely slow when viewing images located on a remote server, any other viewer works for me. The default one is eog
/ “Eye of Gnome”
tracemalloc
is part of the python standard library!
This snippet from the docs1 has everything:
import linecache
import os
import tracemalloc
def display_top(snapshot, key_type='lineno', limit=10):
snapshot = snapshot.filter_traces((
tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
tracemalloc.Filter(False, "<unknown>"),
))
top_stats = snapshot.statistics(key_type)
print("Top %s lines" % limit)
for index, stat in enumerate(top_stats[:limit], 1):
frame = stat.traceback[0]
print("#%s: %s:%s: %.1f KiB"
% (index, frame.filename, frame.lineno, stat.size / 1024))
line = linecache.getline(frame.filename, frame.lineno).strip()
if line:
print(' %s' % line)
other = top_stats[limit:]
if other:
size = sum(stat.size for stat in other)
print("%s other: %.1f KiB" % (len(other), size / 1024))
total = sum(stat.size for stat in top_stats)
print("Total allocated size: %.1f KiB" % (total / 1024))
tracemalloc.start()
# ... run your application ...
snapshot = tracemalloc.take_snapshot()
display_top(snapshot)
Added <Shift+Alt+C>
for “commit”, since <Ctrl+K>
doesn’t work (and afaik is not used for anything else).
(<Ctrl+Shift+C>
is still “copy path”)
<Ctrl-Shift-#>
(where ‘#’ is 1-9) adds named bookmarks to lines in the file; <Ctrl-#>
to go there. (It’s logical to make it easier to go to a bookmark than to set one, given that the former should happen more often). Complements nicely ideavim’s m#
bindings.
These bookmarks are global.
In the description of the plugin GoToTabs: Now it’s supported natively through keymap->other->tabs! Can’t get tab 2 to work, but I couldn’t do this with bookmarks either, something is catching that binding before it gets to intellij?
Also in idea you can map numpad numbers - I could remap them for bookmarks.
TODO make a backup of my keymap.
And - there’s TabNumberIndicator, that adds the Alt+# bindings and shows the tab number in the tab! Exactly what I wanted.
<Ctrl+,>
for moving the tab left though MoveTab plugin.EDIT - argh, I knew I needed these Alt+# bindings. TODO change them to Ctrl+Alt+… or similar.
virtualenv-clone
is the package, syntax is 1
python -m clonevirtualenv source/ target/
This is brilliant: collision detection - What is the fastest way to work out 2D bounding box intersection? - Game Development Stack Exchange
return !(r2.left > r1.right
|| r2.right < r1.left
|| r2.top < r1.bottom
|| r2.bottom > r1.top);
The idea is to capture all possible conditions upon which the rectangles will not overlap, and then negate the answer to see if they are overlapped
Originally from here: Rectangle Intersection – Determine if two given rectangles intersect each other or not « Technical Interview Questions
Doing it straight-forwardly would require more conditions.
Surprisingly intuitive and shows once more that when finding the answer is too hard, trying to find the answer to an opposite question might help you out.
Python venv (virual environment) uses wrong version of Python - Stack Overflow:
As an addition to the accepted answer, be also aware that changing the directory name where your venv is located causes using the default python and pip paths of your system, instead of using the venv one.
This explains so much!
To make an existing virtualenv movable not included in the new venv. :( 1
No easy official way, reinstalling is much easier.
To find out where a certain package is installed, pip list -v
.
import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
try:
response = client.chat_postMessage(channel='vision-trainings', text="Hello world!")
assert response["message"]["text"] == "Hello world!"
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["ok"] is False
assert e.response["error"] # str like 'invalid_auth', 'channel_not_found'
print(f"Got an error: {e.response['error']}")
Find that branch in git log, right click on the file(s) you want, “Apply selected changes”. 2 (“Cherry-pick selected changes” according to Help)
fig = plt.figure(figsize=(20, 15))
ax = plt.subplot(132)
#plt.gcf().tight_layout(rect=[0, 0, 1, 0.90])
plt.gcf().tight_layout()
fig.subplots_adjust(right=0.9)
cbar_ax = fig.add_axes([0.92, 0.10, 0.04, 0.8])
if heatmap is not None:
fig.colorbar(heatmap, cax=cbar_ax)
Shows incoming and outgoing links, useful to look for other places with similar info.
<Alt-F8>
that code is automatically written there!<Shift+Alt+9>
/“Run to cursor” more oftenThe Battle of the OCR Engines - Tesseract vs Google Vision | Blog | Fuzzy Labs - really nice! Compares three modes of Tesseract and two Google Vision. TODO add to /f/
Timewarrior accepts time the way I usually write it in my notes!
timew track 1520 - 1600 stuff
just worked!
I find the “Install pytorch” thing on the pytorch website really nice. You click things and it gives you a command.
Command Line Interface Guidelines - thank you AA “An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day.”
New strategy - use only German, look up any grammar stuff I have to, and add the things I have to look up to anki. (Just realized I’m googling whether it’s “dir passt” or “dich passt”, it’s 10/10 an use-case flashcards).
.. is really awesome! I should spend some time getting to know it. Example: https://colab.research.google.com/drive/1lzjbBQsF4X2C2WZhxBJz0wFEQor7F-fv?usp=sharing#scrollTo=kbHSUnMRJNTv
Broke log-in to an external server I have access to by attempting to use
ssh-copy-id me@server
, after which it still wanted my password but once inputted correctly didn’t start the shell. (Though showed the motd).