Skip to content

Instantly share code, notes, and snippets.

@IvanRibakov
IvanRibakov / grammar.js
Created October 8, 2020 09:42
Tree-sitter grammar
/**
* Precedence values and branching rules based on Tree-sitter JavaScript grammar:
* https://github.com/tree-sitter/tree-sitter-javascript/blob/master/grammar.js
*/
const PREC = {
COMMENT: 1, // Prefer comments over regexes
STRING: 2, // In a string, prefer string characters over comments
COMMA: -1,
@IvanRibakov
IvanRibakov / indialog_request.c
Created May 7, 2019 14:04
Kamailio in-dialog request from C code
static int requestWithinDialog(char *callId, char *cseqNum, char *fromTag, char *toTag,
char *method, char *ruri, char *from, char *to, char *headers,
txCallback *callbackHandler, void *callbackParam) {
LM_DBG("Call > requestWithinDialog\n");
LM_DBG("Creating new %s request: fromTag: %s, toTag: %s, cseqNum: %s, callID: %s\n",
method, fromTag, toTag, cseqNum, callId);
uac_req_t uac_r;
str methodStr = {method, strlen(method)};
str headersStr = STR_NULL;
@IvanRibakov
IvanRibakov / template.json
Created March 8, 2018 20:49
Packer template to illustrate issue with Docker and environment variables
{
"builders": [{
"type": "docker",
"image": "centos:6",
"commit": true
}],
"provisioners": [
{
"type": "shell",
"inline": [