Skip to content

Instantly share code, notes, and snippets.

View smiled0g's full-sized avatar
🐻
Fighting bear market by BUIDLing great products

Paul N. smiled0g

🐻
Fighting bear market by BUIDLing great products
  • Band Protocol, TripAdvisor, Turfmapp
  • Bangkok, Thailand
  • X @PNattapatsiri
View GitHub Profile
// npm install --save @bandprotocol/bandchain.js
import BandChain from '@bandprotocol/bandchain.js'
// Chain parameters
const endpoint = 'https://guanyu-devnet.bandchain.org/rest'
// Request parameters
const oracleScriptId = 13
const params = {
"base_symbol": "BAND",
"quote_symbol": "USD",
"aggregation_method": "median",
@smiled0g
smiled0g / bandchain_ui_2.js
Created August 29, 2020 10:37
BAND/USD Oracle Script
// Chain parameters
const endpoint = 'https://guanyu-devnet.bandchain.org/rest'
// Request parameters
const oracleScriptId = 13
const params = {
"base_symbol": "BAND",
"quote_symbol": "USD",
"aggregation_method": "median",
"multiplier": 1000000
}
@smiled0g
smiled0g / bandchain_ui_3.js
Created August 29, 2020 10:37
BAND/USD Get Result
async function getLatestRequestResult() {
const bandchain = new BandChain(endpoint)
const oracleScript = await bandchain.getOracleScript(oracleScriptId)
const { result, resolve_time } = await bandchain.getLastMatchingRequestResult(
oracleScript,
params,
validatorCounts,
)
return {
result: parseFloat(result.px) / params.multiplier,
@smiled0g
smiled0g / run_llama.sh
Last active June 21, 2023 00:45
Easy way to run local LLM for your M-series Macbooks
#!/usr/bin/env bash
# Install Git Large File Storage (LFS)
brew install git-lfs
git lfs install
# Download & Install Llama
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
LLAMA_METAL=1 make -j # build with Metal support for (M-series) Apple Silicon