Skip to content

Instantly share code, notes, and snippets.

@fiskr
fiskr / full-rebuild.sh
Created November 10, 2014 15:33
Performs full rebuild of SNI-Foundation and HGTV projects, tells you how much time you've wasted (total included), and only builds what needs to be.
function pause(){
rc=$?
if [[ $rc != 0 ]]
then
calcTimeLoss
read -p "Press [Enter] to continue, there are build errors above."
else
echo $(date +%m" "%_d" "%T" "%Y) > "$LASTBUILD"
fi
}
@fiskr
fiskr / aem_query_bookmarklet.js
Created March 9, 2015 19:54
This is a bookmarklet that pop ups a simple text area to let you copy the query paths you get from CRXDE querying.
// Author: Brandon Foster
// Purpose: when you query in AEM, you can't copy and paste the paths,
// so this takes the paths from the DOM and puts them in a text area so you can copy/paste them
// Date: 20150305
function createTextarea(){
var output = document.createElement('textarea');
document.body.appendChild(output);
output.style.zIndex = 9999;
output.style.width = '550px';
@fiskr
fiskr / create_package.sh
Created March 23, 2015 13:29
Shell script to create, add filters to, build, and download a package all at once!
#!/bin/bash
# Create a package with a given set of root paths
#CONFIG
# you will need to change your username and group name
groupName="Brandon"
username="162084"
@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"
@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 / 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 / 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 / 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 / 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 / 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'),