Living a Simple Life is a Happy Life

有饭吃,自由自在,就非常开心

How to Update to gcc4.9.x on Centos7

| Comments

现在很多软件包默认编译要求GLIBCXX >=3.4.20,碰到这种事redhat系又哭了,目前Centos7.x默认仓库里的gcc还是4.8.5的,所以需要一个办法升级gcc相关组件>=4.9.1。

CentOS下升级gcc版本有两个途径,一个是添加其他源进行自动升级,一个是手动编译升级,这里先顺便讲下自动升级的两个办法:

添加Fedora源

在 /etc/yum.repos.d 目录中添加文件 FedoraRepo.repo ,并输入以下内容:

[warning:fedora]
name=fedora
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=https://getfedora.org/static/34EC9CBA.txt

然后执行

yum update gcc gcc-c++

使用Devtoolset-4升级

yum install centos-release-scl
yum install devtoolset-4-gcc*
scl enable devtoolset-4 bash
which gcc
gcc --version

Ant Pool Support Bitcoin Ulimited

| Comments

比特币诞生8年来最大波澜即将到来,大家拭目以待。

北京时间2017年3月7日凌晨2点半左右,当前比特币全网算力排名第一的矿池蚁池(AntPool)的某个节点通过替代版比特币软件Bitcoin Unlimited(BU)挖到了一个新区块,这标志着蚁池正式向Bitcoin Unlimited(BU)开放投票。

目前蚁池的算力占全网算力的13%左右,加上已有的支持BU的算力,BU支持率达到30%以上。

也许未来一个月很快就会发生一些有趣的事情,这是Bitcoin系统运行8年来的最大波澜。

大家拭目以待。

用Pyinstaller打包python脚本适配windows

| Comments

一行命令的事,纯python脚本打包出来一般5Mb左右,大小还可以接收。

首先在脚本同目录下加入一个pyinstaller.py:

#!/usr/bin/env python
from PyInstaller.__main__ import run
run()

然后执行:

python pyinstaller.py -c -F <xxxx.py> -p <sdk>
  • 为脚本名称
  • 为三方包目录

Python在windows CMD中输出中文

| Comments

在windows CMD中输出中文是比较烦的事情,最简单的就是增加一个windows.py,用的时候import一下:

#!/usr/bin/env python
#  -*- coding: utf-8 -*-
import sys

class UnicodeStreamFilter:
    def __init__(self, target):
        self.target = target
        self.encoding = 'utf-8'
        self.errors = 'replace'
        self.encode_to = self.target.encoding
    def write(self, s):
        if type(s) == str:
            s = s.decode("utf-8")
        s = s.encode(self.encode_to, self.errors).decode(self.encode_to)
        self.target.write(s)

if sys.stdout.encoding == 'cp936':
    sys.stdout = UnicodeStreamFilter(sys.stdout)

加密技术发展

| Comments

比特币是建立在区块链基础上的,区块链的基本技术支撑有三个:

  • 非对称加密

  • 点对点网络技术

  • HASH现金

其中非对称加密和HASH现金技术的历史发展颇有渊源,最近仔细学习了一下密码学科普知识,总结一下。

GPU运算卡备存

| Comments

科技产品的命名一很高冷,就是老发烧友,过了几年再来看新产品的名儿,仍有可能一头雾水。

这其中显卡命名尤甚,为了不把马良认成马超,留存一下。

从知乎上爬来一堆资料,先来备忘一下基础知识:

作者:老汤 链接:https://zhuanlan.zhihu.com/p/20585886