Skip to content

Instantly share code, notes, and snippets.

@libotony
libotony / ps-grep-kill.sh
Created April 26, 2017 04:35 — forked from itomg/ps-grep-kill.sh
ps grep awk xargs kill
ps aux|grep cron-14|awk '{print $2}'|xargs echo
ps aux|grep cron-14|awk '{print $2}'|xargs kill
ps aux|grep cron-14|awk '{print $2}'|xargs kill -9
#!/bin/bash
## 备份计划任务
##
## 每天凌晨1:30一次全量备份
## 每天间隔1小时一次增量备份
## 30 1 * * * backup.sh full
## 00 * * * * backup.sh inc
##
## 恢复数据步骤:
@libotony
libotony / build-thor-on-windows.md
Last active November 20, 2023 04:23
build thor on windows
  1. Install MSYS2 from Official Webisite
  2. Follow the instructions in the Official Webisite to update the packages
  3. Start MSYS2 with MinGW-w64
  4. Install required softwares via run pacman -S git make mingw-w64-x86_64-gcc mingw-w64-x86_64-go
  5. Run git clone https://github.com/vechain/thor.git
  6. Run make dep
  7. Run make clean
  8. Run make all
@libotony
libotony / Setup own VeChain Thor network.md
Last active February 18, 2019 10:04
Setup your own VeChain Thor network

Requirements

  1. At least one MasterNode
  2. At least one Rich Account
  3. At least two public nodes that can connect each other
  4. Executor Can be an address or Executor Contract(Vote contract among steering committee)

Configure Steps

Here we change genesis/testnet.go, this will allow us to build a network with peer to peer network. Furthermore you can change genesis/devnet.go to run a dev-net in solo mode, this allows you to do test locally.

@libotony
libotony / install-solidity-at-4-on-mac.md
Last active May 13, 2019 02:39
Install Solidity@0.4.x on Mac by HomeBrew
  • Create a file solidity@4.rb
  • Run brew install ./solidity@4.rb

If you would like to find other versions of solidity, go to the homebrew-ethereum, find the version you need to install, replace the version and sha256in the file, then install.

@libotony
libotony / delegated-tx.js
Created May 23, 2019 09:47
Build delegated tx by thor-devkit.js
const originPriv = Buffer.from('c962bfd916c0f8d4c1866b11a24802815cf58ba981354fad0ac734d0217cfe73', 'hex')
const txOrigin = cry.publicKeyToAddress(cry.secp256k1.derivePublicKey(originPriv))
const delegatorPriv = Buffer.from('dce1443bd2ef0c2631adc1c67e5c93f13dc23a41c18b536effbbdcbcdb96fb65', 'hex')
const delegator = cry.publicKeyToAddress(cry.secp256k1.derivePublicKey(delegatorPriv))
const tx = new Transaction({
chainTag: 0x27,
blockRef: '0x002b99c540c4e267',
expiration: 30 * 8640, // Expires after 30 days
@libotony
libotony / test_speed.sh
Created July 24, 2020 07:21
Evaluate load time by curl
curl -o /dev/null -s -w "namelookup: %{time_namelookup}s\nconnect: %{time_connect}s\nappconnect: %{time_appconnect}s\npretransfer: %{time_pretransfer}s\nredirect: %{time_redirect}s\nstarttransfer: %{time_starttransfer}s\n-------------------------\ntotal: %{time_total}s\n" --resolve "explore.vechain.org:443:164.90.187.219" https://explore.vechain.org/blocks/0x00634e680262af793cdab1b5a520282336f9eefb7f4a7b2d73f60fc02a2de1c5/
@libotony
libotony / ALLOW_ALL.conf
Last active July 21, 2021 02:49
PUBLIC THOR NODE WITH NGINX
map $http_upgrade $connection_upgrade {
default upgrade;
"" close;
}
upstream BACKEND {
server 127.0.0.1:8669;
keepalive 64;
}
@libotony
libotony / genesis.json
Last active March 29, 2021 08:34
Genesis file for VIP-193 enabled testnet
{
"launchTime": 1617091200,
"gasLimit": 10000000,
"extraData": "193 TestNet",
"accounts": [
{
"address": "0xa477d5b50daf4c673308da10eecfc817eb9f5f21",
"balance": "50000000000000000000000000000",
"energy": "1000000000000000000000000000"
},
@libotony
libotony / derive_dev_accounts.ts
Last active April 28, 2022 18:56
Derive dev accounts of vechain solo node
import { HDNode } from 'thor-devkit'
const words = 'denial kitchen pet squirrel other broom bar gas better priority spoil cross'
const hdNode = HDNode.fromMnemonic(words.split(' '))
for (let i = 0; i < 10; i++){
const priv = hdNode.derive(i).privateKey
console.log('0x'+ priv?.toString('hex'))
}