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
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 August 29, 2015 14:27 — forked from johnynek/scalding_alice.scala
Learn Scalding with Alice
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 February 18, 2019 22:14
Simple JS code for adding links to all headers on a Confluence page
oaustegard / gsuite_shortcuts.js
Last active April 9, 2020 02:19
Bookmarklets to create new GSuite documents - unbelievably simple, but used ALLthe time
oaustegard / video_speed.js
Created April 9, 2020 02:26
Change the playback speed of video - useful for things like mandated training videos that don't allow fast forwarding
javascript:(function(s){document.querySelector('video').playbackRate = s;})(prompt('Video speed:'));
oaustegard / gciData_datalayer.js
Last active April 9, 2020 04:22
Opens a new window to reveal the data layer on any Gannett site
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 April 9, 2020 04:52
Generates a "deep" or document fragment link to the nearest element with an id above the selected text
oaustegard / edit_page.js
Created April 9, 2020 04:56
"Edit" the current webpage by turning on edit mode - only temporary of course
javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
oaustegard / qubole_csv.js
Created April 9, 2020 05:11
One-click download of Qubole query result as a CSV with headers
javascript:try{$(".query-result-download-csv")[0].click()}catch{alert('Must be clicked from Qubole Workbench Command')}
oaustegard / google_keywords.js
Created April 9, 2020 05:30
Search Google for Gannett article keywords
//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")}