In the middle of the desert you can say anything you want
Resetting, Checking Out & Reverting | Atlassian Git Tutorial is a nice guide about ways to undo some of the commits. Reset is a harder way to undo stuff that sometimes leaves no traces, Revert is a way to create a commit that undoes the last N commits, so history is preserved and that’s good.
A way to revert the last N commits is this: 1
git revert --no-commit HEAD~3..
Two dots at the end are significant:
@cardamom Those specify a range. HEAD~3.. is the same as
HEAD~3..HEAD
So. I wanted to change time back to Berlin time from Ukrainian time.
Something was wrong.
~ → timedatectl status
Local time: Fr 2020-08-28 18:50:55 EEST
Universal time: Fr 2020-08-28 15:50:55 UTC
RTC time: Fr 2020-08-28 15:50:55
Time zone: Europe/Berlin (EEST, +0300)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
UTC is right, time zone is right, but local time is wrong.
Then I google and see that Europe/Berlin is actually EEST, +0200!
Then I realize the following:
Last time I needed to change the time, I changed the timezone, by doing:
sudo cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime
(#Kyivnotkiev)
/etc/localtime
was a SYMBOLIC LINK to /usr/share/zoneinfo/Europe/Berlin
~ → file /etc/localtime
/etc/localtime: symbolic link to ../usr/share/zoneinfo/Europe/Berlin
By doing that, I rewrote the Berlin timezone by making it Kyiv, changing the time on my computer and changing the Berlin timezone itself.
Fixed this with a bandaid by making my timezone Europe/Rome
, as /usr/share/zoneinfo/Europe/Rome
was never overwritten.
↑130 ~ → timedatectl status
Local time: Fr 2020-08-28 17:59:15 CEST
Universal time: Fr 2020-08-28 15:59:15 UTC
RTC time: Fr 2020-08-28 15:59:15
Time zone: Europe/Rome (CEST, +0200)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
Happy end.
Seemed to have a conflict w/ IPv6 VPN vs the IPv4 one, first had priority. Then I had an issue where the VPN IP was the same as the IP of my router. Fixed by moving router IP. Learned a lot about how DNS works.
nslookup somewebsite.com 8.8.8.8
looks up the website using the provided 8.8.8.8 DNS server.systemd-resolve --status
gives the current DNS settings.sudo systemd-resolve --flush-caches
flushes the DNS caches.How to get git diff with full context? - Stack Overflow - git diff -U1000000
- or wc -l
in place of the number - any number of line larger than the file works.
The window w/ CLI output or test output can be happily manipulated with ideavim! Now I can copypaste everything easily!
When operating on cells, not text (= not insert mode), the usual j/k
commands select cells when shift is used (J/K
). This is neat. I should read the documentation.
for
statementsIf you have only one statement in for loops, you can drop the brackets:
for (final String dt: distanceTypes)
for (final double co : cutoffs)
your_one_statement();
That said, it’s not a good idea :) Answer has details about the definitions, default scope for for is next statement. A statement can have brackets.
for loop without braces in java - Stack Overflow
Possibly sometime rewrite my link wiki (pchr8.net/f/)’s bookmarking userscript to accept data as title/complexity/rating/tag1 two three/Cat1 cat2 cat3
instead of the current multiline thingy, might be even easier to fit it into a userprompt
Jaro-Winkler handling empty strings · Issue #28 · tdebatty/java-string-similarity - TL;DR officially ‘undefined’, what has to be returned in implementations depends on why you need it. These are nice edge cases I have to learn to watch for.
String simularity has a nice table with similarity algos and how they perform with different changes.
{:height=“500px”}.
Is much more flexible than expected. git diff --unified=0
doesn’t show the context lines, only the changed ones; in general the documentation is worth reading, could be a good tool to add to my belt for various one-off tasks.
df.applymap(str)
converts everythnig to str. df.applymap()
applies a function to a Dataframe elementwise. (TODO anki)
If I don’t want to do import numpy as np
separately (for things like np.nan
), pd.np.nan
works! 1
np.nan
in the dataframe can be removed w/ df.fillna('')
, but after getting converted to string the NaN
become nan
and have to be removed by the string operation.
As a string operation, it’s important to watch out for strings containing nan
s, for example:
pd.DataFrame({'one':['two','three','four',pd.np.nan,23,'nonanme']}).applymap(str).replace('nan','',regex=True)
would change the last element. All answers here seem to have this issue.
So to remove them from a string representation, pd.DataFrame({'one':['two','three','four',pd.np.nan,23,'nonanme']}).applymap(str).replace('^nan$','',regex=True)
works, with a regex for nan
.
Changed keybinding to config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough')
, which translates to <C-S-=>
, but it seems to see =
as +
because Shift is being pressed.
command line - Using ‘diff’ (or anything else) to get character-level diff between text files - Stack Overflow gives this one nice string: git diff --word-diff=color --word-diff-regex=. file1 file2
which gives red/green characters for deletions/additions. Also, chaining greps also works nicely with grep -o
which passes only the text of the actual match. Grep doesn’t support capturing groups.
CheckStyle-IDEA - plugin for IntelliJ IDEA and Android Studio | JetBrains exists and I had better luck w/ it than with importing the checkstyle file from Style in Settings. Gives highlights inside the code itself automatically.
gcc
etc.To configure settings for where the generated line or block comments should be placed in Java, in the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Code Style | Java and on the Code Generation tab use options in the Comment Code section. 1
Intellij Idea Checkstyle highlights seem to refresh when I change a character and similar edits, but not when I change indentation w/ IdeaVim.
Rainbow CSV plugin is nice and highlights columns of the CSV in different colours - something I didn’t know I needed.
checkstyle – Imports explains (“Rationale:”) the rules used and in general is quite well-written.
"My_Sweet_String".equals(nullString);
is the way to go for string comparisons apparently, it avoids potential nullPointerExceptions. 2
A library implementing different string similarity and distance measures. A dozen of algorithms (including Levenshtein edit distance and sibblings, Jaro-Winkler, Longest Common Subsequence, cosine similarity etc.) are currently implemented.
algorithm - Normalizing the edit distance - Stack Overflow has info about normalizing distances like Levenshtein etc. And how a normalized distance is not a metric anymore, as it violates the Triangle inequality w/ sum of two sides of the triangle not being longer than the third.
Longest common subsequence problem - Wikipedia is different from Longest Common Substring is that subsequences are not required to be uninterrupted.
!Bernard Moitessier’s tomb is Bernard Moitessier’s tomb.
… though most of this is helpfully configurable in ideavim; esp:
map <leader>b :action GotoDeclaration<CR>
1 for “go to declaration”, which is <Alt+B>
in vanilla ideavim. I should track things I use my mouse for most often and replace them with ideavim shortcuts.
Nice that I don’t have to use BIOS for this. <Fn+Esc>
disables Fn key functionality.
<leader>
is currently Spacebar. ↩︎
I read Black On Red: My 44 Years Inside The Soviet Union, a book by Robert Robinson, An African-American who lived in Detroit during the Depression. I had to read it again, for it is about as gripping an autobiography as one can find.
$wgFileExtensions = [
'png', 'gif', 'jpg', 'jpeg',
];