This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz | |
tar -xvJf Python-3.5.1.tar.xz | |
.configure | |
make | |
make install | |
python | |
此时已经安装python 3.5.1,但是在命令行中输入python的时候还是原来的版本 | |
另一个比较好的解决方法是使用pythonbrew工具 | |
$ python -V |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
网络字节顺序是TCP/IP中规定好的一种数据表示格式,它与具体的CPU类型、操作系统等无关,从而可以保证数据在不同主机之间传输时能够被正确解释。网络字节顺序采用big endian排序方式。 | |
为了进行转换 bsd socket提供了转换的函数 有下面四个 | |
htons 把unsigned short类型从主机序转换到网络序 | |
htonl 把unsigned long类型从主机序转换到网络序 | |
ntohs 把unsigned short类型从网络序转换到主机序 | |
ntohl 把unsigned long类型从网络序转换到主机序 | |
在使用little endian的系统中 这些函数会把字节序进行转换 | |
在使用big endian类型的系统中 这些函数会定义成空宏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://eli.thegreenplace.net/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getSum(int a, int b) { | |
int sum = a; | |
while (b != 0) | |
{ | |
sum = a ^ b;//calculate sum of a and b without thinking the carry | |
b = (a & b) << 1;//calculate the carry | |
a = sum;//add sum(without carry) and carry | |
} | |
return sum; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\u@\h:# " | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu | |
# add-apt-repository: command not found | |
# 查看Ubuntu版本 | |
cat /etc/issue | |
# For Ubuntu 14.04 or 16.04 you need another package: | |
apt-get install software-properties-common | |
# If you are using an older release of Ubuntu, ie before 12.10, it is necessary to install the package python-software-properties | |
sudo apt-get install python-software-properties | |
add-apt-repository ppa:webupd8team/java |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unofficial Windows Binaries for Python Extension Packages | |
http://www.lfd.uci.edu/~gohlke/pythonlibs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'zhangzhiqiang' | |
import requests | |
import re | |
from collections import defaultdict | |
from pprint import pprint | |
from urllib.parse import quote, urlencode, urlparse, urlunparse | |
from bs4 import BeautifulSoup as bs | |
login_url = "http://vls3.zzu.edu.cn/vls2s/zzjlogin.dll/login" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, temporarily add a known DNS server to your system. | |
echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null | |
Then run sudo apt-get update. | |
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you | |
(or just contact your ISP) - or you can permanently add a DNS server to your system: | |
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null | |
8.8.8.8 is Google's own DNS server |