Alexzl

Practice brings us progression, never perfection.


  • Home

  • Tags

  • Categories

  • Archives

Life-principle

Posted on 2019-06-25 | In Personal

Knowing & Doing

Concentrate

Confident

Persistence

Progress

Positive

Introspection

Go To Bed Early & Wake Up Early

Posted on 2019-04-19 | In Personal

Why do you want to go to bed early and get up early

The article of What are the Benefits of Waking up Early? tells a lot.

Better Concentration

  • Starting your day early improves your concentration. In addition to being able to focus on goals and task lists without being interrupted by family members or coworkers, getting up early means that by the time you get to work or school, you’ve had hours to properly acclimate yourself to the day. You’ll be more alert during peak hours as a result.

Enhances your Productivity

  • Early risers tend to be more productive for a variety of reasons, including:
    • Having more time to focus on important tasks while the rest of the world is asleep. This also translates to fewer interruptions.
    • Brains tend to be most alert in the morning. If you’re able to focus without interruptions early in the day, you’ll get more done.
    • You tend to make better decisions and think more clearly in the morning than in the afternoon and evening. Setting your goals first thing will help you achieve them.
    • If you can manage to get out of bed early, you’ll find that you have more energy throughout the day. It seems counterintuitive, but there are countless testimonials.

Helps you Enjoy Quiet Time

  • It’s a miracle how quiet the world is first thing in the morning. Not only are there zero distractions, which will allow you to enjoy peace and quiet, but you’ll also find that your daily commute is easier if you leave an hour earlier and beat all the traffic.

What’s the plan?

First try to persist this for 30 days. Let’s find out what will happen then!

30 days after the persistence


Check the result on May 19th, 2019 with evidence.
Failed
Try to do your best. Review more. Recap more. Learn more.

predictions on 2019 nba playoffs

Posted on 2019-04-13 | In Personal

Predictions on 2019 NBA Playoffs

predictions on 2019 nba playoffs

Can’t wait to see what will happen

use custom domain with hexo && how to reset to origin

Posted on 2019-02-15 | In Tutorial

Use custom domain to your blog built on Hexo

If you want use your own domain name instead of the one (xxx.github.io) given by github, the following steps should be taken.

  1. Get your git page’s ip

    1
    2
    ping xxx.github.io
    //change the xxx on your own

    PING
    The return XXX.XXX.XXX.XXX is the ip you need.

  2. Configure DNS Setting
    DNS Configure
    The operation for different provider varies, you should figure it out on your own.
  3. Create CNAME file
    Change to hexo directory, create a CNAME file under source directory. Add your custom domain to the file
  4. Things get done via the following commands

    1
    hexo clean && hexo g && hexo d

    After this, when you enter the xxx.github.io into your browser, it will automatically redirect to your own domain. And if you enter your own domain, the browser will show you your blog content.

How to reset to original domain given by github

If you want to reset the domain, you can achieve it by doing following steps

  1. Change directory to your repo, and clean it

    1
    hexo clean
  2. Edit your CNAME file, leave it blank or just delete it

  3. Finished via commands

    1
    hexo g && hexo d
  4. Then you could check out whether it works by entering your original url(xxx.github.io) into browser. If it doesn’t redirect to your custom domain and it shows contents instead of 404 page, it means it works.

  5. One more thing: if you don’t want your custom domain link to your blog, you could just configure the DNS and remove the relative rule.
    That’s all for this tutorial.

install-python3.6-on-ubuntu-16.04-LTS

Posted on 2019-02-14 | In Problem

Install Python3.6 on Ubuntu 16.04 LTS

