Skip to content

Instantly share code, notes, and snippets.

View scips's full-sized avatar

Sébastien Barbieri scips

View GitHub Profile
@scips
scips / cat-head.ps1
Created February 12, 2022 15:36
Powershell cat tail head ...
gc log.txt | select -first 10 # head
gc -TotalCount 10 log.txt # also head
gc log.txt | select -last 10 # tail
gc -Tail 10 log.txt # also tail (since PSv3), also much faster than above option
gc log.txt | more # or less if you have it installed
gc log.txt | %{ $_ -replace '\d+', '($0)' } # sed
SELECT event_date, device.web_info.browser, REGEXP_EXTRACT(device.web_info.browser_version, r'^(\d+)') as browser_major_version, COUNT(*) as total
FROM `*-analytics-*.analytics_*.events_*`
WHERE platform='WEB' AND event_name = 'page_view' AND event_date BETWEEN FORMAT_DATE("%Y%m%d",DATE_ADD(CURRENT_DATE(), INTERVAL -1 WEEK)) AND FORMAT_DATE("%Y%m%d",CURRENT_DATE())
GROUP BY event_date, device.web_info.browser, browser_major_version
ORDER BY event_date DESC,total DESC
@scips
scips / Get slide metadata.POWERPOINT.yaml
Created October 6, 2022 10:36
Gets the title, index, and ID of the selected slide(s).
name: Get slide metadata
description: 'Gets the title, index, and ID of the selected slide(s).'
host: POWERPOINT
api_set: {}
script:
content: |
$("#get-slide-metadata").click(getSlideMetadata);
function getSlideMetadata() {
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function(asyncResult) {