USAGE:
python3 node_bindings.py djinni.yml <namespace> node/node.cpp
yarn
mkdir -p build-node
cd build-node; \
cmake .. -DCMAKE_BUILD_TYPE=Release -DNODE=yes; \
cmake --build . -j
node node/test.js
| import queue | |
| from threading import Lock | |
| from collections import namedtuple | |
| class Muxer(): | |
| Entry = namedtuple('Entry', 'genref listeners, lock') | |
| already = {} | |
| top_lock = Lock() |
| from cryptography.hazmat.backends import default_backend | |
| from cryptography.hazmat.primitives.ciphers import ( Cipher, algorithms, modes ) | |
| import os | |
| nonce = os.urandom(16) | |
| key = os.urandom(32) | |
| mode = modes.GCM(nonce, None) |
| import time | |
| import logging | |
| import threading | |
| log = logging.getLogger(__name__) | |
| class MonitorInstance: | |
| def __init__(self, parent, label, func, threshold, active, metric): | |
| self.parent = parent | |
| self.label = label | |
| self.func = func |
USAGE:
python3 node_bindings.py djinni.yml <namespace> node/node.cpp
yarn
mkdir -p build-node
cd build-node; \
cmake .. -DCMAKE_BUILD_TYPE=Release -DNODE=yes; \
cmake --build . -j
node node/test.js
| #pragma once | |
| #include <codecvt> | |
| #include <condition_variable> | |
| #include <fstream> | |
| #include <iostream> | |
| #include <locale> | |
| #include <memory> | |
| #include <mutex> | |
| #include <ostream> |
| # or visit: https://earonesty.github.io/decompose_hex.html | |
| def hex_decompose(flag): | |
| b = bin(flag)[2:] | |
| for i in range(len(b)): | |
| if int(b[i]): | |
| x = len(b) - i - 1 | |
| y = '1' + ('0' * x) | |
| print(hex(int(y,2))) | |
| export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.bash.log; fi' | |
| function hh() { | |
| grep "$1" ~/.bash.log | |
| } | |
| #!/bin/env python3.6 | |
| import os, sys, json | |
| from argparse import ArgumentParser | |
| def main(): | |
| parser = ArgumentParser(description='Python template expander. \ | |
| Make a template with a format string syntax and environment vars, arguments and config file vars are expanded.') |
| import inspect, os, ctypes | |
| class dicttemp: | |
| def __init__(self, obj, changes): | |
| self.obj = obj | |
| self.save = {} | |
| for var, val in changes.items(): | |
| if var in obj: | |
| self.save[var] = obj[var] | |
| else: |
| # very simple RPC server in python | |
| import sys, json | |
| from http.server import BaseHTTPRequestHandler, HTTPServer | |
| import urllib.parse as urlparse | |
| import threading | |
| import logging | |
| log = logging.getLogger(__name__) | |
| class ApiError(Exception): |