tmux

apt install tmux
// 标记标题 dev
tmux new -s dev
tmux new -s admin
执行长时间任务,退出对话
tmux detach
重新登录后
tmux attach -t dev
tmux switch -t admin

临时长时间后台运行应用

nohup ping www.ibm.com &

node misbehaving

2018-08-16 02:44:33 Misbehaving: 180.159.203.83:56679 peer=58019 (0 -> 100) BAN THRESHOLD EXCEEDED
节点 IP 会被加入禁止列表
如果某些节点的行为和协议不符,有破坏性(例如发大量无效的信息),一个禁止计数器会依据违反协议的程度增加。
(banscore 通过 bitcoind 设置默认 100)
当达到一个预设值得时候就会断开节点连接一天(可以使用 bantime 设置)。

deserialize or I/O error

重建索引试试

On going…

./primecoind -gen -debug -frontport=6667 -host=121.43.185.81 -feeaddr=AVjsWxuvcmjDvULpuegjKbgjrCthi2JVeq -daemon

Primecoin XPM Pool Server
https://github.com/madMAx43v3r/xpmpool
Primecoin XPM GPU Miner for xpmpool (aka. madPrimeMiner)
https://github.com/madMAx43v3r/xpmclient
The solo-mining server code is at: https://github.com/madMAx43v3r/xpmserver

Primecoin XPM GPU Miner for xpmpool (aka. madPrimeMiner)
https://github.com/eXtremal-ik7/xpmclient

http://xpmforall.org/

阅读全文 »

切换源

备份 /etc/apt/sources.list

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

输入

sudo gedit /etc/apt/sources.list

将下面的源复制到文件中,注销一下在执行,问题少些。

sudo apt-get update
sudo apt-get upgrade

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

sudo apt-get update
apt-get install nano
替换源

sudo apt-get update
sudo apt-get upgrade
apt-get install mingw-w64
sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make

On researching…

The Meson Build system
http://mesonbuild.com/

./configure –help

CLion supports only CMake-based projects for now.

Makefile projects (CPP-494)
Qt projects (CPP-318)
Autotools projects (CPP-193)

新建一个 CMakeLists.txt 文件,导入clion,多个构建系统可以并存
加入源文件,依赖库等信息

project(myproject C)
cmake_minimum_required(VERSION 2.8)

What toolchain should I use on Windows?
A: You have three options: Cygwin, MinGW and Microsoft Visual C++ compiler. More details on how to configure these toolchains:

https://stackoverflow.com/questions/719057/why-use-build-tools-like-autotools-when-we-can-just-write-our-own-makefiles
building system:

Gitian Building
Gitian is an open source software program that offers what is known as a “build environment.” A build environment is perhaps best described as a “computer within a computer,” but with a specific purpose: a virtual space to compile binaries, completely free of any variables. “Gitian Building,” the process of compiling binaries in Gitian, ensures that whatever computer is used, the binaries turn out exactly the same.

The features that I specifically need for this are:

C++11 support
Cross platform (Linux as main target, but able to build on at least Windows as well)
Decent unit testing support
Support for multiple modules for separating code out
Support for code generation (Using asn1c or protobuf - not 100% sure yet)
Easy to maintain

Tool chain:
GCC
Clang
GCC with MinGW
GCC with Cygwin 32

https://bazel.build/
Build and test software of any size, quickly and reliably

https://scons.org/
SCons 是一个开放源代码、以 Python 语言编写的下一代的程序建造工具。

gradle:
https://guides.gradle.org/building-cpp-executables/?_ga=2.95501525.87336500.1531787554-1352908805.1531787554

GNU Build System:

recently found out about these, I have not personally used them yet:

Ninja, a small build system focused on speed. Google now uses Ninja to build Android instead of Make: link.

Shake, a powerful and fast build system.

Tup, a high performance build system. Algorithmic based design. Analysis of Tup.

All are now cross-platform and support Windows. I’m not yet sure about the rest of your requirements as, again, I have yet to test them myself. They are being used in commercial development, CIG picked Ninja up. First two are akin to Scons, Ant, etc.

CMake
which is a Makefile-generator (also generates native MSVC++ .proj/.sln).

Autotools:creating the makefiles
Autotools:
Autoconf:
Autoconf easily scans an existing tree to find its dependencies and create a configure script that will run under almost any kind of shell. The configure script allows the user to control the build behavior (i.e. –with-foo, –without-foo, –prefix, –sysconfdir, etc..) as well as doing checks to ensure that the system can compile the program.

Configure generates a config.h file (from a template) which programs can include to work around portability issues. For example, if HAVE_LIBPTHREAD is not defined, use forks instead.

I personally use Autoconf on many projects. It usually takes people some time to get used to m4. However, it does save time.

You can have makefiles inherit some of the values that configure finds without using automake.

Automake:
By providing a short template that describes what programs will be built and what objects need to be linked to build them, Makefiles that adhere to GNU coding standards can automatically be created. This includes dependency handling and all of the required GNU targets.

Some people find this easier. I prefer to write my own makefiles.

Libtool
GNU coding standards

环境变量设置:
Both of the these makefiles support the following environment variables:

ICU_PATH: tells the makefile to build with Unicode support, set to the path where your ICU installation is located, for example with: make ICU_PATH=/usr/local install -fgcc.mak

CXXFLAGS: extra compiler options - note that this applies to both the debug and release builds.
INCLUDES: additional include directories.
LDFLAGS: additional linker options.
LIBS: additional library files.

