Skip to content

Instantly share code, notes, and snippets.

@mayosuke
mayosuke / count-aog.sh
Created November 28, 2018 09:27
Count number of Actions on Google with puppeteer/pup/jq
URL_BASE='https://assistant.google.com/'
locale=$1
categoryUrls=(
`node load-aog-html.js "${URL_BASE}explore?hl=${1}" waitLazyLoad | pup 'li.DH6Rkf-ibnC6b a.hSRGPd[jslog] json{}' | jq '.[].href' -r | sort | uniq`
)
for category in "${categoryUrls[@]}"
do
subCategoryUrls=(
`node load-aog-html.js "${URL_BASE}${category}" waitLazyLoad | pup 'div.v4cdld-r6IkTd div[jscontroller="ynTBf"] json{}' | jq '.[]."data-link"' -r | sed s/amp\;//g`
)
@mayosuke
mayosuke / count-aog.js
Last active November 28, 2018 14:28
Count Actions on Google
const puppeteer = require('puppeteer');
const URL_BASE = 'https://assistant.google.com/';
const locale = process.argv[2]; // 'ja-JP', 'en-US', etc...
(async () => {
const browser = await puppeteer.launch();
const categories = await getElements(browser, `${URL_BASE}explore?hl=${locale}`, _ => {
var elements = document.getElementsByClassName('DH6Rkf-ibnC6b');
@mayosuke
mayosuke / eight-connections.txt
Created August 31, 2019 12:26
Logs of Raspberry Pi 3B+ Maximum BLE Connections
$ sudo node app.js
devices to be scanned: B1_6,B1_7,B1_8,B2_6,B2_7,B2_8,B2_9,B2_10
B2_7: started receiving notification
B1_8: started receiving notification
B1_6: started receiving notification
B2_8: started receiving notification
B2_10: started receiving notification
{ value: 141, segment_code: 'B2_7' }
{ value: 611, segment_code: 'B1_8' }
B1_7: started receiving notification
FOV = 90.0
plane_depth = DepthConversion(depth, FOV)
plt.imshow(applyColorMap(plane_depth))
H, W = depth.shape
x = np.arange(W)
y = H / 2
plt.plot(x, depth[y,x],label='distance from camera center')
plt.plot(x, plane_depth[y,x],label='distance from camera plane')
plt.legend()