Skip to content

Instantly share code, notes, and snippets.

View oaustegard's full-sized avatar
👻
mostly lurking

Oskar Austegard oaustegard

👻
mostly lurking
View GitHub Profile
@oaustegard
oaustegard / Space Links in Webex README.md
Last active March 30, 2021 19:17
Space Links in Webex
@oaustegard
oaustegard / Confluence_TinyUrl.md
Last active February 12, 2021 13:28
Confluence TinyURL Bookmarlet

Bookmarklet that gets the tiny url of a Confluence page and copies it to the clipboard - mashup of https://community.atlassian.com/t5/Answers-Developer-Questions/Display-Confluence-TinyURL-in-browser-address-bar/qaq-p/494148 and https://gist.github.com/stefanmaric/2abf96c740191cda3bc7a8b0fc905a7d

javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}(jQuery('link[rel="shortlink"]').attr('href'))
@oaustegard
oaustegard / README.md
Last active February 1, 2021 16:43
BigQuery CustomTargeting processing utility UDFs

Google Ad Manager BigQuery Utility Functions

These are a few utility functions useful for parsing the CustomTargeting field present in your DFP (GAM) tables

@oaustegard
oaustegard / file_count.py
Created October 31, 2020 02:56
Count files by extension
import re, os, collections, argparse
def getFileExtensionCount(root, extensions):
""" Get the file count by extension for the extensions of interest walking the directory
structure from a specified root folder
Arguments:
root -- the root path to start searching
extensions -- a pseudo-regex filter of extensions (sans leading period)
"""
@oaustegard
oaustegard / google_site_search_bookmarklet.js
Last active September 25, 2020 22:55
Google Site Search Bookmarklet
javascript:(function(){window.open("https://www.google.com/search?q=site:"+location.hostname.replace("www.","")+" "+window.prompt("Enter site search terms"))})()
@oaustegard
oaustegard / CheckCookie.html
Last active June 4, 2020 21:39
OneTrust Bookmarklets
<a href="javascript:alert(decodeURIComponent(document.cookie.split('; ').filter(c=>c.startsWith('Optanon'))))">Check OneTrust Cookie</a>
@oaustegard
oaustegard / ConnectBluetooth.script
Last active May 29, 2020 22:05
Connect to Bluetooth Keyboard
on run {input, parameters}
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
-- sourced from https://superuser.com/a/1348751
-- Working CONNECT Script. Goes through the following:
-- Clicks on Bluetooth Menu (OSX Top Menu Bar)
-- => Clicks on device Item
-- => Clicks on Connect Item
@oaustegard
oaustegard / getNthWeekdayOfMonth.sql
Last active May 29, 2020 12:51
BigQuery Utility Functions
-- Generates an array of dates matching the Nth (1st - 5th) weekday (Sun, Mon, Tue, etc) of each month
-- from startDate to endDate
CREATE OR REPLACE FUNCTION `yourProject.yourDB.getNthWeekdayOfMonth`(Nth INT64, weekday STRING, startDate DATE, endDate DATE) RETURNS ARRAY<DATE> AS (
(
select array
(
select dt from
(
select dt,
rank() over (partition by format_date("%a%b%Y", dt) order by dt) as WeekDayOfMonth,
@oaustegard
oaustegard / private.xml
Last active May 26, 2020 18:28 — forked from rootscript/private.xml
Karabiner private.xml for non-Apple keyboard to toggle Target Display Mode
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Dell</vendorname>
<vendorid>16700</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Dell USB Keyboard</productname>
<productid>8195</productid>
toggle_wifi() {
networksetup -getairportpower en${n};
if test $? -eq 0;
then
echo WiFi interface found: en${n};
eval "networksetup -setairportpower en${n} off"
eval "networksetup -setairportpower en${n} on"
return 0;
fi
return 1;