Skip to content

Instantly share code, notes, and snippets.

mostly lurking

Oskar Austegard oaustegard

mostly lurking
View GitHub Profile
View Waze LiveMap Bookmarklet
javascript:$("ul.nav-pills a")[1].click(); $("#route_from input.query").attr("value", "your from address"); $("#route_to input.query").attr("value", "your to address"); $("button.find-routes-btn").click();
oaustegard / scalding_alice.scala
Last active Aug 29, 2015 — forked from johnynek/scalding_alice.scala
Learn Scalding with Alice
View scalding_alice.scala
Get the last line of text in Alice in Wonderland that contains each of the top 20 frequent words in the book
NOT ACTUALLY TESTED, just logically combined. See fork source for original version that is mulch ore likely to work.
val alice = Source.fromURL("").getLines.zipWithIndex.toList
val aliceWords = TypedPipe.from(alice).flatMap { case (text, _) => text.split("\\s+").toList }
val wordCount = { word => (word, 1L) }.group.sum
val top20 = wordCount.groupAll.sortBy { case (word, count) => -count }.take(20).values
val lastLine = alicePipe.flatMap { case (text, line) => text.split("\\s+") { word => (word, line) }}.group.max
oaustegard / ConfluenceHeaderFragmentLinks.js
Last active Feb 18, 2019
Simple JS code for adding links to all headers on a Confluence page
View ConfluenceHeaderFragmentLinks.js
oaustegard / gsuite_shortcuts.js
Last active Apr 9, 2020
Bookmarklets to create new GSuite documents - unbelievably simple, but used ALLthe time
View gsuite_shortcuts.js
oaustegard / video_speed.js
Created Apr 9, 2020
Change the playback speed of video - useful for things like mandated training videos that don't allow fast forwarding
View video_speed.js
javascript:(function(s){document.querySelector('video').playbackRate = s;})(prompt('Video speed:'));
oaustegard / gciData_datalayer.js
Last active Apr 9, 2020
Opens a new window to reveal the data layer on any Gannett site
View gciData_datalayer.js
if(typeof gciData !== "undefined" && gciData && gciData[0]) {
var w, d;
w ='about:blank','','width=900,height=700,resizeable,scrollbars');
d = w.document;
d.writeln('<title>gciData[0] Data Layer: ', location.href, '</title>');
d.writeln('<style>td {vertical-align:top; font:9pt courier; border-bottom:1px solid #ddd}</style><table>');
//sort the keys and only write out the non-objects
Object.entries(gciData[0]).sort((a, b) => a[0].localeCompare(b[0])).forEach(([key, value]) => {
if (typeof value !== "object")
d.writeln('<tr><td>', key, '</td><td>', value, '</td></tr>')
oaustegard / Link_to_Nearest_ID.js
Last active Apr 9, 2020
Generates a "deep" or document fragment link to the nearest element with an id above the selected text
View Link_to_Nearest_ID.js
oaustegard / edit_page.js
Created Apr 9, 2020
"Edit" the current webpage by turning on edit mode - only temporary of course
View edit_page.js
javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
oaustegard / qubole_csv.js
Created Apr 9, 2020
One-click download of Qubole query result as a CSV with headers
View qubole_csv.js
javascript:try{$(".query-result-download-csv")[0].click()}catch{alert('Must be clicked from Qubole Workbench Command')}
oaustegard / google_keywords.js
Created Apr 9, 2020
Search Google for Gannett article keywords
View google_keywords.js
//content-keywords only - OR
javascript:try{""+gciData[0]["content-keywords"].split(",").join(" OR "))}catch{alert("Must be Gannett article")}
//content keywords or title
javascript:try{""+gciData[0]["content-title"]+" OR "+gciData[0]["content-keywords"].split(",").join(" OR "))}catch{alert("Must be Gannett article")}