Skip to content

Instantly share code, notes, and snippets.

@andrewrs
andrewrs / doi-regex.js
Created June 27, 2022 21:44
DOI Regex
var teststring = "https://doi-org.mutex.gmu.edu/10.1177/0886260517708407"
var testout = teststring.match(/\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g);
console.log(testout);
@andrewrs
andrewrs / multsort
Created June 27, 2022 21:42
Excel VBA multi sort
Sub SortAllSheets()
'Updateby Extendoffice
Dim WS As Worksheet
ActiveSheet.Range("a1:e1").Select
Selection.Copy
On Error Resume Next
Application.ScreenUpdating = False
For Each WS In Worksheets
WS.Columns("A:E").Sort Key1:=WS.Columns("A"), Order1:=xlAscending, Key2:=WS.Columns("E"), Order2:=xlDescending
Next WS
var teststring = "https://doi-org.mutex.gmu.edu/10.1177/0886260517708407"
var testout = teststring.match(/\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g);
console.log(testout);
@andrewrs
andrewrs / uptime-check.sh
Last active April 21, 2022 23:02
bash uptime check
#! /bin/sh
SITES="https://example.com"
EMAILS="you@example.com"
for SITE in $(echo $SITES | tr "," " "); do
if [ ! -z "${SITE}" ]; then
RESPONSE=$(curl -s --head $SITE)
if echo $RESPONSE | grep "200 OK" > /dev/null
then
@andrewrs
andrewrs / webserver-check
Created April 26, 2021 04:31
php webserver uptime checker
<?php
// set email server parameters
ini_set('sendmail_from', 'server.status@host.example.com' );
ini_set('SMTP', '127.0.0.1' );
ini_set('smtp_port', '25' );
ini_set('allow_url_fopen', true); //enable fopen
// define list of webservers to check
$webservers = array('www.example.com', 'www.example2.com');
8 * * * * curl -I https://example.com | grep "200 OK" || echo "The site is down" | /usr/bin/mail -v -s "The site is down" email@example.com
@andrewrs
andrewrs / imgdesc-rotate.js
Created March 11, 2019 19:56
js image/description rotation
var theImages = new Array()
theImages[0] = "/path_to/1.jpg"
theImages[1] = "/path_to/2.jpg"
theImages[2] = "/path_to/3.jpg"
theImages[3] = "/path_to/4.jpg"
var theText = new Array()
theText[0] = "Image 1 description"
@andrewrs
andrewrs / ggle-querynum.py
Created February 22, 2019 03:18
simple python/BeautifulSoup to print the number of search results google returns for a query
import urllib
from bs4 import BeautifulSoup
import requests
import webbrowser
sq = raw_input("query:")
queryString = urllib.quote_plus(sq)
@andrewrs
andrewrs / regular_expression_engine_comparison.md
Last active December 10, 2018 01:30 — forked from CMCDragonkai/regular_expression_engine_comparison.md
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@andrewrs
andrewrs / primo-sign-in.css
Created August 26, 2017 09:24 — forked from erinrwhite/primo-sign-in.css
Ex Libris Primo sign in link - custom CSS/JS - see in action at search.library.vcu.edu
.signin-link {
padding: 12px;
margin-bottom: 15px;
border-radius: 4px;
font-size: 14px;
font-weight: bold;
text-align: center;
background: #f8f4d6;
}