Created
December 27, 2010 23:17
-
-
Save jpmckinney/756688 to your computer and use it in GitHub Desktop.
unpack_and_beautify.js as char array
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
// blog post: http://blog.slashpoundbang.com/post/2488598258/running-javascript-from-the-command-line-with-v8 | |
const char unpack_code[] = { | |
0x2f,0x2f,0x20,0x62,0x6c,0x6f,0x67,0x20,0x70,0x6f,0x73,0x74,0x3a,0x20,0x68,0x74, | |
0x74,0x70,0x3a,0x2f,0x2f,0x62,0x6c,0x6f,0x67,0x2e,0x73,0x6c,0x61,0x73,0x68,0x70, | |
0x6f,0x75,0x6e,0x64,0x62,0x61,0x6e,0x67,0x2e,0x63,0x6f,0x6d,0x2f,0x70,0x6f,0x73, | |
0x74,0x2f,0x32,0x34,0x32,0x38,0x35,0x35,0x37,0x30,0x30,0x37,0x2f,0x75,0x6e,0x70, | |
0x61,0x63,0x6b,0x2d,0x61,0x6e,0x64,0x2d,0x62,0x65,0x61,0x75,0x74,0x69,0x66,0x79, | |
0x2d,0x6a,0x61,0x76,0x61,0x73,0x63,0x72,0x69,0x70,0x74,0x0a,0x0a,0x2f,0x2f,0x20, | |
0x41,0x73,0x73,0x75,0x6d,0x65,0x73,0x20,0x6a,0x73,0x5f,0x62,0x65,0x61,0x75,0x74, | |
0x69,0x66,0x79,0x20,0x69,0x73,0x20,0x61,0x76,0x61,0x69,0x6c,0x61,0x62,0x6c,0x65, | |
0x3a,0x20,0x73,0x65,0x65,0x20,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x67,0x69, | |
0x74,0x68,0x75,0x62,0x2e,0x63,0x6f,0x6d,0x2f,0x65,0x69,0x6e,0x61,0x72,0x73,0x2f, | |
0x6a,0x73,0x2d,0x62,0x65,0x61,0x75,0x74,0x69,0x66,0x79,0x2f,0x72,0x61,0x77,0x2f, | |
0x6d,0x61,0x73,0x74,0x65,0x72,0x2f,0x62,0x65,0x61,0x75,0x74,0x69,0x66,0x79,0x2e, | |
0x6a,0x73,0x0a,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x20,0x75,0x6e,0x70,0x61, | |
0x63,0x6b,0x5f,0x61,0x6e,0x64,0x5f,0x62,0x65,0x61,0x75,0x74,0x69,0x66,0x79,0x28, | |
0x76,0x61,0x6c,0x75,0x65,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70, | |
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2c,0x0a,0x20,0x20,0x20, | |
0x20,0x20,0x20,0x6f,0x70,0x65,0x6e,0x5f,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d, | |
0x20,0x22,0x65,0x76,0x61,0x6c,0x28,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x28, | |
0x22,0x2c,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x70,0x65,0x6e,0x5f,0x69,0x6e, | |
0x64,0x65,0x78,0x20,0x3d,0x20,0x2d,0x31,0x2c,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, | |
0x63,0x6c,0x6f,0x73,0x65,0x5f,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,0x22, | |
0x27,0x2e,0x73,0x70,0x6c,0x69,0x74,0x28,0x27,0x7c,0x27,0x29,0x2c,0x30,0x2c,0x7b, | |
0x7d,0x29,0x29,0x22,0x2c,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6c,0x6f,0x73, | |
0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x2d,0x31,0x2c,0x0a,0x20,0x20, | |
0x20,0x20,0x20,0x20,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x6c,0x65,0x6e,0x67,0x74,0x68, | |
0x20,0x3d,0x20,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x73,0x74,0x72,0x69,0x6e,0x67,0x2e, | |
0x6c,0x65,0x6e,0x67,0x74,0x68,0x2c,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74, | |
0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,0x27,0x27,0x2c,0x0a,0x20,0x20,0x20,0x20,0x20, | |
0x20,0x70,0x61,0x63,0x6b,0x3b,0x0a,0x0a,0x20,0x20,0x77,0x68,0x69,0x6c,0x65,0x20, | |
0x28,0x74,0x72,0x75,0x65,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x70,0x65, | |
0x6e,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x76,0x61,0x6c,0x75,0x65,0x2e, | |
0x69,0x6e,0x64,0x65,0x78,0x4f,0x66,0x28,0x6f,0x70,0x65,0x6e,0x5f,0x73,0x74,0x72, | |
0x69,0x6e,0x67,0x2c,0x20,0x6f,0x70,0x65,0x6e,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20, | |
0x2b,0x20,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6c,0x6f,0x73,0x65,0x5f, | |
0x69,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x76,0x61,0x6c,0x75,0x65,0x2e,0x69,0x6e, | |
0x64,0x65,0x78,0x4f,0x66,0x28,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x73,0x74,0x72,0x69, | |
0x6e,0x67,0x2c,0x20,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20, | |
0x2b,0x20,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x6f,0x70, | |
0x65,0x6e,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x3d,0x3d,0x20,0x2d,0x31,0x20,0x7c, | |
0x7c,0x20,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x3d,0x3d, | |
0x20,0x2d,0x31,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x72, | |
0x69,0x6e,0x67,0x20,0x2b,0x3d,0x20,0x76,0x61,0x6c,0x75,0x65,0x2e,0x73,0x75,0x62, | |
0x73,0x74,0x72,0x69,0x6e,0x67,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c, | |
0x20,0x76,0x61,0x6c,0x75,0x65,0x2e,0x6c,0x65,0x6e,0x67,0x74,0x68,0x29,0x3b,0x0a, | |
0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,0x20,0x20, | |
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x20,0x7b,0x0a,0x20,0x20, | |
0x20,0x20,0x20,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x2b,0x3d,0x20,0x76,0x61, | |
0x6c,0x75,0x65,0x2e,0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67,0x28,0x70,0x6f, | |
0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x6f,0x70,0x65,0x6e,0x5f,0x69,0x6e,0x64, | |
0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x61,0x63,0x6b,0x20, | |
0x3d,0x20,0x76,0x61,0x6c,0x75,0x65,0x2e,0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e, | |
0x67,0x28,0x6f,0x70,0x65,0x6e,0x5f,0x69,0x6e,0x64,0x65,0x78,0x2c,0x20,0x63,0x6c, | |
0x6f,0x73,0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x2b,0x20,0x63,0x6c,0x6f,0x73, | |
0x65,0x5f,0x6c,0x65,0x6e,0x67,0x74,0x68,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, | |
0x20,0x74,0x72,0x79,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65, | |
0x76,0x61,0x6c,0x28,0x22,0x76,0x61,0x72,0x20,0x74,0x6d,0x70,0x20,0x3d,0x20,0x53, | |
0x74,0x72,0x69,0x6e,0x67,0x22,0x20,0x2b,0x20,0x70,0x61,0x63,0x6b,0x2e,0x73,0x75, | |
0x62,0x73,0x74,0x72,0x69,0x6e,0x67,0x28,0x34,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20, | |
0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x2b,0x3d,0x20,0x74, | |
0x6d,0x70,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, | |
0x20,0x20,0x63,0x61,0x74,0x63,0x68,0x20,0x28,0x65,0x29,0x20,0x7b,0x0a,0x20,0x20, | |
0x20,0x20,0x20,0x20,0x20,0x20,0x77,0x69,0x6e,0x64,0x6f,0x77,0x2e,0x63,0x6f,0x6e, | |
0x73,0x6f,0x6c,0x65,0x20,0x26,0x26,0x20,0x63,0x6f,0x6e,0x73,0x6f,0x6c,0x65,0x2e, | |
0x6c,0x6f,0x67,0x20,0x26,0x26,0x20,0x63,0x6f,0x6e,0x73,0x6f,0x6c,0x65,0x2e,0x6c, | |
0x6f,0x67,0x28,0x65,0x2c,0x20,0x70,0x61,0x63,0x6b,0x29,0x3b,0x0a,0x20,0x20,0x20, | |
0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x2b,0x3d,0x20,0x70, | |
0x61,0x63,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, | |
0x20,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x63,0x6c, | |
0x6f,0x73,0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x20,0x2b,0x20,0x63,0x6c,0x6f,0x73, | |
0x65,0x5f,0x6c,0x65,0x6e,0x67,0x74,0x68,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, | |
0x20,0x20,0x7d,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6a,0x73, | |
0x5f,0x62,0x65,0x61,0x75,0x74,0x69,0x66,0x79,0x28,0x73,0x74,0x72,0x69,0x6e,0x67, | |
0x2c,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x64,0x65,0x6e,0x74,0x5f,0x73, | |
0x69,0x7a,0x65,0x3a,0x20,0x32,0x2c,0x0a,0x20,0x20,0x20,0x20,0x73,0x70,0x61,0x63, | |
0x65,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x6e,0x6f,0x6e,0x5f,0x66,0x75,0x6e, | |
0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x74,0x72,0x75,0x65,0x2c,0x0a,0x20,0x20,0x7d, | |
0x29,0x3b,0x0a,0x7d,0x00 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://web.archive.org/web/20130901015322/http://blog.slashpoundbang.com/post/2488598258/running-javascript-from-the-command-line-with-v8