福建与江西高考本科上线率对比

每年高考都牵动不少家长的心,虽然小孩还比较小,但不妨碍对高考的关注。

比较了近几年福建与江西参加高考人数及本科上线率后,发现我们福建人还是有很大的优势的。

的确这几年福建有比较多,原先属于大中专院校升级成本科院校了,但这也没关系呀,去考公务员、事业单位的时候,只会提到本科学历、硕士学历;根本不会问你是什么学校毕业的。

进入民营企业后,开始工作后企业更看重的是个人工作能力,也就验证了那句话:英雄莫问出处。

现在哪里都是卷的厉害,一堆企业倒闭,一堆企业裁员,到处都是风声鹤唳的,不断提升自身软实力才是关键中的关键。

国内无法拉取github时

在国内同步github上内容时,总有各种异常,比如:Clone failed RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.

此时也可能很无奈,但方法总是比困难多,设置http/https代理可以轻松解决此问题

设置方法:

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

关闭方法

git config --global --unset http.proxy
git config --global --unset https.proxy

ubuntu20.04系统默认sources.list

由于GFW的存在,在很多时候会选择国内源作为加速系统更新,但也不排除这其中有很多深坑,所以建议在做系统更新的时候,强烈建议使用ubuntu官方源,可以排除很多诡异的问题。

下面Ubuntu20.04官方源可作为参考:

#deb cdrom:[Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423)]/ focal main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal universe
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

limits.conf详解

1. /etc/security/limits.conf

limits.conf的格式如下:

分成四个段落domain,type,item,value

[domain] [type] [item] [value]

domain

username|@groupname 设置需要被限制的用户名或组,组名前面加@和用户名区别;
也可以用通配符*来做所有用户的限制。

type:有 soft,hard 和 –

soft 指的是当前系统生效的设置值(警告)
hard 表明系统中所能设定的最大值(错误)
soft 的限制不能比har 限制高,- 表明同时设置了 soft 和 hard 的值。

item:有以下几种

core - 限制内核文件的大小(KB)
date - 最大数据大小(KB)
fsize - 最大文件大小(KB)
memlock - 最大锁定内存地址空间(KB)
nofile - 打开的文件描述符的最大数目**(经常设置)**
rss - 最大持久设置大小(KB)
stack - 最大堆栈大小(KB)
cpu - 最大CPU时间(min)
noproc - 过程最大数量
as - 地址空间限制(KB)
maxlogins - 此用户的最大登录数量
maxsyslogins - 在系统上登录的最大数目
priority - 优先级运行用户进程
locks -  文件的最大数量锁定用户可容纳
sigpending - 最大挂起信号的数量
msgqueue - 通过POSIX消息队列使用的最大内存(字节)
nice - 最大不错优先允许提高到值:[-20,19]
rtprio - 最大实时优先

2. ulimit命令

命令参数

-a  显示所有限制
-c  core文件大小的上限
-d  进程数据段大小的上限
-f  shell所能创建的文件大小的上限
-m  驻留内存大小的上限
-s  堆栈大小的上限
-t  每秒可占用的CPU时间上限
-p  管道大小
-n  打开文件数的上限
-u  进程数的上限
-v  虚拟内存的上限

ulimit用法

# 显示所有设置
ulimit -a
# 对某程序的限制
ulimit -s 512
# 限制线程栈大小
ulimit -p 512

除可用Ulimit命令设置外,也可以在/etc/security/limits.conf文件中定义限制。

注:ulimit命令设置只是当时生效,limits.conf配置文件才是永久生效。

不同后缀C++源文件

  • Unix                                  —>            C , cc , cxx, c
  • GNU C++                           —>           C, cc,cxx,cpp,c++
  • Borland C++                     —>           cpp
  • Microsoft Visual C++      —>           cpp,cxx,cc
  • Anroid系统源码中的都以cc为后缀

从鱼跃龙门的随想

记得还在懵懵懂懂的年纪时,有好几波人跟我讲过一句长汀谚语:“捉鱼子过海”,比较有印象是某次跟燕生大哥一起喝茶的时候,好像他们在谈论一些关于银行贷款、买房子之类的事情,隐约记得是说:“某某家有权有势,他们的子弟去办点事情就像捉鱼子过海一样简单。”

最近将“鱼跃龙门”与“捉鱼子过海”结合起来看,这两个事情本质结果是一致的,都是通往了更高更大的平台。可从过程来看,这就完全不同了,前者更侧重的是不断提升和锻炼自身能力,使自身在激烈的竞争中脱颖而出;后者更突出的是外力的作用,从而达到一飞冲天的效果。至于到了更广阔的平台后,前后者能否通过自身能力筛选在后续竞争中有所不同,这个就不再纠结了。

有篇文章中提到这么一句话:三代人总有一代人要努力,要么你吃苦,要么你的孩子吃苦,要么你的父母继续为你吃苦。这个还真的不是什么鸡汤,完全是社会现实的写照。总有一代人是在默默充当垫脚石的作用,从垫脚石的观点出发看,捉鱼子过海的事情就不要心生妒忌了,总是他们父祖辈付出过异于常人的努力,才有了他们子弟今天的相对轻松。

想要摆脱这种困境,只有我们自己在当下不懈努力奋斗使自己成为垫脚石,未来我们的子弟也能让别人投出羡慕眼光,年轻人一起奋进吧~~

使用systemd启动服务

在实际运维工作中,我们经常会使用nohup与&结合来启动后台服务,也可能会使用到screen来启动后台服务,但在centos7后系统提供了systemd来管理后台服务。

之前我们是这样子来启动后台服务的:

