Skip to content

Instantly share code, notes, and snippets.

@0xc010d
Created March 20, 2013 00:44
Show Gist options
  • Save 0xc010d/5201458 to your computer and use it in GitHub Desktop.
Save 0xc010d/5201458 to your computer and use it in GitHub Desktop.
Self-executable .m file
/*/../bin/ls > /dev/null
COMPILED=${0%.*}
clang $0 -o $COMPILED -framework Foundation;
$COMPILED; rm $COMPILED; exit;
*/
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
@autoreleasepool
{
NSLog(@"Hello %@",NSProcessInfo.processInfo.environment[@"USER"]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment