Skip to content

Instantly share code, notes, and snippets.

// This script converts the active Google Doc to HTML with custom formatting for
// the Drupal footnotes module (https://www.drupal.org/project/footnotes)
function onOpen(e) {
DocumentApp.getUi().createAddonMenu().addItem('Convert', 'ConvertGoogleDocToCleanHtml').addToUi();
}
function ConvertGoogleDocToCleanHtml() {
var body = DocumentApp.getActiveDocument().getBody();
// This script converts the active Google Doc to HTML with custom formatting for
// the Drupal footnotes module (https://www.drupal.org/project/footnotes)
function onOpen(e) {
DocumentApp.getUi().createAddonMenu().addItem('Convert', 'ConvertGoogleDocToCleanHtml').addToUi();
}
function ConvertGoogleDocToCleanHtml() {
var body = DocumentApp.getActiveDocument().getBody();
@sdubois
sdubois / ping-checker.sh
Created September 2, 2022 14:08
Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing.
#!/bin/bash
# Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing.
# Ex: bash ping-checker.sh 8.8.8.8
while true
do
ping -c1 $1 | grep -q '0 packets received' && echo 'down'
ping -c1 $1 | grep -q '1 packets received' && echo 'up'
sleep 120
done
@sdubois
sdubois / gist:abbc55ee1ba6c5ec0ae9b1115c3d5729
Created September 9, 2021 03:50
CBS Pick 'Em Random Clicker
$('#makePicks .pickContainer').each(function( index ) {
var len = $(this).find('.teamSelection').length;
var random = Math.floor( Math.random() * len ) + 1;
$(this).find('.teamSelection').eq(random-1).click();
});
@sdubois
sdubois / yes.java
Created June 4, 2011 01:56
Multithreaded "yes"
public class yes extends Thread{
static String yes;
public void run(){
for(;;){
if(yes == null){
System.out.println("y");
}
else{
System.out.println(yes);
}