In the middle of the desert you can say anything you want
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).
Unfurl | Definition of Unfurl by Merriam-Webster - “expand, extend, fan (out), flare (out), open, outspread, outstretch, spread (out), stretch (out), unfold”
Things I love so far:
das Teufelszeug - appalling/hellish/infernal stuff (heard at work)
I so missed this.
Adding to ~/.inputrc
this line:
set editing-mode vi
makes all readline programs use vi mode, including Python interactive console. Wow.
Alternatively, this apparently works too when typed into python console:
import readline
readline.parse_and_bind("set editing-mode vi")
ardagnir/athame: Full vim for your shell (bash, zsh, gdb, python, etc)
One can install it in place of the usual readline locally or globally.
Installed for zsh, now I can use ci(
bindings again!
In [Day732]({{site.baseurl}}{% link _posts/2021-01-02-day732.markdown %}), I changed my ./vimrc
to utf8 from latin-1, to be able to use the “◦
” symbol to mark trailing spaces.
Well, it broke the vim macros for the link wiki (from [Day 450]({{site.baseurl}}{% link _posts/2020-06-23-day540.markdown %})) :( I had the latin version of the .vimrc backed up, falling back to it for now.
I need to think of a way to save these macros better, because even copypasting them to this dtb didn’t work and I had to do text encoding magic. I think this is exactly the time one should use a proper scripting language like Python, and write another small qutebrowser script that changes the contents of the filled textarea.
link
links to pages, post_url
links directly to posts inside _posts
.
Link to pages:
{%raw%}
{% link _collection/document-name.md %}
{{ site.baseurl }}{% link _collection/document-name.md %}
{{ site.baseurl }}{% link _posts/2019-03-06-post-title.md %}
{{ site.baseurl }}{% link services/index.html %}
{{ site.baseurl }}{% link /assets/documents/pal-codes.pdf %}
{%endraw%}
Links to posts:
{%raw%}
{% post_url 2019-03-06-post-title.md %}
{{ site.baseurl }}{% post_url 2019-03-06-post-title.md %}
{{ site.baseurl }}{% post_url /folder/2019-03-06-post-title.md %}
{%endraw%}
Copied directly from this excellent page, I never found this explained in such a readable way: How to create internal links in Jekyll | Web Island Blog
Write a small script that allows me to easily link to days just by their day number.
Before URI contained the date and was hard to link to. Now I changed this in _config.yml
:
permalink: :title:output_ext
Links are now like this: https://www.pchr8.net/d/dtb/day749.html
float('inf')
works for floats, but there’s no way to do it with int
s. math.inf
is also a float. 1
<Ctrl-C>
Made a typo, vim attempted to indent 20k lines (and started counting “xx lines to indent…”, intuitively pressed <Ctrl-C>
, it successfully interrupted the operation!
Simplified bindings for passthrogh, added last line to ~/.config/qutebrowser/config.py
config.unbind('<Shift-Escape>', mode='passthrough')
config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough')
config.bind('<Shift-I>', 'enter-mode passthrough')
Would allow me to use websites’ own shortcuts more often.
100 point check - Wikipedia (seen first here: I was a very happy FastMail customer until a hacker asked them to reset my passw… | Hacker News)