Skip to content

Commit

Permalink
(obsidian) misc. note updates from the past period + updated software…
Browse files Browse the repository at this point in the history
… submodules.
  • Loading branch information
GerHobbelt committed Jan 13, 2025
1 parent 363cd59 commit 7f78f7e
Show file tree
Hide file tree
Showing 13 changed files with 510 additions and 94 deletions.
2 changes: 1 addition & 1 deletion MuPDF
Submodule MuPDF updated from c81fea to 54dea4
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,15 @@ int edit_distance_dp_basic(const string& str1, const string& str2)
return rv;
}
```
```

---

## Post Scriptum: minor bonus note: `std::unique_ptr(new Obj)` vs. `std::make_unique<Obj>()`

As seen on a C++ blog (link not immediately at hand while writing this from human memory, sorry) there's one minor performance improvement: `std::unique_ptr<X2> p1(new X2)` is not cache-optimal as it takes two(2) heap allocations: one for the `X2` object and one for the `std::unique_ptr` internals necessary for `unique_ptr` to deliver its gorgeous magic to us, which include a counter (for `weak_ptr` family relations) and a to-be-dereferenced *pointer* to the `X2` instance now located elsewhere on the heap.
All this while the `std::make_unique` idiom only takes a *single* allocation, combining the `X2` instance and the `unique_ptr` internals into a single heap chunk, thus improving CPU access performance of the `X2` instance as the pointer dereference will very probably address (depending on the size of `X2` and the CPU cache line width) `X2` memory residing in the very same cache line, which is 👍 for performance.

