This file contains hidden or 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
HTTP call from the web hosting server: | |
% ssh jllexchange.com "wget http://jllexchange.com/robots.txt" | |
--2011-04-22 13:11:18-- http://jllexchange.com/robots.txt | |
Resolving jllexchange.com... 184.168.136.128 | |
Connecting to jllexchange.com|184.168.136.128|:80... connected. | |
HTTP request sent, awaiting response... 403 Forbidden | |
2011-04-22 13:11:18 ERROR 403: Forbidden. | |
This file contains hidden or 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 | |
proxyhost=localhost | |
read method file http | |
if [ "$method" != "GET" ]; then | |
printf "HTTP/1.0 405 Method Not Allowed\r\n" | |
printf "Content-type: text/plain\r\n" | |
printf "Connection: close\r\n\r\nMethod Not Allowed\r\n" |
This file contains hidden or 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
# Did the user hit a page that should be https that should be http? | |
# Yes: redirect to https: | |
RewriteCond %{HTTPS} off | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(wp-admin|wp-login|wp-register|products-page)/.*$ https://wordpress.example.com/$1 [R=301,L] | |
# Did the user hit a page that should not be https, under https? | |
# Yes: redirect to http: | |
RewriteCond %{HTTPS} on |
This file contains hidden or 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
/* one way: */ | |
for (var i=0,L; L=document.links[i]; ++i) { | |
if (L.title.match(/\b(Join\s+Our\s+Mailing\s+List|Shop\s+Online)\b/i)) { | |
L.setAttribute('target', '_blank'); | |
} | |
} | |
/* another way, maybe a bit more readable: */ |
This file contains hidden or 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
#!/usr/bin/env php | |
<?php | |
function counter ($n) { | |
error_log("starting counter at $n"); | |
return function () use (&$n) { | |
return ++$n; | |
}; | |
} |
This file contains hidden or 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
var timethis = function (f, n) { | |
var start = new Date(); | |
for (var i=n; i > 0; --i) f(); | |
var end = new Date(); | |
var delta = end.getTime() - start.getTime(); | |
print(n + ' iterations took ' + delta + 'ms'); | |
}; | |
var switchcase = function (tag) { |
This file contains hidden or 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 | |
# Tweaked from http://jeetworks.org/node/68 to remove bashisms. | |
# Drop this in your libexec/git-core/ to use it as "git targz" | |
if [ -z "$1" ] | |
then | |
echo "Usage: git-targz [rev] path" | |
echo | |
echo "Creates gzipped-compressed tarball archive of the current or specified branch." |
This file contains hidden or 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
<a href="javascript:(function(){%28function%28%29{var%20d%3ddocument%3bvar%20t%3dd.body.textContent.replace%28/%26/g%2c%27%26amp%3b%27%29.replace%28/%3c/g%2c%27%26lt%3b%27%29.replace%28/%3e/g%2c%27%26gt%3b%27%29.replace%28/\n/g%2c%27%3cbr/%3e\n%27%29%3bd.open%28%29%3bd.writeln%28%27%3ctt%3e%27%2bt%2b%27%3c/tt%3e%27%29%3bd.close%28%29%3b}%29%28%29%3b})()">text/plain word wrap</a> |
This file contains hidden or 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
sudo dd if=/dev/sda1 | gzip -c | ssh doak 'cat > /opt/backup/eee/sda1.gz' | |
sudo dd if=/dev/sda2 | gzip -c | ssh doak 'cat > /opt/backup/eee/sda2.gz' |
This file contains hidden or 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
sudo port -f -v uninstall inactive |