- Map
caps lock
toleft option
This file contains 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 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 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 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 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'); |
This file contains 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
print_grid( | |
columns=('Function', 'Occurences', 'Sender'), | |
values=[(x['function'], 1337, x['sender']) for x in messages if 'function' in x] | |
) |
This file contains 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 re | |
import sys | |
import json | |
import itertools | |
from collections import Counter | |
from collections import defaultdict | |
SPLIT_MESSAGES = re.compile(r'\n.?\w{3} \w+ +\d+ \d+:\d+:\d+ \d+[\r\s]*\n') | |
MATCH_SIGNAL = re.compile(r'signal sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)') | |
MATCH_METHOD_CALL = re.compile(r'method call sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)') |