The key there was that the `std::unique_ptr<X2> p1(new X2)` is only potentially beneficial when your usage of the `std::unique_ptr` is one where you use `.reset()`, `.swap()` or `operator=` to have it release its hold on your `X2` instance *early* and `free/delete` that one from the heap long before the `std::unique_ptr` instance itself goes out of scope, where its internals are released back into the heap: as `std::make_unique` treats both as a single heap chunk, your `X2` destructor may be called as early as before, but the actual releasing-back-allocated-memory-to-the-heap activity will have to wait until the `std::unique_ptr` instance goes out of scope as well, potentially increasing peak heap memory usage to undesirable levels then as the allocate-release timeline for the heap will be quite different. Otherwise, they argued (and I don't see any flaw in their logic), it's advisable to use `std::make_unique` instead of the `new/assignment` idiom to set up your `std::unique_ptr` instances.

Granted, my brain keeps thinking in terms of the outmoded constructor+`new` rather than `std::make_unique` best practices, so this sub-par idiom may show up in a few places still, after today. Alas. I blame my advancing age. *(koff koff koff)*😇
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# \[useful feature:] Chrome Browser :: colouring a selected chunk of text in an arbitrary web page

*(Handy when you want to have searched phrases in a larger text highlighted.)*

I noticed this behaviour for a while in Chrome when I followed links from explanatory paragraphs in Google Search: it's a specially crafted `#` hash part of the URL, e.g.

`https://en.wikipedia.org/wiki/Attention_(machine_learning)#:~:text=which%20are%20computed`

Note the `#:~:text=` in that URL: that suffices to have Chrome show the web page with any matched text highlighted in purple for your convenience, e.g. try & click this link: https://en.wikipedia.org/wiki/Attention_(machine_learning)#:~:text=which%20are%20computed

Once I had realized it's a *browser*-specific thing, here's more info on this browser feature:

- https://support.google.com/chrome/answer/10256233?hl=en&co=GENIE.Platform%3DDesktop
- https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-url
- https://wicg.github.io/ScrollToTextFragment/ + https://chromestatus.com/feature/4733392803332096
- **[CanIUse](https://caniuse.com/) feature check**: https://caniuse.com/url-scroll-to-text-fragment --> everybody's got it, in 2024AD, which is a good thing for us, as I can use this in Qiqqa Ⅱ 🥳



------

Quoting https://stackoverflow.com/posts/62162093/timeline:

## Scroll To Text Fragment

This is a feature called **[Scroll To Text Fragment](https://chromestatus.com/feature/4733392803332096)**. It is [enabled by default since Chrome 80](https://www.chromestatus.com/features/4733392803332096), but apparently not yet implemented in other browsers.

There are quite nice examples in the ["W3C Community Group Draft Report"](https://wicg.github.io/ScrollToTextFragment/). More good examples can be found on [Wikipedia](https://en.wikipedia.org/wiki/Fragment_identifier#Examples).

### Highlighting the first appearance of a certain text

Just append `#:~:text=<text>` to the URL. The text search is not case-sensitive.

**Example:** [https://example.com#:~:text=domain](https://example.com/#:%7E:text=domain) [![The word "domain" is highlighted on example.com](https://i.sstatic.net/mHPz1.png)](https://i.sstatic.net/mHPz1.png)

### Highlighting a whole section of text

You can use `#:~:text=<first word>,<last word>` to highlight a whole section of text.

**Example:** [https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-url/62162093#:~:text=Apparently,Wikipedia](https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-url/62162093#:%7E:text=Apparently,Wikipedia) [![part of this very answer is highlighted](https://i.sstatic.net/fIqVh.jpg)](https://i.sstatic.net/fIqVh.jpg)

### More advanced techniques

- Prefixing and suffixing like the [example suggested in the repository for the suggestion](https://github.com/WICG/ScrollToTextFragment/#identifying-a-text-snippet) [https://en.wikipedia.org/wiki/Cat#:~:text=Claws-,Like%20almost,the%20Felidae%2C,-cats](https://en.wikipedia.org/wiki/Cat#:%7E:text=Claws-,Like%20almost,the%20Felidae%2C,-cats) texts as proposed don't seem to work for me (yet? I use Chrome 83).
- You can [style the look of the highlighted text](https://github.com/WICG/ScrollToTextFragment/#target) with the CSS `:target` and you can [opt your website out](https://github.com/WICG/ScrollToTextFragment/#opting-out) so this feature does not work with it anymore.




--------------

Allegedly already available since Chrome 80/83, which is quite a while back. Ah well, browser feature trend watching isn't my forte. 😅



Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# x

See https://github.com/git-for-windows/git/issues/1000#issuecomment-301611003:

Upon closer inspection using stat test.xls in Git Bash, it would appear that the change time is modified by Excel along with the bytes on disk, but not the modified time. I fear that the described problem is related to the fact that Git for Windows has to take a couple of shortcuts when trying to emulate Linux' semantics. In particular, when the so-called "stat" data (essentially, all the metadata for a give file) is emulated, we use the FindFirstFile()/FindNextFile() API which gives us the time of the last access, the time of the last modification and the creation time. Sadly, that differs slightly from the POSIX semantics that Git wants to see, where the first two times are identical, but the ctime does not refer to the creation time but the change time. But we do not have a fast way to get at the change time, only the access time, modified time and creation time. We could get the change time, via the ChangeTime field in the FILE_BASIC_INFO data structure initialized by GetFileAttributesByHandleEx() function, but that requires a HANDLE, which we can only obtain using CreateFile() (which is orders of magnitude slower than FindFirstFile()/FindNextFile(). So what Git for Windows does is rely on applications to update the modified time when changing any file contents. But that is not the case with Excel. I fear there is not really anything we can do here, not unless we want to slow down Git for Windows dramatically (in most cases, for no good reason)...

Just FWIW.
It seem that it depend on the FS used (and the underlying OS drivers for that FS).
My findings are that:

```
#--------------------------------------
# [a/c/m]time
#--------------------------------------
# On Windows (via Cygwin & Python3):
# The creation time is: aTime .CreationTime === .LastAccessTime in Poweshell, but known as "access" time in Linux)
# The modification time is: mTime == cTime .LastWriteTime in Poweshell
#
# On Linux:
# The creation time is: cTime
# The modification time is: mTime
# The access time is: aTime (normally not used)
#
# ==> For seeing last modification time, use "cTime" on Windows FS's, and "mTime" on *linux FS's
#--------------------------------------
```

IDK why an _Excel_ file would behave different from any other "Windows" generated file, in this respect.

... plus:

https://community.hpe.com/t5/operating-system-hp-ux/what-s-the-difference-of-ctime-and-mtime-in-find-command/td-p/3341256?nobounce

### Re: what's the difference of -ctime and -mtime in find command?

mtime refers to the modification time of the file, while ctime refers to a change in the status information of the file. For example, you could use the touch command to alter the date of the file (the status information), without actually changing the file itself.

At least that's the way I interpret it.

Pete

------

Pete's right. Even if you can change both change and modification with touch (-c or -m).

You have 3 dates for a file :
. ctime : change time. It gives you the last time a modification was done on the inode. For example chmod. You can see it with ls -lu file.
. mtime : modification time. It gives the last time the file content was modified. For example with vi. It is the one normally displayed by ls -l.
. atime : access time. It gives you the last time the file was accessed. Even cat modifies this date.


### https://nicolasbouliane.com/blog/knowing-difference-mtime-ctime-atime :: Knowing the difference between mtime, ctime and atime

If you are dealing with files, you might wonder what the difference is between `mtime``ctime` and `atime`.

`mtime`, or modification time, is when the file was last modified. When you change the _contents_ of a file, its mtime changes.

`ctime`, or change time, is when the file’s property changes. It will always be changed when the mtime changes, but also when you change the file’s permissions, name or location.

`atime`, or access time, is updated when the file’s contents are read by an application or a command such as `grep` or `cat`.

The easiest way to remember which is which is to read their alphabetical order:

- `Atime` can be updated alone
- `Ctime` will update `atime`
- `Mtime` will update both `atime` and `ctime`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Unicode ~~replacement~~ ~~alternative~~ *homoglyphs* for \[...\] square brackets in MarkDown

Because I'm kinda lazy and slightly irritated at having to ugly-`\\`-backslash-escape the square brackets when I want them to appear as-is.

First, the general I-am-looking-for-??? Unicode glyph/codepoint site that works well (best) for me is: https://symbl.cc/

But finding homoglyphs when you need/want them is still a bit of a hassle as the added/follow-up problem is: does the codepoint I selected as a homoglyph-du-jour actually *exist* in my display/screen font? Sometimes it doesn't, so the process becomes iterative. Alas.

Some homoglyph lists:

- http://xahlee.info/comp/unicode_look_alike_math_symbols.html
- https://gist.github.com/StevenACoffman/a5f6f682d94e38ed804182dc2693ed4b
- https://github.com/codebox/homoglyph
- https://github.com/life4/homoglyphs
- and the inverse: getting back to the base/ASCII form: https://github.com/nodeca/unhomoglyph, which happens to reference the very useful **official set of Unicode Confusables**: [Recommended confusable mapping for IDN](http://www.unicode.org/Public/security/latest/confusables.txt)

Anyway, let's see what we got for the `[` bracket glyph....

- `[`: "\[...]"
- ``: "⟦..." -- https://symbl.cc/en/27E6/ "Mathematical Left White Square Bracket"
- (note the ugly extra left-side whitespace occupied by the codepoint) ``: "〚....]" -- https://symbl.cc/en/301A/ "Left White Square Bracket"
- (uglier due to minimal underline-like cruft...) ``: "⦋...]" -- https://symbl.cc/en/298B/ "Left Square Bracket with Underbar"
- - ``: "⦍...]" -- https://symbl.cc/en/298D/ "Left Square Bracket with Tick In Top Corner"
- - ``: "⦏...]" -- https://symbl.cc/en/298F/ "Left Square Bracket with Tick In Bottom Corner"

and the other one of the 'matched set':

- `]`
- ``: https://symbl.cc/en/27E7/ "Mathematical Right White Square Bracket"

(... TODO ....)
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Unicode homoglyphs :: adversarial Unicode characters

The Unicode Consortium has its own place for these: https://util.unicode.org/UnicodeJsps/confusables.jsp?a=-:;/\?!*|%3C%3E{}%27%22abcdefghijklmnopqrstuvwxyz0123456789&r=None & https://www.unicode.org/Public/security/16.0.0/confusables.txt + the other files in https://www.unicode.org/Public/security/16.0.0/ .

Also do note the recommendations in https://www.unicode.org/reports/tr36/ (*Unicode Security Considerations*), e.g. *3.6 Secure Encoding Conversion* and *3.7 Enabling Lossless Conversion*.


## Unicode homoglyphs for Win32/NTFS & UNIX illegal filename characters


PHP code based on examples and libraries from phlyLabs Berlin; part of [phlyMail](http://phlymail.com/)
Also thanks to [http://homoglyphs.net](http://homoglyphs.net/) for helping me find more glyphs.


| **Char** | **Homoglyphs** |
| ---- | ---- |
| ! | ! ǃ ! |
| " | " ״ ″ " |
| $ | $ $ |
| % | % % |
| & | & & |
| ' | ' ' |
| ( | ( ﹝ ( |
| ) | ) ﹞ ) |
| * | * ⁎ * |
| + | + + |
| , | , ‚ , |
| - | - ‐ - |
| . | . ٠ ۔ ܁ ܂ ․ ‧ 。 . 。  ․  |
| / | / ̸ ⁄ ∕ ╱ ⫻ ⫽ / ノ |
| 0 | 0 O o Ο ο О о Օ O o |
| 1 | 1 1 |
| 2 | 2 2 |
| 3 | 3 3 |
| 4 | 4 4 |
| 5 | 5 5 |
| 6 | 6 6 |
| 7 | 7 7 |
| 8 | 8 8 |
| 9 | 9 9 |
| | |
| : | : ։ ܃ ܄ ∶ ꞉ : ∶  |
| ; | ; ; ; ; |
| < | < ‹ < |
| = | = = |
| > | > › > |
| ? | ? ? |
| @ | @ @ |
| [ | [|
| ] | ]|
| ^ | ^ ^ |
| _ | _ _ |
| ` | ` ` |
| a | A a À Á Â Ã Ä Å à á â ã ä å ɑ Α α а Ꭺ A a |
| b | B b ß ʙ Β β В Ь Ᏼ ᛒ B b ḅ |
| c | C c ϲ Ϲ С с Ꮯ Ⅽ ⅽ C c |
| d | D d Ď ď Đ đ ԁ ժ Ꭰ ḍ Ⅾ ⅾ D d |
| e | E e È É Ê Ë é ê ë Ē ē Ĕ ĕ Ė ė Ę Ě ě Ε Е е Ꭼ E e |
| f | F f Ϝ F f |
| g | G g ɡ ɢ Ԍ ն Ꮐ G g |
| h | H h ʜ Η Н һ Ꮋ H h |
| i | I i ɩ Ι І і ا Ꭵ ᛁ Ⅰ ⅰ I i |
| j | J j ϳ Ј ј յ Ꭻ J j |
| k | K k Κ κ К Ꮶ ᛕ K K k |
| l | L l ʟ ι ا Ꮮ Ⅼ ⅼ L l |
| m | M m Μ Ϻ М Ꮇ ᛖ Ⅿ ⅿ M m |
| n | N n ɴ Ν N n |
| 0 | 0 O o Ο ο О о Օ O o |
| p | P p Ρ ρ Р р Ꮲ P p |
| q | Q q Ⴍ Ⴓ Q q |
| r | R r ʀ Ի Ꮢ ᚱ R r |
| s | S s Ѕ ѕ Տ Ⴝ Ꮪ S s |
| t | T t Τ τ Т Ꭲ T t |
| u | U u μ υ Ա Ս ⋃ U u |
| v | V v ν Ѵ ѵ Ꮩ Ⅴ ⅴ V v |
| w | W w ѡ Ꮃ W w |
| x | X x Χ χ Х х Ⅹ ⅹ X x |
| y | Y y ʏ Υ γ у Ү Y y |
| z | Z z Ζ Ꮓ Z z |
| { | { { |
| \| | \| ǀ ا | |
| } | } } |
| ~ | ~ ⁓ ~ |
| ß | ß |
| ä | Ä Ӓ |
| ö | ӧ Ö Ӧ |
| | |



Loading

0 comments on commit 7f78f7e

Please sign in to comment.