August 2011
Monthly Archive
Wed 31 Aug 2011
wget http://aws-catalog-download-files.s3.amazonaws.com/AmazonSES-2011-07-21.zip
unzip AmazonSES-2011-07-21.zip
vi aws-credentials
export AWS_CREDENTIALS_FILE=aws-credentials
./ses-verify-email-address.pl -k aws-credentials -v test@example.com
./ses-verify-email-address.pl -k aws-credentials -l
./ses-get-stats.pl -q
echo "test email">msgbody
ses-send-email.pl -k aws-credentials -s "Testing amazon SES" -f verified@example.com destination@example.com < msgbody
here you need to request production access so you can send to non-verified emails.
you can also setup sendmail to send through amazon, but if you’re using php’s mail function, be sure to set the return path to a verified email via the secret fifth parameter:
cat testphpmail.php
<?php
$to = 'destination@example.com';
$subject = 'test php mail';
$message = 'hello';
$headers = 'From: verified@example.com' . "\r\n" .
'Reply-To: verified@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
print(mail($to, $subject, $message, $headers,"-fverified@example.com" ));
?>
of course, it’s trivial to send mail directly from php:
first, include their one file (ses.php) and then:
$m = new SimpleEmailServiceMessage();
$m->addTo($email);
$m->setFrom('verified@example.com');
$m->setSubject($subject);
$m->setMessageFromString($body);
$con->sendEmail($m);
here is that script: http://sourceforge.net/projects/php-aws-ses/
Wed 31 Aug 2011
[root@server wordgame]# php create.php
Scrabble words for ROCOCO: Array
(
[3] => Array
(
[COO] => COO
[COR] => COR
[ORC] => ORC
[ROC] => ROC
)
[4] => Array
(
[COCO] => COCO
[CROC] => CROC
)
[6] => Array
(
[COOCOO] => COOCOO
)
)
[root@server wordgame]# cat create.php
<?php
function GetScrabbleWords($targetWord) //targetWord is a six letter word
{
$targetArray=str_split($targetWord);
$wordFileArray=array(3=>'threeletters.txt',4=>'fourletters.txt',5=>'fiveletters.txt',6=>'sixletters.txt');
foreach($wordFileArray as $fileWordLength=>$wordFile)
{
$wordFile=file($wordFile);
sort($wordFile);
foreach($wordFile as $word)
{
$word=trim($word);
$wordArray=str_split($word);
$diffArray=array_diff($wordArray,$targetArray);
if (count($diffArray)==0) $scrabbleArray[$fileWordLength][$word]=$word;
}
}
unset($scrabbleArray[6][$targetWord]);
return $scrabbleArray;
}
$targetWord="ROCOCO";
echo("Scrabble words for $targetWord: ");
print_r(GetScrabbleWords($targetWord));
echo("\n");
I don’t mean to brag, but my script above, beat this one: http://www.anagrammer.com/scrabble/
here are my word list files:
http://www.ryanbyrd.net/wordgame/threeletters.txt
http://www.ryanbyrd.net/wordgame/fourletters.txt
http://www.ryanbyrd.net/wordgame/fiveletters.txt
http://www.ryanbyrd.net/wordgame/sixletters.txt
Fri 26 Aug 2011
No doubt you’re running apache somewhere.
This looks like a significant issue:
https://issues.apache.org/bugzilla/show_bug.cgi?id=51714
I recommend immediately adding these mitigation lines to all apache instances’ httpd.conf files:
# Removes the "Range" and "If-Range" from the request headers
RequestHeader unset Range
RequestHeader unset If-Range
# Removes all "Accept-Ranges" from the response headers
Header unset Accept-Ranges
# Sets "Accept-Ranges: none" to the response headers
Header set Accept-Ranges none
and then restarting apache
see also: http://www.fastcompany.com/1776321/the-biggest-little-threat-to-kill-the-internet-you-didnt-know-about
Fri 26 Aug 2011
am I the only one who hates linux man pages? they suck.
you want to use screen? here’s the info you actually need:
step 1: create a file ~/.screenrc and put this in it:
defshell /bin/bash
hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]'
backtick 1 5 5 true
termcapinfo rxvt* 'hs:ts=\E]2;:fs=\007:ds=\E]2;\007'
caption string "%{= kw}%Y-%m-%d;%c %{= kw}%-Lw%{= kG}%{+b}[%n %t]%{-b}%{= kw}%+Lw%1`"
caption always
shell /bin/bash
bind s
step 2: start screen by typing “screen” (no quotes)
step 3: to create a new window, hold down ctrl and press a. then press c
step 4: to switch between windows, hold down ctrl and press a, then press n
step 5: to split a windows, hold down ctrl and press a, then press S (that’s capital)
step 6: to switch to that split, ctrl-a, Tab
step 7: to assign content to that split, ctrl-a ‘ (that is a single quote, BTW), then select which window to display in that pane.
see also: http://www.catonmat.net/download/screen.cheat.sheet.txt