Skip to content

Instantly share code, notes, and snippets.

View earonesty's full-sized avatar
🎹
Piano

earonesty

🎹
Piano
View GitHub Profile
@earonesty
earonesty / README.md
Last active June 22, 2021 18:39
Convert a djinni input file to a node cpp bindings file. Load the resulting lib directly in node.

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>
@earonesty
earonesty / hex_decompose.py
Last active January 29, 2019 20:25
decompose integer into hex flags
# 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
}
@earonesty
earonesty / pyt.py
Last active February 12, 2018 13:45
python template expander ... based on format strings
#!/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.')
@earonesty
earonesty / varlib.py
Last active December 18, 2017 19:26
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):
@earonesty
earonesty / xssh
Last active February 12, 2018 13:54
#!/usr/bin/env python3
from pssh.pssh_client import ParallelSSHClient
import pssh.utils
pssh.utils.enable_host_logger()
import os, sys, re, stat, tempfile, subprocess
import logging
apt-get update
apt-get upgrade
apt-get -y install git
apt-get -y install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
apt-get -y install libboost-all-dev
apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
apt-get -y install libqrencode-dev
apt-get -y install libminiupnpc-dev
apt-get -y install libevent-dev
<html>
<div id="divWidgetAreaPrice" style="width:30% !important; height:130px !important;"><script>var typeChart='price';
var w_baseCurrency = new Array(); var w_targetCurrency = new Array(); w_baseCurrency[0]="BTC"; w_targetCurrency[0]="USD"; var widgetStyle={};
widgetStyle["bgColor"]="#FFFFFF";
widgetStyle["backgroundColor"]="#FFFFFF";
widgetStyle["bgTransparent"]="solid";
widgetStyle["fontSize"]="16px";
widgetStyle["fontFamily"]="Arial";
widgetStyle["fontColor"]="#000000";
widgetStyle["borderWidth"]="1";