Skip to content

Instantly share code, notes, and snippets.

@thiagosouza
thiagosouza / nodejs nvm npm setup.sh
Last active September 28, 2021 14:49
[Node.js] Node.js Setup with NVM #nodejs #nvm #npm #setup
#node
#https://nodejs.org/en/download/
#nvm
#https://github.com/creationix/nvm#install-script
cd /tmp
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@thiagosouza
thiagosouza / candlestick patterns.pine
Created February 21, 2019 22:15
Candlestick patterns
// Created by Robert N. 030715
// Candle labels
study(title = "Candles", overlay = true)
trend= input(5, minval=1, title="Trend in Bars")
DojiSize = input(0.05, minval=0.01, title="Doji size")
data=(abs(open - close) <= (high - low) * DojiSize)
plotchar(data, title="Doji", text='Doji', color=white)
@thiagosouza
thiagosouza / readme.md
Created February 19, 2019 17:58
[lowdb] lowdb Small JSON database for Node, Electron and the browser. Powered by Lodash.

[lowdb] lowdb Small JSON database for Node, Electron and the browser. Powered by Lodash. https://github.com/typicode/lowdb

db.get('posts')
  .push({ id: 1, title: 'lowdb is awesome'})
  .write()
@thiagosouza
thiagosouza / readme.md
Last active February 19, 2019 17:55
[Swagger API] #swagger #api #firebase #nodejs #middleware
@thiagosouza
thiagosouza / oauth.md
Last active February 19, 2019 02:17
[OAuth]

https://www.oauth.com/

Access Tokens Password Grant 12.2

POST /oauth/token HTTP/1.1
Host: authorization-server.com
 
@thiagosouza
thiagosouza / 1 setup - nodejs nvm npm firebase.sh
Last active February 25, 2019 20:45
[MVP Blockchain Serverless] #blockchain #serverless #firebase #google-cloud
#node 8
#https://nodejs.org/en/download/
#nvm
#https://github.com/creationix/nvm#install-script
cd /tmp
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
@thiagosouza
thiagosouza / simpletoken.sol
Last active February 27, 2019 17:56
[simpletoken] smart contract based on openzeppelin token implementation
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
@thiagosouza
thiagosouza / 0 README.sh
Last active February 14, 2019 18:42
Smart Contracts usando Node.js, web3 e Serverless
mkdir mvp-blockchain-serverless
#install nvm and put a nvmrc file on the directory
touch .nvmrc && echo "8" >! .nvmrc && cd .
#initialize npm package
npm init
npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools
@thiagosouza
thiagosouza / gcloud.sh
Last active April 15, 2020 18:33
GCloud Setup
#GCloud
#install
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
#references
#https://cloud.google.com/sdk/docs/quickstart-linux
@thiagosouza
thiagosouza / 1 ICO.sol
Last active October 17, 2018 13:11
Ethereum Token
pragma solidity ^0.4.24;
import "./ERC20.sol";
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `ERC20` functions.
*/