sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback
# Assgin static IP
iface eno16777736 inet static
address 192.168.81.222 #change to your static IP
netmask 255.255.255.0 #change to your netmask
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import math | |
| def GetDayOf(st): | |
| #-天干名称 | |
| cTianGan = ["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] | |
| #-地支名称 | |
| cDiZhi = ["子","丑","寅","卯","辰","巳","午", "未","申","酉","戌","亥"] | |
| #-属相名称 |
sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback
# Assgin static IP
iface eno16777736 inet static
address 192.168.81.222 #change to your static IP
netmask 255.255.255.0 #change to your netmask
| /** | |
| * native2ascii.exe Java code implementation. | |
| * | |
| * @author | |
| * @version 1.0 | |
| */ | |
| public class Native2Ascii { | |
| /** | |
| * prefix of ascii string of native character |
| ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' |
| /** | |
| * | |
| * @Title: getWeekDays | |
| * @Description: 通过给定日期返回所在周的起止日期 | |
| * @return List | |
| * @throws | |
| */ | |
| public static List<Date> getWeekDays(Date arg){ | |
| List list = new ArrayList(); | |
| Calendar cal = Calendar.getInstance(); |
| # 创建一个bucket的instance | |
| >>> from sae.storage import Bucket | |
| >>> bucket = Bucket('t') | |
| >>> # 创建该bucket | |
| >>> bucket.put() | |
| >>> # 修改该bucket的acl和缓存过期时间。 | |
| >>> bucket.post(acl='.r:.sinaapp.com,.r:sae.sina.com.cn', metadata={'expires': '1d'}) |
| import web | |
| import json | |
| class index: | |
| def GET(self): | |
| pyDict = {'one':1,'two':2} | |
| web.header('Content-Type', 'application/json') | |
| return json.dumps(pyDict) |
| ## str转list | |
| str='x7tQ3' | |
| lst = list(str) | |
| print lst | |
| ## ['x', '7', 't', 'Q', '3'] | |
| ## list转str | |
| str = ''.join(lst) | |
| print str | |
| ## x7tQ3 |
| <script> | |
| function randomNum(min,max) | |
| { | |
| var range = max - min; | |
| var rand = Math.random(); | |
| return(min + Math.round(rand * range)); | |
| } | |
| function randomStr(len){ | |
| var ret = ""; | |
| var abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; |
| >>> unicode(u'谷歌.cn').encode('idna') | |
| 'xn--flw351e.cn' | |
| >>> unicode('xn--flw351e.cn').decode('idna') | |
| u'\u8c37\u6b4c.cn' | |
| ## Not support narow Python | |
| ## Cause `ValueError: unichr() arg not in range(0x10000) (narrow Python build)` | |
| >>> b'ls8h'.decode('punycode') | |
| '\U0001f4a9' |