CentOS 7 上新建通过HTTPS访问的Git Server

1. 安装Fastcgiwrap

 

yum install fcgi-devel spawn-fcgi

git clone git://github.com/gnosek/fcgiwrap.git

cd fcgiwrap

autoreconf -i

./configure

make

make install

vi /etc/init.d/fcgiwrap

#! /bin/sh
# chkconfig: 2345 55 25
DESC="fcgiwrap daemon"
DEAMON=/usr/bin/spawn-fcgi
PIDFILE=/var/run/spawn-fcgi.pid
FCGI_SOCKET=/var/run/fcgiwrap.socket
FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
FCGI_USER=www
FCGI_GROUP=www
FCGI_EXTRA_OPTIONS="-M 0770"
OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P $PIDFILE -- $FCGI_PROGRAM"
do_start() {
 $DEAMON $OPTIONS || echo -n "$DESC already running"
}
do_stop() {
 kill -INT `cat $PIDFILE` || echo -n "$DESC not running"
}
case "$1" in
 start)
  echo -n "Starting $DESC: $NAME"
  do_start
  echo "."
  ;;
 stop)
  echo -n "Stopping $DESC: $NAME"
  do_stop
  echo "."
  ;;
 restart)
  echo -n "Restarting $DESC: $NAME"
  do_stop
  do_start
  echo "."
  ;;
 *)
  echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
  exit 3
  ;;
esac
exit 0

start fcgiwrap

nginx.conf

