- TODO dotfiles
- TODO key rebinding (no longer need karabiner elements!)
- TODO other key remapping (like disable globe key)
- TODO save screenshots to folder
- defaults write com.apple.dock expose-animation-duration -float 0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export async function* createAsyncGenerator<T>( | |
| createResource: (opts: { send: (value: T) => void, close: () => void }) => void, | |
| reconnect?: () => Promise<void> | |
| ): AsyncGenerator<T, void, undefined> { | |
| while (true) { | |
| let closed = false; | |
| let buffer: T[] = []; | |
| let bufferHasData = createEvent(); | |
| createResource({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import contextvars | |
| import asyncio | |
| from contextlib import asynccontextmanager | |
| from typing import TypeVar | |
| T = TypeVar("T") | |
| @asynccontextmanager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from subprocess import check_output | |
| def get_git_current_commit(): | |
| return _get_git_hashes("rev-parse", "HEAD")[0] | |
| def get_git_last_pushed_commit(): | |
| unpushed_commits = get_git_unpushed_commits() | |
| if not unpushed_commits: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def gcs_list_folders(bucket, prefix="", delimeter="/", guess_lexicographically_last_item="~", gcs_client=None): | |
| folders = set() | |
| prefix_parts = prefix.split(delimeter) | |
| start_offset = "/".join(prefix_parts) | |
| last_blob_name = None | |
| while True: | |
| blobs = list(gcs_client.list_blobs( | |
| bucket_or_name=bucket, | |
| prefix=prefix, | |
| start_offset=start_offset, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from textwrap import dedent | |
| import subprocess | |
| def macos_get_focused_application(): | |
| return subprocess.check_output(['osascript'], input=dedent(''' | |
| tell application "System Events" | |
| set frontApp to name of first application process whose frontmost is true | |
| end tell |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async def _on_message(message : Message): | |
| print(f'[received message] {message}') | |
| print((message.arbitration_id, binascii.hexlify(message.data))) | |
| if message.arbitration_id == 0x0241 and binascii.hexlify(message.data) == b'0008021a90': | |
| print(f'FOUND MESSAGE! {message}') | |
| found_message.set_result((True, binascii.hexlify(message.data))) | |
| async with pcan.listen_message(_on_message): | |
| print('Listening for messages!') | |
| print('Sending obd_driver') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from textwrap import dedent | |
| def wait_until_images_loaded(driver, timeout=30): | |
| """Waits for all images & background images to load.""" | |
| driver.set_script_timeout(timeout) | |
| driver.execute_async_script(dedent(''' | |
| // Function to extract URL from CSS 'url()' function | |
| function extractCSSURL(text) { | |
| var url_str = text.replace(/.*url\((.*)\).*/, '$1'); |