The default python version is 3.5. And if you want to use the version 3.6, it takes times to do it. You could install Python3.6 from a third-party PPA by doing the following steps.

  1. Add the python 3.6 repository

    1
    sudo add-apt-repository ppa:jonathonf/python-3.6
  2. Check updates and install Python3.6 via commands

    1
    2
    sudo apt-get update
    sudo apt-get install python3.6

    After this, you could find out the specified details of the python you’ve installed with the following commands

    1
    python3.6 -V

    The latest version should be 3.6.7 (Installation date is 2019.02.14)

  3. To make python3 use the new installed python3.6 instead of the default 3.5, run following commands

    1
    2
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

    Finally switch between the two python version for python3 via command

    1
    sudo update-alternatives --config python3

    After selecting version 3.6

    1
    python3 -V

    Reference: How to Install Python 3.6.1 in Ubuntu 16.04 LTS

    Problems

    Q:
    It shows the following error pip3 command not found, but the python3-pip has been already installed.
    Solution:
    If this happens, you could reinstall pip3 via following commands

    1
    2
    sudo apt-get remove python3-pip
    sudo apt-get install python3-pip

    Reference: pip3 command not found

install ss on vps

Posted on 2019-02-07 | In Tutorial

Install SS on VPS

Install Python Package Management && Shadowsocks

1
2
3
4
5
6
7
8
<!--Run shell with root privilege-->
sudo -s

<!--Install python package manage tools-->
apt-get update && apt-get install -y python-setuptools python-pip

<!--Install shadowsocks-->
pip install shadowsocks

Edit shadowsocks configuration

Create and edit config file

1
vi ss.json

1
2
3
4
5
6
7
8
{
"server":"0.0.0.0",
"method":"aes-256-cfb",
"port_password":{
"443":"imthebest",
"5211":"getusedtoit"
}
}

Launch shadowsocks on server(Useful command)

Basic command

1
2
3
ssserver -c ss.json -d start
ssserver -c ss.json -d stop
ssserver -c ss.json -d restart

Set automatically boot

1
2
//Insert the following command before the last line of file `/etc/rc.local`
sudo ssserver -c /home/ubuntu/ss.json -d start

Problems

python error

1
locale.Error: unsupported locale setting

Solution

1
export LC_ALL="en_US.UTF-8"

regular-mac-problem-01

Posted on 2019-01-19 | In Problem

Mac Bluetooth unavailable && Hide Terminal scroll bars

Mac蓝牙不可用的处理方法

mac-bluetooth-proble
Macbook pro的蓝牙经常会莫名其妙地变成不可用的状态,比如由于虚拟机导致的硬件Bluetooth冲突.

  1. 最简单直接粗暴的方式是重启mac,重启能够直接解决此问题.
  2. 鉴于有长期不关mac的习惯,因此推荐以下这种方法.
  • 打开系统设置–>蓝牙–>取消对在菜单栏中显示蓝牙的勾选
  • 打开activity monitor–>强制关闭bluetoothd这个进程
  • 系统设置–>蓝牙–>勾选在菜单栏中显示蓝牙
  • Things get done

关掉Terminal的违和滚动条

hide-terminal-scroll-ba
打开系统设置–>通用–>显示滚动条选项–>选择滚动时
Amazing things happen

ehForwarderBot wechat slave

Posted on 2019-01-05 | In Tutorial

使用EFB实现Telegram收发微信

即时聊天工具确实太多了,比如qq,微信,what’s app,telegram等等.而且有些app确实太过于臃肿,比如微信,对于我来说,只是为了接收几个人的消息而已,对于其所谓的生态没有半毛钱兴趣.因此ehForwarderBot诞生了.它可以调用其他即时通讯的api,在一个app上(本文用telegram)集中管理所有消息.PS:这样子就能在一个手机上双开微信(但是telegram上的微信只能聊天,并不能做别的事情)…本文主要介绍如何使用telegram来接发微信消息,关于其他的app自己有兴趣的可以找官方文档尝试一下,不同的点主要在于slave channel的变更.

