Skip to content

Instantly share code, notes, and snippets.

@arrblair
arrblair / every_other_week_scheduler.sh
Last active November 14, 2016 20:34
Jenkins executable shell hack for scheduling jobs on either odd or even weeks. Instructions in 1st comment below script.
n_week=$((($(date +%-d)-1)/7+1))
remainder=$(( $n_week % 2 ))
#Uncomment line below and comment the 2 above to guarantee it runs this current week
#remainder=0
if [ $remainder -eq 0 ]
then
DO SOME SHELL STUFF
else
@arrblair
arrblair / yt-screenMax.js
Last active February 18, 2016 04:38
Add this bookmark and indullge your cintzes.
/* Chromeo browser instructions for fancy footwork.
- Open the bookmark manager from the Bookmarks menu.
- Select the 'Add Page' option from the 'Organize' dropdown menu.
- In the 1st input box, name your new life-altering bookmark. Think big.
- In the 2nd input box, paste in the line below.
- Be sure to include "javascript:" there at the beginning. Chrome needs this to know what's up.
- Tab out of the 2nd input box to save.
- Now, the fun is within reach.
- Next time you're watching your videos, activate the bookmark & get the real theater experience */
javascript:(function() {var scpt = document.getElementById('yt-masthead-container').style.display = "None"; document.getElementById('body-container').style.marginTop = '-60px';})();
@arrblair
arrblair / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@arrblair
arrblair / awk_if.sh
Created March 21, 2015 11:41
awk count same string instances & act on counter-based conditional to set var value, then test bash string equality comparison
meow=`git log | awk '/commit/ {++count; if (count == 3) print $2}'`
meowjr=7ba3c555d407a7442d12d431807f2317f5df85f2
if [ $meow=$meowjr ]; then
echo "MEOEOEOEOEOEOOEOE";
fi
@arrblair
arrblair / gg.sh
Created February 16, 2015 04:01
Improved git grep function for adding to .bash_profile
gg () {
git grep --color -n "$1" | tee
}
@arrblair
arrblair / crawl_deadbase.py
Last active August 29, 2015 14:09
crawl deadbase to map dates to the index number in their backend for enhancing gdradio command line tool
import re
import requests
import time
# example complete url
# http://www.dharmarose.com/deadbase/dbquery110.php4?id=2314
counter = 0
base_request = "http://www.dharmarose.com/deadbase/dbquery110.php4?id="
#!/bin/bash
#
# Increment count up by 1 each time script is ran.
if [ ! -f counter_file.txt ]; then
echo '0' > counter_file.txt
fi
counter=$(cat counter_file.txt)
@arrblair
arrblair / png_counter.py
Created September 18, 2013 18:14
Loops through all the directories in a directory, looking in each one for .png files and counting them if they are present.
import os
# import pdb; pdb.set_trace()
png_counter = 0
dir_contents = os.listdir('.')
for d in dir_contents:
# the try/except keeps it from erroring on non-directory contents
try:
@arrblair
arrblair / pymng_col_substr_srch.py
Created August 29, 2013 04:15
Using PyMongo, search for a substring contained in a collection by iterating over the targeted mongo collections that have first been converted into strings.
for i in posts.find():
string = str(i)
if "Bonkus" in string:
print i
@arrblair
arrblair / commentCountGrabbber.js
Created August 16, 2013 06:46
CS-438: fix I pulled from an old jira ticket of mine for grabbing the working comment count from the top of the commenting widget and replacing the non-functioning value of a comment count built into their WordPress theme that was at top of their blog post.
var commentCountGrabber = function () {
var commentCountDiv = document.getElementsByClassName('fyre-comment-count')[0];
var textContent = commentCountDiv.textContent;
jQuery('.meta_comments > a').html(textContent);
};
setInterval(commentCountGrabber, 40000);