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
#include <SDL2/SDL.h> | |
#include <math.h> | |
#define FREQ 44100 | |
struct note_to_play | |
{ | |
Uint8 *data; | |
Uint32 len; | |
Uint32 offset; |
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
#include <stdio.h> | |
struct vector3 { | |
float x; | |
float y; | |
float z; | |
}; | |
struct vector3 vector3_add(struct vector3 v0, struct vector3 v1) { | |
struct vector3 new_vec; |
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
using System; | |
using System.Collections.Generic; | |
namespace HuffmanTest | |
{ | |
class Node | |
{ | |
public Node Left; | |
public Node Right; |
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
browser = webdriver.Firefox() | |
browser.get('http://google.com') | |
print(browser.page_source) | |
input_search = browser.find_element_by_id('lst-ib') | |
input_search.send_keys('do a barrel roll', Keys.ENTER) | |
#input_submit = browser.find_element_by_name('btnG') | |
#input_submit.click() |
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
#include <uwsgi.h> | |
/* | |
extract REMOTE_USER from Authorization header | |
[uwsgi] | |
plugin = router_remoteuser | |
route-run = remoteuser: | |
route-run = log:${REMOTE_USER} |
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
RPython traceback: | |
File "rpython_jit_metainterp_compile.c", line 20935, in send_loop_to_backend | |
File "rpython_jit_backend_x86_assembler.c", line 1854, in Assembler386_assemble_loop | |
File "rpython_jit_backend_x86_assembler.c", line 4804, in Assembler386__assemble | |
File "rpython_jit_backend_x86_regalloc.c", line 1730, in RegAlloc_walk_operations | |
File "rpython_jit_backend_x86_assembler.c", line 29896, in Assembler386_threadlocalref_get |
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
#include <uwsgi.h> | |
static int spinningfifo_hook(char *arg) { | |
int fd; | |
char *space = strchr(arg, ' '); | |
if (!space) { | |
uwsgi_log("invalid hook spinningfifo syntax, must be: <file> <string>\n"); | |
return -1; | |
} | |
*space = 0; |
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
#include <uwsgi.h> | |
static void vassal_chroot_hook(struct uwsgi_instance *ui) { | |
// first of all get my username | |
struct passwd *pw = getpwuid(ui->uid); | |
if (!pw) { | |
uwsgi_log("unable to get username\n"); | |
exit(1); | |
} |
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
#include <uwsgi.h> | |
static char *log_encoder_add_worker(struct uwsgi_log_encoder *ule, char *msg, size_t len, size_t *rlen) { | |
char *buf = NULL; | |
// 64 bytes for worker id should be enough, btw the buffer will be adapted automatically | |
struct uwsgi_buffer *ub = uwsgi_buffer_new(len + 64); | |
// add current pid | |
if (uwsgi_buffer_num64(ub, getpid())) goto end; | |
// add a space | |
if (uwsgi_buffer_byte(ub, ' ')) goto end; |
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
call rpython_startup_code(); for initializing | |
call pypy_setup_home(char *home, int debug); for setting the python home (returns non-zero on error, you can call it multiple times until it succeed) | |
call pypy_execute_source(char *code); execute the python code (IMPORTANT: GIL is still not set here) | |
call pypy_init_threads(); initialize GIL | |
finally call pypy_thread_attach(); in each additional pthread you need to register to python (this function is not thread safe, you should call it under a mutex) |
NewerOlder