前置条件

  • 微信账号必须能登录网页版(本质是调用网页版微信的api接口,所以才能达到所谓的多端口登录)
  • 一台vps,国内的或者海外的都可以,建议最好还是用海外的
  • vps上的python的使用版本必须大于等于3.6
    • 说实话EFB 2.x的安装比几年前的1.x的安装要简单太多了,也比之前1.x的要稳定,但是假如你用的python版本是小于等于3.6的话,各种惊喜在后面等你
    • 报错出现类似于empty channel之类的话,请检查一下你安装efb时使用的python版本
    • 由于很多linux系统的python版本是都是默认的3.5(linux系统的很多脚本是直接用python写的),即使你升级也无济于事,所以这里建议vps的系统最好使用windows的,因为windows的python版本安装就是傻瓜式操作,升级会把之前的老版本给直接覆盖了,没有版本管理这一说(对于没有经验的人来说,这是最快的解决方式.但是这也依旧抹除不了windows是个垃圾这个不争的事实)
    • Screen Shot 2019-01-05 at 16.08.15
    • 对于Ubuntu 16.04.6 LTS 安装Python 3.6的话,可参照install-python3.6-on-ubuntu-16.04-LTS

安装步骤

安装ehForwarderbot

  1. 假如系统版本的python不是3.6及以上的,请自行stackoverflow或者去相关系统的论坛上查找解决方案,自己花了几个小时,到最后也不知道是怎么被自己切换到python3.6
  2. 以下操作都是基于你已经安装了python3.6的前提下进行的
  3. 安装efb的依赖

    1
    2
    3
    sudo apt install ffmpeg
    sudo apt install python3-pip
    pip3 install libmagic pillow
  4. 安装efb

    1
    pip3 install ehforwarderbot
  5. 在根目录下新建一个.ehforwarderbot的文件夹,并且更改所有用户的权限

    1
    2
    mkdir ~/.ehforwarderbot
    chmod -R 777 .ehforwarderbot
  6. 接着再新建一个存储数据的文件夹storage,并更改其权限

    1
    2
    mkdir -p .ehforwarderbot/storage
    chmod 777 .ehforwarderbot/storage
  7. 安装master channel: Telegram

    1
    pip3 install efb-telegram-master
  8. 安装wechat slave channel: Telegram

    1
    pip3 install efb-wechat-slave

创建Bot

在Telegram中通过BotFather创建一个新的bot,用来专门接收来自于微信的消息

1
2
3
4
5
6
7
8
9
10
1. /start
2. /newbot # 会生成一个**token**
3. /setprivacy # 设置为'Disable'接收所有来自群的消息
4. /setjoingroups # 'Enable'可以将该机器人添加到其他telegram群中
5. /setcommands 添加以下命令及描述:
link - 将会话绑定到 Telegram 群组
chat - 生成会话头
recog - 回复语音消息以进行识别
extra - 获取更多功能
6. @get_id_bot 获得**bot ID**

配置文件

  1. 创建并且配置Telegram master相关文件

    1
    2
    3
    cd .ehforwarderbot
    mkdir -p profiles/default/blueset.telegram
    vi profiles/default/blueset.telegram/config.yaml

    在上述文件中写入以下内容(以下的token就是在telegram中获取的token以及botId)

    1
    2
    3
    4
    5
    6
    token: "6***262:AA***nUWU"
    admins:
    - 20***7
    master_channel: "blueset.telegram"
    slave_channels:
    - "blueset.wechat"

    修改保存完成之后

    1
    cp profiles/default/blueset.telegram/config.yaml profiles/default
  2. 创建并且配置wechat slave channel相关文件

    1
    2
    mkdir -p profiles/blueset.wechat
    vi profiles/blueset.wechat/config.yaml

    在上述文件中写入以下内容

    1
    2
    3
    4
    flags:  
    option_one: 10
    option_two: false
    option_three: "foobar"
  3. 启动EFB

    1
    screen python3 -m ehforwarderbot
  4. Enjoy yourself
    如有问题,欢迎调戏

alexzl

alexzl

Live for now

8 posts
3 categories
10 tags
© 2019 alexzl