Skip to content

Instantly share code, notes, and snippets.

View spacekitcat's full-sized avatar
👋

Lisa Burton spacekitcat

👋
View GitHub Profile
@spacekitcat
spacekitcat / motion-mailer-d
Created February 25, 2018 16:11
Initd script to bootstrap the watch command when the system starts up. The watch command periodically runs a bash script.
#!/bin/bash
screen -d -m sudo watch -n5 'bash /opt/bin/pop_motion_queue.sh'
@spacekitcat
spacekitcat / pop_motion_queue.sh
Created February 25, 2018 16:00
Find an email the latest output image from the motion service
#!/bin/bash
MOTION_TMP=/tmp/motion
TARGET_EMAIL=$TARGET_EMAIL_HERE
which motion
if [ ! $? -eq 0 ]
then
echo "Cannot find motion service in PATH, is it installed?"
exit 1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.5.2</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.5.2/jasmine_favicon.png">
<link rel="stylesheet" href="lib/jasmine-2.5.2/jasmine.css">
<script src="lib/jasmine-2.5.2/jasmine.js"></script>
describe("ClientsideTextReplace 'doReplace' function", function() {
beforeEach(function() {
});
var createTestDocument = function() {
return document.implementation.createHTMLDocument("test doc");
}
describe("Is able to replace the core targets", function() {
@spacekitcat
spacekitcat / doReplace.js
Last active October 13, 2018 20:15
Walks the DOM and performs text replacements. Designed for use with https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
doReplace = function(doc) {
var treeWalker = document.createTreeWalker(doc, NodeFilter.SHOW_TEXT, null, null)
do {
var tmpnode = treeWalker.currentNode;
if (tmpnode.nodeValue) {
tmpnode.nodeValue = tmpnode.nodeValue.replace(/gamergate/ig, 'misogynist');
tmpnode.nodeValue = tmpnode.nodeValue.replace(/trump/ig, 'misogynist');
tmpnode.nodeValue = tmpnode.nodeValue.replace(/donald trump/ig, 'misogynist');