Skip to content

Instantly share code, notes, and snippets.

@karthick18
Created May 13, 2011 20:57
Show Gist options
  • Select an option

  • Save karthick18/971310 to your computer and use it in GitHub Desktop.

Select an option

Save karthick18/971310 to your computer and use it in GitHub Desktop.
Vacation response to test mailers patience
## OUT OF OFFICE REPLY
#!/usr/bin/env bash
(gcc -x c - -o vacation && ./vacation) <<EOF
#include <stdio.h>
#include <ctype.h>
static char *rot(char*);
int main()
{
char VACATION_TIME[] = "V nz ba inpngvba sebz Sev Znl 68 7566 60:55:55 uef.\n"
"Jbhyq or onpx ng jbex ba Zba Znl 77 7566 54:55:55 uef.\n"
"Vs lbh ner rkcrpgvat n erfcbafr sebz zr qhevat inpngvba, V fgebatyl oryvrir gung lbh fubhyq nyfb tb bhg ba inpngvba :)\n"
"Gunaxf sbe lbhe cngvrapr va ernqvat guvf :)\n";
printf(rot(VACATION_TIME));
return 0;
}
static char *rot(char *buf)
{
char *s = buf;
while(*s)
{
if(isalpha(*s))
{
int lim = 122;
if(isupper(*s))
lim = 90;
*s += 13;
if((unsigned char)*s > lim)
{
*s -= 26;
}
}
else if(isdigit(*s))
{
*s += 5;
if(*s > 57) *s -= 10;
}
++s;
}
return buf;
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment