1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-05 08:08:02 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
jbranchaud
9e76753540 Add Open File On Remote Like GitHub as a VSCode TIL 2025-11-03 14:19:14 -05:00
jbranchaud
eb4dea611e Add Inspect Assertions Preventing Sleep as a Mac TIL 2025-11-02 15:21:31 -06:00
3 changed files with 68 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1678 TILs and counting..._
_1680 TILs and counting..._
See some of the other learning resources I work on:
@@ -706,6 +706,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Find The Process Using A Specific Port](mac/find-the-process-using-a-specific-port.md)
- [Gesture For Viewing All Windows Of Current App](mac/gesture-for-viewing-all-windows-of-current-app.md)
- [Insert A Non-Breaking Space Character](mac/insert-a-non-breaking-space-character.md)
- [Inspect Assertions Preventing Sleep](mac/inspect-assertions-preventing-sleep.md)
- [Keyboard Shortcuts For Interesting With Text Areas](mac/keyboard-shortcuts-for-interacting-with-text-areas.md)
- [List All The Say Voices](mac/list-all-the-say-voices.md)
- [Open Finder.app To Specific Directory](mac/open-finder-app-to-specific-directory.md)
@@ -1908,6 +1909,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Find The Location Of User Settings JSON File](vscode/find-the-location-of-user-settings-json-file.md)
- [Jump To Problems In The Current File](vscode/jump-to-problems-in-the-current-file.md)
- [Open An Integrated Terminal Window](vscode/open-an-integrated-terminal-window.md)
- [Open File On Remote Like GitHub](vscode/open-file-on-remote-like-github.md)
- [Pop Open The Quick Fix Window](vscode/pop-open-the-quick-fix-window.md)
- [Step Through Project-Wide Search Results](vscode/step-through-project-wide-search-results.md)
- [Synchronize Vim Clipboard With System Clipboard](vscode/synchronize-vim-clipboard-with-system-clipboard.md)

View File

@@ -0,0 +1,41 @@
# Inspect Assertions Preventing Sleep
The `pmset` command is for inspecting and manipulating _Power Management
Settings_ on MacOS. The `-g` flag is for _getting_ details. We can get a summary
of power assertions with `-g assertions`. These assertions are ways that the
system and display are prevented from sleeping.
A common assertion preventing sleep is the user being active. Another example of
an assertion is a program like `caffeinate` that sets a timeout preventing sleep
for a fixed period of time.
Here I activate a 30 minute (1600 second) `caffeinate` session and then I
inspect the power management assertions which shows the details of that
assertion as well as two others.
```bash
caffeinate -t 1600 &
[1] 98217
pmset -g assertions
2025-11-02 13:20:57 -0600
Assertion status system-wide:
BackgroundTask 0
ApplePushServiceTask 0
UserIsActive 1
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
ExternalMedia 0
PreventUserIdleSystemSleep 1
NetworkClientActive 0
Listed by owning process:
pid 98217(caffeinate): [0x00045477000194b3] 00:00:03 PreventUserIdleSystemSleep named: "caffeinate command-line tool"
Details: caffeinate asserting for 1600 secs
Localized=THE CAFFEINATE TOOL IS PREVENTING SLEEP.
Timeout will fire in 1597 secs Action=TimeoutActionRelease
pid 145(WindowServer): [0x00044f2f00099212] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle serviceID:10009be9e service:AppleUserHIDEventService product:CTRL Keyboard eventType:3"
Timeout will fire in 600 secs Action=TimeoutActionRelease
pid 80(powerd): [0x00044f2f00019216] 00:22:34 PreventUserIdleSystemSleep named: "Powerd - Prevent sleep while display is on"
```
See `man pmset` and `man caffeinate` for more details.

View File

@@ -0,0 +1,24 @@
# Open File On Remote Like GitHub
One of my favorite `vim-fugitive` features is being able to run the `:GBrowse`
command to open the current file or current selection of lines to GitHub in the
browser. This is useful for getting a shareable URL or even just being a
starting point for browsing the codebase from GitHub.
VSCode (as well as Cursor) supports this functionality as well. There are a
couple ways to do it.
First, from the File Browser sidebar you can right click on a particular file or
directory. Find the _Open on Remote (Web)_ submenu. From there select _Open File
on Remote_. That will open the file in GitHub with the focused line highlighted
(or will open to that directory, as the case may be).
Alternatively, you can right click in the file editor and follow the exact same
steps as described above.
If you're wanting a permalink to the remote that highlights a selection of
lines, you can highlight that section of lines and right-click the selected
lines and again follow the steps above.
If your remote is some other host like BitBucket, it will recognize that from
your project's gitconfig and open to that instead of GitHub.