Skip to content

Instantly share code, notes, and snippets.

@fiskr
fiskr / expanded_download-HowWeRoll.sh
Created December 2, 2017 18:09
Download How We Roll episodes from RSS feed with better titles.
#!/bin/bash
# Related one-line script: https://gist.github.com/fiskr/b0c01bbcbd2aefaa726d46bea30a3307
dataFile="urls.dat"
rssUrl="https://rss.simplecast.com/podcasts/3236/rss" # How We Roll podcast
# Download the RSS feed for episodes of the How We Roll Podcast
# then, retrieve from the HTML just the episode titles and URLs
# then, exclude subtitles, since we don't need those
# then, parse the URL from the attribute of the node
# then, delete all node tags, e.g. <title>
@fiskr
fiskr / download-HowWeRoll.sh
Created December 2, 2017 18:06
In one line, download all How We Roll podcast episodes from their RSS feed.
#!/bin/bash
curl https://rss.simplecast.com/podcasts/3236/rss | grep mp3 | perl -pe 's/.*?url="([^"]+)".*/$1/g' | xargs wget --content-disposition
@fiskr
fiskr / download-radiolab.sh
Created February 1, 2017 21:50
Download all Radiolab episodes
#!/bin/bash
# OSX, GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
for URL in $(curl -sL http://www.radiolab.org/archive/ | grep -i read-more | perl -pe 's/^.*?"(http.*?)".*$/$1/g' | sort -u); do curl -sL $URL | grep -i download | head -n 1 | perl -pe 's/^.*?download="(http.*?)".*$/$1/g' | xargs wget; done
@fiskr
fiskr / coursera-week-sums.js
Created September 23, 2015 17:06
Take the coursera lectures' running times and sum them up for each week.
[].forEach.call(
$('.course-item-list-header'),
function(el){
var secSum = 0,
minSum = 0,
hourSum = 0
originalTitle = '';
originalTitle = $(el).find('h3').text();
//console.log( $(el).find('h3').text() );
[].forEach.call( $(el).next().find('.lecture-link'),
@fiskr
fiskr / lightbulb-comparison.py
Last active August 27, 2015 11:08
Script to compare lightbulb costs
# Author: Brandon Foster
# Date: 20150826
# Purpose:
# - automate the comparisons between lightbulbs
# INC stands for Incandescent
# LED stands for Light-emitting diode
# CFL stands for Compact Fluorescents
@fiskr
fiskr / install_usb-to-ethernet_driver.sh
Last active August 29, 2015 14:27 — forked from anonymous/install_usb-to-ethernet_driver.sh
Install USB 3.0 Cable Matters driver for OSX
#!/bin/bash
# this is for the Ethernet to USB 3.0 adapter
# made by Cable Matters
cd ~/
mkdir -p cable-matters-temp
cd cable-matters-temp
@fiskr
fiskr / cq_package.sh
Created April 24, 2015 17:28
This combines the create_package and install_package scripts into one file that shares the redundant functions like specifyEnvironment
#!/bin/bash
# Create a package with a given set of root paths
groupName="Brandon"
function requestPass() {
username="162084"
#get password from user
@fiskr
fiskr / modify-runmodes.sh
Created April 8, 2015 16:01
This script automates updates to CustomOsgiPropertyMappingService.xml when there are many environments to update.
#!/bin/bash
echo "Running runmode updates - $(date)"
# Custom OSGI Property Mapping Service files look something like
#<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
# jcr:primaryType="sling:OsgiConfig"
# mapping.map="[diy-key|value1,
# hgtv-key|value2]"
@fiskr
fiskr / toggle_wcmmode-disabled.js
Last active August 29, 2015 14:17
clean up the preview of CQ page on author and toggle wcmmode=disabled
// get current string location
var loc = document.URL;
// strip cf#/ from it to get rid of that annoying left rail image bar
loc = loc.replace('cf#/', '');
// if wcmmode=disabled is already set
if( loc.match(/[?|&]wcmmode=disabled/)){
// new location is the URL without wcmmode=disabled
loc = loc.replace(/[?|&]wcmmode=disabled/, '');
} else {
// otherwise, add wcmmode=disabled
@fiskr
fiskr / install_package.sh
Created March 23, 2015 13:35
Deletes, uploads, and then installs a package. You have to specify the name, it does the rest with CURL.
#!/bin/bash
# Install zip package through curl
groupName="Brandon"
packageName="20150319_show.zip"
package="./packages/$packageName"
username="162084"