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
unsigned char my_clamp(const int x) { | |
return (x < 0) ? 0 : ((x > 0xFF) ? 0xFF : (unsigned char) x); | |
} | |
int f0(unsigned int *regs){ | |
int r; | |
int ro; | |
int cv; | |
// ip: 0 | |
// 0,4,29,DUK_OP_ADD_RC | |
regs[29]=regs[4]+15; |
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
~/src/ChakraCore # time ./build.sh -t --cxx=$(which clang++) --cc=$(which clang) --embed-icu -j 1 | |
Custom CXX /usr/bin/clang++ | |
Custom CC /usr/bin/clang | |
Build path: /root/src/ChakraCore/out/Test | |
-- /root/src/ChakraCore/bin/ch/DbgController.js.h is up to date. skipping. | |
Compile Target : System Default | |
Generating Test makefiles | |
-- found ICU libs: deps/icu/source/output/include//../lib/ | |
-- Configuring done |
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
/* | |
Tested against release/1.4 branch of https://github.com/Microsoft/ChakraCore | |
commit: 6f4c890505a58bbf198035d4b93bf8a726033af3 | |
The below program will work on x86_64 Linux. It demonstrates how to safely call | |
in to libChakraCore from Spidermonkey using js-ctypes. Because the ChakraCore | |
GC scans the stack for JsValueRefs we must allocate JsValueRefs on the C stack. | |
When I say C stack I mean in the memory region between the current stack | |
pointer and the initial value of the stack pointer when the program started. |
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
// get Spidermonkey from here: | |
// https://ftp.mozilla.org/pub/firefox/candidates/45.6.0esr-candidates/build1/jsshell-linux-x86_64.zip | |
// SHA512SUM and signature here: | |
// https://ftp.mozilla.org/pub/firefox/candidates/45.6.0esr-candidates/build1/linux-x86_64/en-US/firefox-45.6.0esr.checksums | |
// https://ftp.mozilla.org/pub/firefox/candidates/45.6.0esr-candidates/build1/linux-x86_64/en-US/firefox-45.6.0esr.checksums.asc | |
// | |
// set up Spidermonkey by unzipping it and adding it to your PATH and LD_LIBRARY_PATH: | |
// mkdir spidermonkey | |
// cd spidermonkey | |
// unzip ../jsshell-linux-x86_64.zip |
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
Tested on an Ubuntu 12.04 and Ubuntu 14.04 host: | |
We first need an CentOS 6 chroot. I wanted to do this without requring root on the host machine. | |
I order to do this I used a piece of software called PRoot https://github.com/proot-me/PRoot . | |
PRoot provides chroot emulation without requiring root. I does this by intercepting and modifying syscalls using ptrace. | |
You'll need libtalloc to build proot. Ubuntu has packages: | |
apt-get install libtalloc2 libtalloc-dev |
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
w='Head|shoulders|knees and| toes|and eyes| and ears| and mouth and| nose|'.split('|');c=', ';n='\n';for(i=-1;++i<9;){k=w[2]+w[3]+n;f=w[0]+c+w[1]+c+k+k;console.log(f+f+w[4]+w[5]+w[6]+w[7]+n+f);w[i]=w[i].replace(/\w+/g,'...')} |
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
x="..."; | |
y=x+" "+x; | |
z=x+" "+x+" "+x; | |
r=[[/#/g,x], | |
[/Head/g,x], | |
[/shoulders/g,x], | |
[/knees and/g,y], | |
[/toes/g,x], | |
[/and eyes/g,y], | |
[/and ears/g,y], |
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
fs=require("fs"); | |
a=fs.openSync("a.raw","r"); | |
var b=fs.openSync("c.raw","w"); | |
off=0; | |
var sizeof=function(a){return a.length}; | |
var assert=function(){}; | |
var bit_reverse=function(n){ |