Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const readLastLines = require('read-last-lines');
const LineByLineReader = require('line-by-line');
const dhive = require('@hiveio/dhive');
const { IPC } = require('../libs/IPC');
const { Transaction } = require('../libs/Transaction');
const BC_PLUGIN_NAME = require('./Blockchain.constants').PLUGIN_NAME;
const BC_PLUGIN_ACTIONS = require('./Blockchain.constants').PLUGIN_ACTIONS;
const { PLUGIN_NAME, PLUGIN_ACTIONS } = require('./Replay.constants');
@harpagon210
harpagon210 / JSON.cc
Created May 12, 2020 16:23
nodejs native module JSON parser/stringifier (native implementation vs rapidjson)
#include "JSON.h"
#include <iostream>
#include <chrono>
Napi::Value JSON::DocumentToValue(Napi::Env env, rapidjson::Value document)
{
if (document.IsString())
{
return Napi::String::New(env, document.GetString());
}
@harpagon210
harpagon210 / iptables cheat sheet.md
Last active May 2, 2020 22:28
iptables cheat sheet for basics

some default rules

iptables -A INPUT -i lo -m comment --comment "allow traffic on loopback interface" -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -m comment --comment "allow connections that are already established or related" -j ACCEPT
iptables -A INPUT -p icmp -m comment --comment "allow ping" -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m comment --comment "allow ssh" -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m comment --comment "allow http" -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -m comment --comment "allow https" -j ACCEPT
iptables -P -m comment --comment "drop the rest of the incoming traffic" INPUT DROP

iptables -P -m comment --comment "drop the forwarding traffic" FORWARD DROP

@harpagon210
harpagon210 / witness_setup.md
Last active January 19, 2021 02:55
setup a witness node

1. Requirements

2. Install the Steem Smart Contracts node

To "install" the app, simply follow these steps: