Skip to content

Instantly share code, notes, and snippets.

View altexy's full-sized avatar

Alexander Altshuler altexy

View GitHub Profile
#include <lua.h>
#include <lauxlib.h>
#define __USE_GNU
#include <dlfcn.h>
LUALIB_API int luaopen_my_module_core (lua_State *L)
{
/* TODO - Windows version, DllMain, then GetModuleFileName */
Dl_info dl_info;
dladdr((void *)luaopen_my_module_core, &dl_info);
static ngx_int_t my_http_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
ngx_int_t rc;
ngx_uint_t last;
ngx_chain_t *cl;
ngx_http_request_t *sr;
ngx_str_t uri = SOME_INTERNAL_URI;
if (in == NULL || r->header_only ) {
return ngx_http_next_body_filter(r, in);
{"type":"Feature","properties":{"name":"PJM"},"geometry":{"type":"Polygon","coordinates":
[[
[-80.518598,41.978802],
[-80.332382,42.033571],
[-79.76278,42.269079],
[-79.76278,42.252649],
[-79.76278,42.252649],
[-79.76278,42.000709],
[-75.35932,42.000709],
UInt32 Resource::GetDiskInfoEx(PVoid buffer, UInt32 bufferSize, LPDWORD bytesReturned)
{
if (nullptr == buffer)
{
LogEvent(LOG_ERROR, L"Resource::GetDiskInfoEx: null buffer error: 0x%x", ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
struct StorageValueList
{
FROM openresty/openresty:alpine
COPY nginx.conf /usr/local/openresty/nginx/conf
COPY test.lua /usr/local/openresty/nginx/test.lua
COPY required.lua /usr/local/openresty/lualib/required.lua
local function read_file(path)
local file = io_open(path, "rb") -- r read mode and b binary mode
if not file then return nil, "Cannot open file: " .. path end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
require('dotenv').config()
var jwt = require('jsonwebtoken');
var logger = require('morgan');
let atob = require('atob');
let btoa = require('btoa');
let fs = require('fs-extra');
let mcache = require('memory-cache');
const client = require('node-rest-client').Client
let consolidation = {}
consolidation.token = ""
@altexy
altexy / gist:f94a809668aca284c6777e776ded412b
Last active November 2, 2018 11:16
proxy with upstream connections keepalive
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /certs/error.log debug;
events {
worker_connections 15000;
multi_accept on;
use epoll;
}