Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -1,24 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc,char** argv) {
int arg1 = atoi(argv[1]), arg2 = atoi(argv[2]), sum, diff, product, quotient, remainder ;
__asm__ ( "addl %%ebx, %%eax;" : "=a" (sum) : "a" (arg1) , "b" (arg2) );
__asm__ ( "subl %%ebx, %%eax;" : "=a" (diff) : "a" (arg1) , "b" (arg2) );
__asm__ ( "imull %%ebx, %%eax;" : "=a" (product) : "a" (arg1) , "b" (arg2) );
__asm__ ( "movl $0x0, %%edx;"
"movl %2, %%eax;"
"movl %3, %%ebx;"
"idivl %%ebx;" : "=a" (quotient), "=d" (remainder) : "g" (arg1), "g" (arg2) );
printf( "%d + %d = %d\n", arg1, arg2, sum );
printf( "%d - %d = %d\n", arg1, arg2, diff );
printf( "%d * %d = %d\n", arg1, arg2, product );
printf( "%d / %d = %d\n", arg1, arg2, quotient );
printf( "%d %% %d = %d\n", arg1, arg2, remainder );
return 0 ;
}

View file

@ -1,16 +0,0 @@
#include <python2.7/Python.h>
int main()
{
Py_Initialize();
PyRun_SimpleString("a = [3*x for x in range(1,11)]");
PyRun_SimpleString("print 'First 10 multiples of 3 : ' + str(a)");
PyRun_SimpleString("print 'Last 5 multiples of 3 : ' + str(a[5:])");
PyRun_SimpleString("print 'First 10 multiples of 3 in reverse order : ' + str(a[::-1])");
Py_Finalize();
return 0;
}

View file

@ -0,0 +1,35 @@
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdio.h>
#include <stdlib.h>
const char * const lua_code = "print('tau = ' .. 8*math.atan(1))";
int
main(void)
{
lua_State* L;
/* initialize lua */
L = luaL_newstate();
luaL_openlibs(L); /* allows use of lua's standard libraries e.g. math */
/* load and run the code */
if (luaL_loadstring(L, lua_code) != LUA_OK) {
fprintf(stderr, "Error loading lua code\n");
return EXIT_FAILURE;
}
if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
fprintf(stderr, "Error running lua code\n");
return EXIT_FAILURE;
}
/* tidy up */
lua_pop(L, lua_gettop(L));
lua_close(L);
return 0;
}