git 统计一段时间内提交的代码行数

代码:

 git log --author="obaby" --after="2019-08-04 00:00:01" --before="2019-08-10 12:00:00"
 --pretty=tformat: --numstat | grep -v 'static'  |
 gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "增加行数:%s 删除行数:%s 变化总行数:%s\n",add,subs,loc }'
参数说明:
--author 作者 提交者
--after 开始时间
--before 结束时间
--pretty 格式

上面的代码依赖于linux windows下运行可以使用cgywin 或者mobaxterm,https://mobaxterm.mobatek.net

MobaXterm is your ultimate toolbox for remote computing. In a single Windows application, it provides loads of functions that are tailored for programmers, webmasters, IT administrators and pretty much all users who need to handle their remote jobs in a more simple fashion.

MobaXterm provides all the important remote network tools (SSH, X11, RDP, VNC, FTP, MOSH, …) and Unix commands (bash, ls, cat, sed, grep, awk, rsync, …) to Windows desktop, in a single portable exe file which works out of the box.

There are many advantages of having an All-In-One network application for your remote tasks, e.g. when you use SSH to connect to a remote server, a graphical SFTP browser will automatically pop up in order to directly edit your remote files. Your remote applications will also display seamlessly on your Windows desktop using the embedded X server

systemd 运行celery

However, the init.d script should still work in those Linux distributions as well since systemd provides the systemd-sysv compatiblity layer which generates services automatically from the init.d scripts we provide.

官网已经有了相关的教程http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#usage-systemd, 但是在实际操作的时候发现按照教程来配置无法正常启动。会报错,于是把服务简化了一下,把配置和服务信息写到了一起。如果你也遇到这个问题可以尝试下面的简化脚本:

[Unit]
Description=Celery Service
After=network.target

[Service]
WorkingDirectory=/var/www/html
ExecStart=/usr/local/bin/celery -A proj worker --logfile=/var/log/celery/celery.log  --loglevel="INFO"

Restart=on-failure

#3秒后启动
RestartSec=3s

[Install]
WantedBy=multi-user.target

系统Ubuntu 18.04, systemd版本:

root@mars:/etc/systemd/system# systemctl --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP 
+GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

阿里云蛋疼的pip

qq20161103-1

阿里云的主机确实蛋疼,连pip都更新不了也是醉了。参考这个帖子的办法,修改更新服务器吧:

 
mkdir ~/.pip
cat > ~/.pip/pip.conf < < EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
EOF

Ubuntu 14.04 Pycharm 桌面快捷方式

QQ截图20160331152917

网上关于ubuntu安装pycharm的文章最后的桌面图标的创建都千篇一律,可能很多人压根都没试试到底能不能用。这里贴个能用的图标代码:

 

#!/usr/bin/env xdg-open

[Desktop Entry]
Categories=Development;
Comment[zh_CN]=
Comment=
Exec=/home/obaby/soft/pycharm-2016.1/bin/pycharm.sh %f
GenericName[zh_CN]=IDE
GenericName=IDE
Icon=/home/obaby/soft/pycharm-2016.1/bin/pycharm.png
MimeType=
Name[zh_CN]=PyCharm
Name=PyCharm
Path=
StartupNotify=true
Terminal=false
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=obaby

Android APK installer for Windows/Linux/Mac OSX

apk

其实想写这么个东西是很久之前的想法了,那时候还在厦门,还没有回到山东,很多的东西也不是现在的样子。很多的东西总是充满了变数和无奈,很多的东西也在自然不自然的过程中到了现在的样子。而至于这个东西也只是简单的说几句吧,基于pyqt开发,目标是跨平台运行在Windows ,Linux,Mac OSX下。现在已经能够在windows下正常使用了,另外mac和linux下的pyqt安装略麻烦一点,网络也不咋地所以还没测试。需要完成的代码还有apk关联,另外启动的时候在不同的环境下可能出现黑框,看起来很蛋疼,在找找原因吧,时机合适了开放源码。