Skip to content

Instantly share code, notes, and snippets.

View Cyb3rDudu's full-sized avatar

dudu Cyb3rDudu

  • catdev
  • Kuala Lumpur
  • 01:29 (UTC +08:00)
View GitHub Profile
const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://bsc-dataseed.binance.org/');
// you can find pair address from Factory Contract, method getPair(token1Addr, token2Addr).
let Contract = {
PancakePair: new ethers.Contract('0xb694ec7C2a7C433E69200b1dA3EBc86907B4578B',['function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'], provider),
TwindexPair: new ethers.Contract('0xC789F6C658809eED4d1769a46fc7BCe5dbB8316E',['function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'], provider)
}
@Cyb3rDudu
Cyb3rDudu / getPrice.js
Created May 23, 2025 16:55 — forked from earthchie/getPrice.js
Simple API to get a exchange rate from PancakeSwap V2 Router
const express = require('express');
const { ethers } = require('ethers');
const app = express();
const port = 3000;
const provider = new ethers.providers.JsonRpcProvider('https://bsc-dataseed.binance.org/');
const contract = {
factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', // PancakeSwap V2 factory
router: '0x10ED43C718714eb63d5aA57B78B54704E256024E', // PancakeSwap V2 router
@Cyb3rDudu
Cyb3rDudu / cpu-hog-overcommit.yaml
Last active May 2, 2025 04:44
7 CPU-hogging pods, each requesting and limiting 5000m CPU to test CPU overcommitting
apiVersion: apps/v1
kind: Deployment
metadata:
name: cpu-overcommit-demo
labels:
app: cpu-overcommit-demo
spec:
replicas: 4
selector:
matchLabels:
{
"name": "ENTEST Pool",
"description": "Cardano stakepool testnet from ENVOLABS",
"ticker": "ENTEST",
"homepage": "https://google.com"
}
{
"name": "Envolabs Pool",
"description": "Envolabs Cardano stakepool",
"ticker": "ENVO",
"homepage": "https://envolabs.io"
}
@Cyb3rDudu
Cyb3rDudu / use-daedalus-socket-cardano-cli.sh
Created June 18, 2021 17:49 — forked from ilyar/use-daedalus-socket-cardano-cli.sh
Use Daedalus socket for cardano-cli for Mainnet or Testnet the Cardano
#!/usr/bin/env bash
# Install cardano-cli or use docker https://gist.github.com/ilyar/bf4c2346be1a74c50e488181986808fb
#
# Linux https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-linux/latest-finished
# Win64 https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-win64/latest-finished
# Macos https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-macos/latest-finished
# Extcact only cardano-cli into /usr/local/bin/cardano-cli
# Check
cardano-cli --version
@Cyb3rDudu
Cyb3rDudu / minting-native-tokens-on-cardano.sh
Created June 18, 2021 17:10 — forked from ElGatoLoco/minting-native-tokens-on-cardano.sh
Mint native tokens on Cardano testnet using the node and cli that come with Daedalus
# This guide assumes that you're running MacOS and already have a fully synced Daedalus testnet wallet
# For mainnet some minor tweaks are required
# The line below assumes the default location for the testnet wallet at the time of writing this guide
# If your node socket is located somewhere else, you should be able to finding by inspecting the running processes on your machine
export CARDANO_NODE_SOCKET_PATH=~/Library/Application\ Support/Daedalus\ Testnet/cardano-node.socket
# Make testnet id available as environment variable; not needed for the mainnet
# This one is active at the time of writing this guide
export TESTNET_ID=1097911063