Skip to content

Instantly share code, notes, and snippets.

View matiasinsaurralde's full-sized avatar

Matias Insaurralde matiasinsaurralde

  • Paraguay
View GitHub Profile
NODE_EXTERN int Start(int argc, char *argv[]);
NODE_EXTERN void Init(int* argc,
const char** argv,
int* exec_argc,
const char*** exec_argv);
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
using namespace v8;
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
@matiasinsaurralde
matiasinsaurralde / hello.c
Created August 13, 2016 09:21
openmp-hello
#include <omp.h>
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
}
@matiasinsaurralde
matiasinsaurralde / codegen.go
Last active August 13, 2016 00:52
nim2go ideas
// Correr con: go run codegen.go
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
@matiasinsaurralde
matiasinsaurralde / definition.go
Created August 11, 2016 05:47
go-dotnet code generation
package mypackage
//create_delegate: HelloWorld.Hello(string) string
func SayHello(string) (string) {
}
//create_delegate: HelloWorld.Goodbye(string) string
func SayGoodbye(string, int) (string, int) {
}
from tyk.decorators import *
from gateway import TykGateway as tyk
@CustomKeyCheck
def MyKeyCheck(request, session, metadata, spec):
print("test_auth_middleware: MyKeyCheck")
print("test_auth_middleware - Request:", request)
print("test_auth_middleware - Session:", session)
print("test_auth_middleware - Spec:", spec)
package main
/*
Compilar con:
GOOS=darwin GOARCH=amd64 go build hello.go
*/
import "fmt"
func main() {
// #cgo pkg-config: python3
#include <Python.h>
#include <stdio.h>
#include <stdlib.h>
#include "binding.h"
#include "../dispatcher.h"
static int Python_Init() {
Py_Initialize();
return Py_IsInitialized();
}
package main
import "fmt"
type Car struct {
Model string
Year int
}
func( c *Car ) Drive() {
@matiasinsaurralde
matiasinsaurralde / gateway.py
Created July 29, 2016 10:03
CFFI to Cython
from cffi import FFI
ffi = FFI()
ffi.cdef("""
void TykStoreData(char* key, char* value, int ttl);
void TykTriggerEvent(char* event_name, char* payload);
void CoProcess_Log(char *msg, char *level);
""")
lib = ffi.dlopen(None)
# TODO: Try to load the API header file (avoid code repetition, like in ffi.cdef)