This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
backend: | |
container_name: backend | |
image: docker.io/desoprotocol/backend:stable | |
command: run | |
volumes: | |
- db:/db | |
ports: | |
- 17001:17001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
backend: | |
container_name: backend | |
image: docker.io/desoprotocol/backend:stable | |
command: run | |
volumes: | |
- db:/db | |
ports: | |
- 17001:17001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/docker-compose-app.service | |
# thanks to oleg belostotsky on stack overflow for this | |
[Unit] | |
Description=Docker Compose Application Service | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
Type=oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"build": "tsc", | |
"update-lambda-code-dev": "npm run build && npm run private-remove-package && npm run private-package-lambda && npm run private-update-lambda-code-dev", | |
"update-lambda-code-prod": "npm run build && npm run private-remove-package && npm run private-package-lambda && npm run private-update-lambda-code-prod", | |
"private-update-lambda-code-dev": "aws lambda update-function-code --profile %npm_package_config_devProfile% --region %npm_package_config_region% --function-name %npm_package_config_functionNameDev% --zip-file %npm_package_config_functionFileLocationNormalized%", | |
"private-update-lambda-code-prod": "aws lambda update-function-code --profile %npm_package_config_prodProfile% --region %npm_package_config_region% --function-name %npm_package_config_functionNameProd% --zip-file %npm_package_config_functionFileLocationNormalized%", | |
"private-package-lambda": "zip -q -r %npm_package_config_functionFileName% ./lib index.js node_modules", | |
"private-remove-package": "rm %npm_p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"install-dependencies": "npm install && cd %npm_package_config_infrastructureDirName% && npm install && cd ../%npm_package_config_lambdaDirName% && npm install", | |
"first-init-dev": "npx cdk bootstrap aws://%npm_package_config_devAccountNumber%/%npm_package_config_region% --profile %npm_package_config_devProfile%", | |
"first-init-prod": "npx cdk bootstrap aws://%npm_package_config_prodAccountNumber%/%npm_package_config_region% --profile %npm_package_config_prodProfile%", | |
"check-cdk-updates": "cd %npm_package_config_infrastructureDirName% && npx npm-check-updates -u", | |
"install-cdk-updates": "cd %npm_package_config_infrastructureDirName% && npm install", | |
"make-cdk-app": "mkdir %npm_package_config_infrastructureDirName% && cd %npm_package_config_infrastructureDirName% && npx cdk init --language typescript && npm run build", | |
"synth-stack": "cd %npm_package_config_infrastructureDirName% && npm run build && npx cdk synth", | |
"list-stacks": "cd %npm_package_config_infrastructureDirName% && n |
NewerOlder