Skip to content

Instantly share code, notes, and snippets.

View AdonousTech's full-sized avatar

Matt Pitts AdonousTech

  • Adonous Tech LLC
View GitHub Profile
@AdonousTech
AdonousTech / docker-compose.yml
Last active December 22, 2021 21:09
Docker compose file for demonstrating deployment of DeSo Node to AWS
version: "3.7"
services:
backend:
container_name: backend
image: docker.io/desoprotocol/backend:stable
command: run
volumes:
- db:/db
ports:
- 17001:17001
@AdonousTech
AdonousTech / signTxn.js
Created November 18, 2021 23:20 — forked from chafreaky/signTxn.js
DESO - Sign a transaction in nodejs given a seedHex and a txnHex
// Do `npm i elliptic sha256` before hand
const EC = require('elliptic').ec;
const sha256 = require('sha256');
function seedHexToPrivateKey(seedHex) {
const ec = new EC('secp256k1');
return ec.keyFromPrivate(seedHex);
}
@AdonousTech
AdonousTech / fetch-single-post.ts
Created December 24, 2021 02:33
Using @desoscript to construct a request for a single post from a DeSo Node
/**
See @adonoustech/desoscript-core
*/
// construct interface request
const req: IDesoLayerSinglePostRequest = {
userSub: null, // optional internal Id for user
instruction: CanonicalCLIInstructions.SINGLE_POST, //enum
payload: { // IGetSinglePostRequestPayload
AddGlobalFeedBool: false,
CommentLimit: 0,
@AdonousTech
AdonousTech / docker-compose-deso-backend-only.yml
Created April 15, 2022 21:03
docker-compose-deso-backend-only
version: "3.7"
services:
backend:
container_name: backend
image: docker.io/desoprotocol/backend:stable
command: run
volumes:
- db:/db
ports:
- 17001:17001
@AdonousTech
AdonousTech / lightsail-compose-deso-backend-only.sh
Created April 15, 2022 21:08
lightsail-compose-deso-backend-only
#!/bin/bash
# install latest version of docker the lazy way
curl -sSL https://get.docker.com | sh
# make it so you don't need to sudo to run docker commands
usermod -aG docker ubuntu
# install docker-compose
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
@AdonousTech
AdonousTech / gist:31a2c38c89f7c9fcaefe230d9d37cb7b
Created April 23, 2022 04:02 — forked from jgornick/gist:3786127
JavaScript: Parse multiple JSON documents from string
/**
* Parses a string containing one or multiple JSON encoded objects in the string.
* The result is always an array of objects.
*
* @param {String} data
* @return {Array}
*/
function parseJson(data) {
data = data.replace('\n', '', 'g');