Skip to content

Instantly share code, notes, and snippets.

View gudongfeng's full-sized avatar
🍵
Enjoy the moment

DONGFENG GU gudongfeng

🍵
Enjoy the moment
View GitHub Profile

Frequently used commands

  • brownie run scripts/deploy.py: Run the deploy script to deploy the smart contract
  • brownie complie: Complie the whole project
  • brownie console: Open the brownie console and interact with the smart contract

For accounts

  • brownie accounts new <Account_Name>: Link a real world account in brownie for deployment/testing purpose
  • brownie accounts list: List the accounts you can use in borwnie

For testing

import sys # import sys
import json
import time
import os
picdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pic')
libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
from watchdog.observers import Observer
const { Client } = require('tplink-smarthome-api');
const _ = require('lodash');
const fs = require('fs');
const client = new Client();
const deviceInfoFilePath = '/tmp/devicelist.json';
var devicesInfo = {};
function writeStatusToFile(object) {
// Write the status to file
@gudongfeng
gudongfeng / test_adapter.rb
Last active April 24, 2018 14:07
Rails ActionCable Channel Rspec test
# spec/channels/stubs/test_adapter.rb
class SuccessAdapter < ActionCable::SubscriptionAdapter::Base
def broadcast(channel, payload)
end
def subscribe(channel, callback, success_callback = nil)
end
def unsubscribe(channel, callback)
end