您正在查看: Surou 发布的文章

【Ubuntu】Ubuntu 18.04 LTS 更换国内源——解决终端下载速度慢的问题

最近装了ubuntu18.04 LTS,下载软件有点慢,网上搜了下解决方案,大致是两种:一、把/etc/apt/sources.list文件里的源更换一下,改成阿里云或者其它的镜像的文件;二、更换software&updates里的select best server。

一、更换/etc/apt/sources.list文件里的源

1. 备份源列表

Ubuntu配置的默认源并不是国内的服务器,下载更新软件都比较慢。首先备份源列表文件sources.list:

# 首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2. 打开sources.list文件修改

选择合适的源,替换原文件的内容,保存编辑好的文件, 以阿里云更新服务器为例(可以分别测试阿里云、清华、中科大、163源的速度,选择最快的):

# 打开sources.list文件
sudo gedit /etc/apt/sources.list

编辑/etc/apt/sources.list文件, 在文件最前面添加阿里云镜像源:

#  阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. 刷新列表

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

下载速度瞬间就起飞了。

4. 其他源

中科大源:

#  中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源:

# 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华源:

# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

转载自:https://zhuanlan.zhihu.com/p/61228593

WSL 编译EOS报 set: -i: invalid option

windows10 Linux子系统(Ubuntu 18.04)编译EOS报错如下

surou@DESKTOP-444S803:/mnt/c/github/eos$ ./scripts/eosio_build.sh
EOSIO Version: 1.8.6
Sat Jan  4 05:50:58 UTC 2020
User: surou
Current branch: develop
./scripts/eosio_build.sh: line 129: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

原因是子系统的系统名不是Ubuntu

( [[ ! $NAME == "Ubuntu" ]] && [[ ! $ARCH == "Darwin" ]] ) && set -i # Ubuntu doesn't support interactive mode since it uses dash + Some folks are having this issue on Darwin; colors aren't supported yet anyway

查看子系统的Name

surou@DESKTOP-444S803:/mnt/c/github/eos$ echo $NAME
DESKTOP-444S803

所以编译时设置下环境变量即可
编辑环境变量配置文件

vim ~/.bashrc

将下面参数添加到文件尾部

export NAME=Ubuntu
export VERSION_ID=18.04

备注:如果安装1.8.x的EOS,且没配置过环境变量的话,可以一起加上

export PATH=$PATH:/home/surou(当前用户名)/eosio/1.8/bin

然后刷新环境变量

source ~/.bashrc

然后再次执行

surou@DESKTOP-444S803:/mnt/c/github/eos$ ./scripts/eosio_build.sh

EOS 合约使用 current_time_point (eosio.cdt v1.6)

From eosio.cdt v1.6 onwards
You have to #include <eosio/system.hpp> and then you can use:

eosio::current_time_point
eosio::current_block_time
to cast from time_point to uint32_t u can use like:
eosio::current_time_point().sec_since_epoch();

参考

https://github.com/EOSIO/eosio.cdt/issues/470

git 提示 fatal: Authentication failed for 'http://***********‘’得解决方法

首先用 git config --list 查看一下

user.name=surou
user.email=652511569@qq.com

如果不对,用命令设置一下

git config --global user.name "xxxx"
git config --global user.email  "xxxx"

如果还不行,执行一下命令,重新输入用户名密码就可以了:

git config --system --unset credential.helper

如果是Windows平台提示权限不足,就去git 安装目录右键管理员权限运行git-bash.exe,然后再切换到仓库目录再次执行。

工作量证明(PoW)与EOSIO一起使用

https://www.eospow.org/
https://github.com/NedAmarril/eosiopowcoin

EOS 工作量证明硬币(POW)[1]将PoW(工作量证明)采矿时间表和调整比特币(BTC)[2] 的难度应用于EOSIO [3]令牌。

每10分钟铸造50个战俘,持续约4年,然后将一半铸造成一半。一直重复,直到有2100万个POW,与BTC完全一样。

EOS CPU和NET资源用于通过将EOS转移到eosiopowcoin来挖掘POW。每次您将EOS发送到eosiopowcoin合约账户时,该EOS的确切金额加上eosiopowcoin账户中总POW供应量的0.0025%将会被转回给您。

POW是一个完全分散的,不信任的开源项目,无需开发人员分配。每个单独的战俘都已经或将要被开采。没有给予战俘免费或预先开采。使用setupminer 操作后,任何人都可以挖掘POW 。战俘的铸造将持续到供应达到2100万为止。没有人可以阻止POW的铸造,开采或分销。合同是无钥匙的。