Skip to content

Instantly share code, notes, and snippets.

View matiasinsaurralde's full-sized avatar

Matias Insaurralde matiasinsaurralde

  • Paraguay
View GitHub Profile
% mkdir /tmp/whatsapp
% cd /tmp/whatsapp
% cp /Applications/WhatsApp.app/Contents/Resources/app.asar .
% asar list app.asar > filelist.txtf
@matiasinsaurralde
matiasinsaurralde / 0.txt
Created November 18, 2016 22:41
Protocol Buffer Benchmarks on
* BM_perform_serialization: No arena allocation - Using optimize_for = SPEED
% ./bench
Run on (8 X 2200 MHz CPU s)
2016-11-18 19:14:25
Benchmark Time CPU Iterations
---------------------------------------------------------------
BM_perform_serialization 2109 ns 2107 ns 325317
% ./bench
Run on (8 X 2200 MHz CPU s)
require '../../bindings/ruby/dispatcher'
require '../../bindings/ruby/coprocess_session_state_pb'
require 'json'
class SampleServer < Coprocess::Dispatcher::Service
# Implements a dynamic dispatcher for CP objects, this class should provide methods for your hooks (see MyPreMiddleware).
def dispatch(coprocess_object, _unused_call)
@matiasinsaurralde
matiasinsaurralde / instructions.md
Last active May 18, 2018 11:00
Tyk - Existing tokens

These instructions assume you have an API with the settings specified in quickstart.json (see below).

To add this token, save the JSON contents as token.json, then:

curl http://127.0.0.1:8080/tyk/keys/abc -H 'x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7' -H 'Content-Type: application/json'  -d @token.json

Where abc, in the URL, is your existing key.

% grep -r "SessionManager.UpdateSession" *.go
api.go: err := thisAPISpec.SessionManager.UpdateSession(keyName, newSession, thisAPISpec.SessionLifetime)
api.go: err := spec.SessionManager.UpdateSession(keyName, newSession, spec.SessionLifetime)
api.go: err := thisSessionManager.UpdateSession(keyName, newSession, 0)
api.go: err := thisAPISpec.SessionManager.UpdateSession(newKey, newSession, thisAPISpec.SessionLifetime)
api.go: err := thisSessionManager.UpdateSession(newKey, newSession, thisAPISpec.SessionLifetime)
api.go: err := spec.SessionManager.UpdateSession(newKey, newSession, spec.SessionLifetime)
coprocess_id_extractor.go: e.Spec.SessionManager.UpdateSession(SessionID, thisSessionState, e.Spec.APIDefinition.SessionLifetime)
coprocess_id_extractor.go: // e.Spec.SessionManager.UpdateSession(SessionID, thisSessionState, e.Spec.APIDefinition.SessionLifetime)
coprocess_test.go: spec.SessionManager.UpdateSession("abc", thisSession, 60)
package main
import (
"github.com/robertkrimen/otto"
"io/ioutil"
)
func main() {
vm := otto.New()
@matiasinsaurralde
matiasinsaurralde / session_state.proto
Created August 24, 2016 18:47
session_state.proto
syntax = "proto3";
package coprocess;
message AccessSpec {
string url = 1;
repeated string methods = 2;
}
message AccessDefinition {
@matiasinsaurralde
matiasinsaurralde / Makefile
Created August 24, 2016 11:39 — forked from huxuan/Makefile
Hello World for LuaJIT FFI/C++ binding.
all: lib run
lib:
g++ -shared -fPIC -o libhello.so libhello.cpp hello.cpp
run:
luajit main.lua
clean:
rm *.so
@matiasinsaurralde
matiasinsaurralde / bindings-cheat-sheet.md
Created August 23, 2016 15:02 — forked from eendeego/bindings-cheat-sheet.md
Node/V8 bindings cheat sheet
@matiasinsaurralde
matiasinsaurralde / response_header_modifier.js
Created August 23, 2016 02:48 — forked from mrajagopal/response_header_modifier.js
LineRate's Node.js script to modify the HTTP response header
"use strict";
var vsm = require('lrs/virtualServerModule');
var requestHandler = function(servReq, servResp, next){
servReq.on('response', function responseHandler(cliResp){
cliResp.bindHeaders(servResp);
servResp.removeHeader("Server");
servResp.removeHeader("X-Powered-By");