export PATH=$PATH:/local/bin
export LD_LIBRARY_PATH=
/local/lib
export C_INCLUDE_PATH=/local/include
export CPLUS_INCLUDE_PATH=
/local/include

export CPPFLAGS=”${CPPFLAGS} -I${PREFIX}/include -I${SYSROOT}/usr/include -I${TOOLCHAIN}/include”
export CFLAGS=”${CFLAGS} -static -O2 –sysroot=${SYSROOT} -DANDROID -D__ANDROID__ -DSK_RELEASE -nostdlib -march=i686 -fpic”
export CXXFLAGS=”${CXXFLAGS} ${CFLAGS}”
export LDFLAGS=”${LDFLAGS} -Bstatic -L${PREFIX}/lib -L${SYSROOT}/usr/lib -L${TOOLCHAIN}/lib”
export LIBS=”${LIBS} ${SYSROOT}/usr/lib/crtbegin_static.o ${SYSROOT}/usr/lib/crtend_android.o -lc -lgcc -lgnustl_static -lstdc++ -lsupc++ -landroid_support”

export CPLUS_INCLUDE_PATH=/home/data/primecoin-core-desktop-src_mac/depends/SDKs/MacOSX10.11.sdk/usr/include/:/usr/include
export C_INCLUDE_PATH=/home/data/primecoin-core-desktop-src_mac/depends/SDKs/MacOSX10.11.sdk/usr/include/:/usr/include
上面的写法覆盖了系统设定的路径,下面的写法会先搜索指定路径,如果未找到就会到系统路径搜索
C_INCLUDE_PATH=~/local/include:$C_INCLUDE_PATH

取消环境变量
unset C_INCLUDE_PATH
unset LD_LIBRARY_PATH

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
cd /usr/bin
rm python
ln -s python3.6m python

sudo apt-get update
sudo apt-get -y install python3-pip

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

查看哪个线程在用 apt-get 进行下载

ps -A | grep apt-get

apt-get update的时候遇到 “Hash Sum mismatch” 错误

源服务器缓存更新不及时,导致 hash 不一致,看来除了换源别的基本够呛

sudo apt-get clean  
sudo apt-get update --fix-missing

sudo rm /var/lib/apt/lists/*
sudo apt-get update

升级 pip 之后出错

ImportError: cannot import name main

sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall
// 使用这种方式
python3 -m pip

add-apt-repository is broken with non-UTF-8 locales,

下载 ubuntu 16.04 image

// 下载镜像
docker pull ubuntu:16.04
// 查看 image id
docker images
// 交互式运行, -it交互方式启动容器,-name 给容器命名 -v目录映射 '宿主目录:容器目录'
docker run -it --name ubuntu16.04 -v /Users/zhengjun/project/docker/ubuntu16.04:/home/data --net=bridge 938 /bin/bash
// 登录 docker 容器
docker exec -it <containerIdOrName> bash
  • 安装没有自带的常用命令

    //通过 whereis ifconfig 发现根本就没有安装这个命令,需要自己安装
    apt-get update
    apt install net-tools # ifconfig
    apt install iputils-ping # ping
  • 停止容器

    docker stop containerID
  • 运行容器

    docker start containerID
  • 退出容器,容器仍在运行
    exit

  • 登录容器
    使用容器 id

    docker exec -it 29 bash

制作镜像

Dockerfile 中每一个指令都会建立一层.每一个 RUN 的行为,就和刚才我们手工建立镜像的过程一样:新建立一层,在其上执行这些命令,执行结束后,commit 这一层的修改,构成新的镜像。
编写 docker file

# docker file for bitcoin/primecoin test node
FROM ubuntu:16.04

MAINTAINER Tyler Cheng - "<zhengjun2018@gmail.com>"

ENV DEBIAN_FRONTEND noninteractive

# net-tools:ifconfig,iputils-ping:ping
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y net-tools iputils-ping autoconf libtool pkg-config \
libboost-all-dev libssl-dev libevent-dev software-properties-common
RUN add-apt-repository ppa:bitcoin/bitcoin
RUN apt-get update \
&& apt-get install -y libdb4.8-dev libdb4.8++-dev libminiupnpc-dev

尚未验证的项目

EXPOSE 22
将22端口‘暴漏’出来,以便在外部访问该端口。没有的话,将无法从外部(非运行docker的主机)ssh。

# 设置时区和语言
RUN echo "Asia/Shanghai" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata \
&& dpkg-reconfigure locales \
&& locale-gen C.UTF-8 \
&& /usr/sbin/update-locale LANG=C.UTF-8 \
&& ENV LC_ALL C.UTF-8
  • FROM 指定基础镜像

  • RUN 执行命令
    RUN <命令>

  • 打包

    遇到的问题

  1. docker制作镜像 apt-get 安装文件报错debconf: unable to initialize frontend: Dialog
    解决方法,添加下面设置
    ARG DEBIAN_FRONTEND=noninteractive
docker build [OPTIONS] PATH | URL | -

docker build --no-cache -t ubuntu16.04_bitcoin:bitcoin .

初步调研,记录一下相关资料

《Programming Massively Parallel Processors: A Hands-on Approach 》
《CUDA by Example: An Introduction to General-Purpose GPU Programming》
《CUDA并行程序设计:GPU编程指南》
《CUDA By Example》
http://www.kimicat.com/opencl-1/opencl-jiao-xue-yi