nohup ./massminer --config conf/chia.json m2 > /dev/null 2>&1 &

看起来比较土一点,但是能解决实际运维问题。这里有几个麻烦的点,你需要重启服务时,必须跟kill命令一起结合指定目标pid才能完成。

使用systemd我们可以这样来定义后台服务,如下:

cat >/lib/systemd/system/massminer.service<<EOF
[Unit]
Description=Mass Miner
Documentation=https://www.massexplorer.org/
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/mass/massminer
ExecStart=/home/mass/massminer/massminer --config /home/mass/massminer/config.json m2 &
KillMode=process
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF

自定义后台服务后,希望systemctl马上能识别,可以通过如下命令进行重载:
systemctl daemon-reload
启动服务:
systemctl start massminer
关闭服务:
systemctl stop massminer
查看服务:
systemctl status massminer
使用systemd来管理后台服务后更加简洁方便。

node_exporter自定义监控项

在日常运维工作中,我们时常跟监控打交道,近些年监控平台从Zabbix往Prometheus转,这里跟容器业务应用得越来越多有比较大的关系。

node_exporter提供了很多基础的监控指标,如:CPU、内存、磁盘、网卡等;可实际工作中业务是多种多样的,总免不了定制一些自定义的监控指标,那如何在node_export中添加自定义监控项呢?

操作步骤:

1、自定义任务生成Prometheus可以识别的*.prom文件,格式为 key:value

root@Worker-10-12-213-205:~# cat /opt/apps/prometheus/scripts/mminer_process.sh
#!/bin/bash
curdate=$(date +%Y%m%d)
num=$(ps -ef |grep massminer |grep -v grep|wc -l)
num_w=$(ps -ef |grep masswallet |grep -v grep|wc -l)
poc_block=$(grep "block submitted via PoC miner accepted" /home/mass/massminer/logs/mass-${curdate}*.log | wc -l)
miner_count=$(grep -E '"find qualities for next block, waiting for proper slot" binding_count=([1-9]+)' /home/mass/massminer/logs/mass-${curdate}*.log | wc -l)
massminer_localbaseheight=$(/home/mass/massminer/massminercli --log_level error getclientstatus | jq ".localBestHeight" | bc -l)
massminer_knownbaseheight=$(/home/mass/massminer/massminercli --log_level error getclientstatus | jq ".knownBestHeight" | bc -l)
echo "masswallet_process ${num_w}" >> ${prom}
echo "#HELP poc_block read from /opt/apps/proetheus/node-exporter/mminer.prom" >> ${prom}
echo "#TYPE poc_block untyped" >> ${prom}
echo "poc_block ${poc_block}" >> ${prom}
echo "#HELP miner_count read from /opt/apps/proetheus/node-exporter/mminer.prom" >> ${prom}
echo "#TYPE miner_count untyped" >> ${prom}
echo "miner_count ${miner_count}" >> ${prom}
echo "#HELP massminer_localbaseheight read from /opt/apps/proetheus/node-exporter/mminer.prom" >> ${prom}
echo "#TYPE massminer_localbaseheight untyped" >> ${prom}
echo "massminer_localbaseheight ${massminer_localbaseheight}" >> ${prom}
echo "#HELP massminer_knownbaseheight read from /opt/apps/proetheus/node-exporter/mminer.prom" >> ${prom}
echo "#TYPE massminer_knownbaseheight untyped" >> ${prom}
echo "massminer_knownbaseheight ${massminer_knownbaseheight}" >> ${prom}
exit 0

2、定期执行自定义任务,如:crontab或程序自定义

root@Worker-10-12-213-205:~# crontab -l
*/1 * * * * /opt/apps/prometheus/scripts/mminer_process.sh

3、启动node_exporter时,通过–collector.textfile.directory指定*.prom所在目录

/opt/apps/prometheus/bin/node_exporter --web.listen-address=10.12.214.65:9100 --collector.textfile.directory=/opt/apps/prometheus/node-exporter/

正常完成这个步骤后,可以通过node_exporter的9100端口,就能查看已收集的指标。

做时间的朋友

时间是最无私的,最公平的;

不论你是否富有还是贫穷;

不论你是聪明还是愚昧;

不论你是珍惜还是浪费;

时间给每个人每天都是一样多,每天24小时共86400秒,一分不多一秒不少,隔天清零后重来,周而复始。

我们如何跟时间做朋友呢?怎么样更高效利用时间呢?一连串的问题复现在大脑中,好似风中的柳絮一样,不知该飘到哪个地方,乱后便烦很可能还影响了身边的人,这可能就是大家所说的:焦虑感

有时候停下来反思一段时间收获时,总会发现自己可能又浪费了一堆的时间在各种瞎忙活上,比如:发呆、酗酒、瞎聊、刷短视频、看网文等;在信息爆炸时代里,要是目标不明确,加上执行力不强的话,很容易迷失自己。(制定目标是做任何事情的关键

是否发现之前事情原来是不紧急。可对自己要求不严各种拖延后,发现都变成了紧急的,搞得自己各种烦躁,各种抱怨事情怎么就这么多?(执行力:制定工作计划并严格要求自己

有时候你想认真将某件事情完成时,可各种意外事件来打断原本的计划,如:临时会议、临时业务对接、疯狂的营销电话等;需要专注完成事情时,将手机静音放在一边,暂时关闭各种即时通讯工具,将所有的注意力放在待完成目标上。(强制专注屏蔽一切可能的打断

做好时间的朋友,适当焦虑感是必须的;

古人言:凡事预则立,不预则废;制定合理目标是完成任务的前提,强大执行力是完成目标的必要保障,减少各种干扰让我们聚焦目标的完成。