Skip to content

Instantly share code, notes, and snippets.

View thanhson1085's full-sized avatar

Nguyen Sy Thanh Son thanhson1085

  • Hanoi, Vietnam
View GitHub Profile
/*
* RPC: https://rpc.tomochain.com mainnet, https://rpc.testnet.tomochain.com testnet
* chainId: 88 mainnet, 89 testnet
*/
const Web3 = require('web3')
const rpc = 'https://rpc.testnet.tomochain.com'
const chainId = 89
const pkey = 'YOUR_PKEY' // token holder pkey
// Use ethers JS libray
// Required ERC20 Abi
// Required Uniswap/Pancakeswap Router Abi
// Required Provider wallet (who provide the liquidity)
// Required Buyer wallet (who want to buy TEST token)
// Read docs https://docs.uniswap.org/protocol/V2/reference/smart-contracts/router-02#addliquidityeth
// Read docs https://docs.uniswap.org/protocol/V2/reference/smart-contracts/router-02#swapexacttokensfortokens
console.log('addLiquidity TEST BUSD ...')
let amm = new ethers.Contract(config.get('AMMRouterAddress'), ammRouterAbi, provider)
import serial
def send_text(number, text, path='/dev/ttyUSB1'):
ser = serial.Serial(path, timeout=1)
ser.write('AT+CMGF=%d\r' % 1)
ser.write('AT+CMGS="%s"\r' % number)
ser.write('%s\x1a' % text)
print ser.readlines()
ser.close()
#!/bin/bash
touch .pwd
export $(cat .env | xargs)
WORK_DIR=$PWD
WS_SECRET="${WS_SECRET:-bgfmsp2r7TgIYA2HW48SkBQE6L4CUc}"
TOMOCHAIN_DIR="${TOMOCHAIN_DIR:-${HOME}/go/src/github.com/tomochain/tomochain}"
TOMOXSDK_DIR="${TOMOXSDK_DIR:-${HOME}/go/src/github.com/tomochain/tomox-sdk}"
BOT_DIR="${BOT_DIR:-${HOME}/tomox-market-maker}"
TOMORELAYER_DIR="${TOMORELAYER_DIR:-${HOME}/tomorelayer}"
const web3Rpc = require('../models/web3rpc')
const config = require('config')
const logger = require('../helpers/logger')
const BigNumber = require('bignumber.js')
let sleep = (time) => new Promise((resolve) => setTimeout(resolve, time))
var nonce = 0
async function run (pkey, to) {
const account = web3Rpc.eth.accounts.privateKeyToAccount('0x' + pkey)
#!/bin/bash
for i in {004..005}
do
A='{"type":"A","name":"'
B='","content":"xxxx","ttl":120,"priority":10,"proxied":true}'
DATA="${A}${i}${B}"
curl -X POST "https://api.cloudflare.com/client/v4/zones/xxx/dns_records" \
-H "X-Auth-Email: admin@tomochain.com" \
-H "X-Auth-Key: xxx" \
ssh-agent bash -c 'ssh-add ./tmp_key; git push origin devnet -f'
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field separator to line break, so that we can iterate easily over the verify-pack output
#!/bin/sh
# get tomochain container id
container_id=$(docker ps -q -f "name=tomochain")
# remove all peers
echo "\n------------------------\n!! Removing all peers\n------------------------\n"
docker exec -t $container_id tomo attach data/tomo.ipc --exec "for (i = 0; i < admin.peers.length; i++) { admin.removePeer(admin.peers[i].id) }"
# add TomoChain peers
wget https://dl.eff.org/certbot-auto
chmod +x certbot-auto
mv certbot-auto /usr/bin/certbot
certbot -d [domain]
crontab -e
0 5 * * 1 /usr/bin/certbot -q renew --post-hook "systemctl reload nginx"