This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2010 Noah Sloan <http://noahsloan.com> | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract_string_literals( string ) | |
string_literal_pattern = /"([^"\\]|\\.)*"/ | |
string_replacement_token = "___+++STRING_LITERAL+++___" | |
# Find and extract all the string literals | |
string_literals = [] | |
string.gsub(string_literal_pattern) {|x| string_literals << x} | |
# Replace all the string literals with our special placeholder token | |
string = string.gsub(string_literal_pattern, string_replacement_token) | |
# Return the modified string and the array of string literals | |
return [string, string_literals] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
URLS="http://presale.events.ccc.de/ https://presale.events.ccc.de/" | |
MAILTO="foo@example.com bar@example.org" | |
TIMEOUT=10 | |
for URL in $URLS; do | |
DONEFILE=${PWD}/.urlcheckdone.$(echo ${URL} | sed -e 's/[^-[:alnum:]_]/_/g') | |
[ -f ${DONEFILE} ] && continue |