location ~ /git(/.*) {
    auth_basic "Restricted";
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
    auth_basic_user_file /etc/nginx.passwd;
    include       fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
    fastcgi_param GIT_PROJECT_ROOT    /var/git-repos;
    fastcgi_param GIT_HTTP_EXPORT_ALL true;
    fastcgi_param PATH_INFO           $1;
    fastcgi_param REMOTE_USER $remote_user;

 

cd /var/git-repos
git init --bare my-project.git
htpasswd -c /etc/nginx.passwd user1

restart nginx

git clone https://www.xiaohui.org/git/my-project.git

 

 

 

 

 

 

 

http://qiita.com/egnr-in-6matroom/items/2a052339ee0515b31fdf

2015的最后一天

2015的最后一天,公司里稍显平静,不少人已经提前请假过元旦了。

回想下这一年忙了些什么,思绪万千,学业上研究生是最后一年,工作上考了项目管理专业上的PMP认证和信息系统项目管理师,英文学习上感觉进步不大。家庭上,女儿的教育方面思路清晰了一些,但又没有太多时间来完全实践。同时忙于多件事情,经常是每件事情都没有办法投入很多时间,都做不到自己满意的程度。

认真总结起来这一年,只好说两个字“瞎忙”

Organizational Behavior 15th edition, Chapter 1 What is Organizational behavior

 

Effective versus Successful Managerial Activities

Fred Luthans and his associates looked at what managers do from a somewhat different perspective. 9 They asked, “Do managers who move up the quickest in an organization do the same activities and with the same emphasis as managers who do the best job?” You might think the answer is yes, but that’s not always the case.
Luthans and his associates studied more than 450 managers. All engaged in
four managerial activities:

1. Traditional management. Decision making, planning, and controlling.
2. Communication. Exchanging routine information and processing paperwork.
3. Human resource management. Motivating, disciplining, managing conflict, staffing, and training.
4. Networking. Socializing, politicking, and interacting with outsiders.

allocation of activites by time

The “average” manager spent 32 percent of his or her time in traditional management activities, 29 percent communicating, 20 percent in human resource management activities, and 19 percent networking. However, the time and effort different individual managers spent on those activities varied a great deal. As shown in Exhibit 1-2 , among managers who were successful (defined in terms of speed of promotion within their organization), networking madethe largest relative contribution to success, and human resource management activities made the least relative contribution. Among effective managers (defined in terms of quantity and quality of their performance and the satisfaction and commitment of employees), communication made the largest relative contribution and networking the least. More recent studies in Australia,Israel, Italy, Japan, and the United States confirm the link between networking and social relationships and success within an organization. 10 And the connection between communication and effective managers is also clear. A study of 410 U.S. managers indicates those who seek information from colleagues and employees—even if it’s negative—and who explain their decisions are the most effective. 11

This research offers important insights. Successful managers give almost the opposite emphases to traditional management, communication, human resource management, and networking as do effective managers. This finding challenges the historical assumption that promotions are based on performance, and it illustrates the importance of networking and political skills in getting ahead in organizations.

 

博客从Linode搬到了HOSTUS

这个博客搬家了好多次。今天有从Linode搬到了HOSTUS,开了几次PPTP的VPN,然后貌似被GFW盯上了,狂丢包,找Linode申请换了IP,是好了,但是想想Linode 10刀一个月,是有点贵。索性就换到了HOSTUS的HK节点。速度也不错。配置也够用,关键还比价便宜,35刀一年。装了shadowsocks,翻墙速度还不错。就不装PPTP vpn了,HOSTUS有个不好的是不给换IP,给GFW盯上就废了。

趁着这次搬迁,顺便调整了一下各个应用的版本和配置。。

  • Nginx升级到了1.9.7
  • 全站强制SSL
  • 支持 HSTS (HTTP Strict Transport Security)
  • 支持 Certificate Transparency
  • 支持OCSP Stapling(Online Certificate Status Protocol)
  • 启用了HTTP 2.0,也兼容HTTP 1.1
  • 去掉对不安全SSL协议和Cipher的支持
  • PHP升级到5.6.15
  • 启用了Xcache
  • 免费SSL证书提供商从Startssl.com 换到了letsencrypt.org
  • DNS Server从dnspod换回了Godaddy
  • WordPress上用Updraftplus 每日将数据备份到Google Drive

Synology DSM 5.2上编译Shadowsocks-libev

Shadowsocks的python版本现在已经不再维护,万幸的是Shadowsocks-libev还在更新,而且编译后资源消耗更少。所以打算更新版本,但是搜了半天,只用适用于Openwrt的Shadowsocks-libev。而且安装包是IPK的。没办法直接安装,所以只好自己编译。

环境

NAS:

Model:Synology DS214+, CPU:Marvell Armada XP, OS: DSM 5.2

编译服务器:

Aliyun服务器,Centos 6.5 32Bit ,1CPU 1G RAM

准备

  1. 下载与DSM版本相匹配的Toolchain进行Cross-compiling

NAS上没办法进行程序编译,缺少编译环境,需要在一台Linux服务器上进行Cross-compiling,需要注意的是一定要是32位的操作系统。

前往Synology Open Source Project (http://sourceforge.net/projects/dsgpl/files/) 下载。

进入DSM 5.2 toolchain,而后根据CPU类型为Armada XP进入子目录。下载

armadaxp-gcc464_glibc215_hard_armada-GPL.txz

输入以下命令进行解压:

tar xvf armadaxp-gcc464_glibc215_hard_armada-GPL.txz --use-compress-program xz

解压后得到目录arm-marvell-linux-gnueabi

新建一环境变量文件 toolchain.env

export CC=/root/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-gcc
export LD=/root/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-ld
export RANLIB=/root/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-ranlib
export CFLAGS=”-I/root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/include -mhard-float -mfpu=vfpv3-d16″
export LDFLAGS=”-L/root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/lib”

Shadowsocks需要zlib和OpenSSL,我们需要先编译zlib和OpenSSL的Arm版本。

wget http://zlib.net/zlib-1.2.8.tar.gz

tar zxvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

source /root/toolchain.env

./configure –prefix=/root/zib4arm

make

make install

cp zlib.h zconf.h /root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/include

cp libz.so.1.2.8 /root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/lib/libz.so

Compile openssl for ARM

wget https://www.openssl.org/source/openssl-0.9.8zg.tar.gz

tar zxvf openssl-0.9.8zg.tar.gz

./Configure  dist –prefix=/root/openssl2

make

make install

cd /root/openssl2

cp -r include/openssl /root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/include

cp lib/libcrypto.a lib/libssl.a /root/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/lib

 

编译shadowsocks-libev

git clone https://github.com/shadowsocks/shadowsocks-libev.git
cd shadowsocks-libev

./configure –host=armle-unknown-linux –target=armle-unknown-linux –build=”i686-pc-linux” –prefix=/root/ssforarm

make

make install

编译好的shadowsocks会在/root/ssforarm文件夹。

将ssforarm文件夹的四个文件夹打包传到Nas的/usr/local目录下的同名目录即可。。

启动ss-redir.

设置下iptables.就可以畅快上网了。

iptables -t nat -A PREROUTING -p tcp -d 8.8.0.0/16 -j REDIRECT –to-ports 1080