Skip to content

Instantly share code, notes, and snippets.

Ryan Munro munro

Block or report user

Report or block munro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@munro
munro / macos_get_focused_application.py
Created Jan 29, 2019
macos_get_focused_application
View macos_get_focused_application.py
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
View cb_2017_us_ua10_500k.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View REVOKED keybase.md

REVOKED

Keybase proof

I hereby claim:

  • I am munro on github.
  • I am rmunro (https://keybase.io/rmunro) on keybase.
  • I have a public key ASDsCvjO5_lAJHghRO9S-8j0vuoNj0MHDeAIx1X4l0DOWwo

To claim this, I am signing this object:

View gist:05de5436e39cda662d2a171dc0f17ab5
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')
@munro
munro / selenium_wait_for_images_loaded.py
Created Jan 5, 2016
Selenium wait for all images to load, including background images.
View selenium_wait_for_images_loaded.py
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 extractCSSURL(text) {
var url_str = text.replace(/.*url\((.*)\).*/, '$1');
if (url_str[0] === '"') {
View example.py
print_grid(
columns=('Function', 'Occurences', 'Sender'),
values=[(x['function'], 1337, x['sender']) for x in messages if 'function' in x]
)
View parser.py
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>.*)')
View keybase.md

Keybase proof

I hereby claim:

  • I am munro on github.
  • I am rmunro (https://keybase.io/rmunro) on keybase.
  • I have a public key whose fingerprint is 7BAA 3439 285A 6C14 C875 0F00 65AD 4B26 5848 C576

To claim this, I am signing this object:

View foo.js
webpack_config.entry.unshift(
'webpack-dev-server/client?' + argv.root_url,
'webpack/hot/dev-server'
);
webpack_config.plugins.unshift(
new webpack.HotModuleReplacementPlugin()
);
webpack_config.devtool = '#source-map';
webpack_config.pathInfo = true;
View app.js
var config = require('./config');
You can’t perform that action at this time.