This file contains 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
def read_contcar(contcar_path): | |
''' | |
read data from contcar file | |
return coordiante_array and atom_list | |
Target: 需要读取 原子种类, 原子坐标, 晶胞参数 | |
return: | |
lattice (a. b. c) | |
atom, x, y, z, tf_x, tf_y, tf_z | |
''' | |
with open(contcar_path, 'r') as f: |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
# -*- coding: utf-8 -*- | |
# @Date : 2017-03-14 22:03:55 | |
# @Author : "zhangjiawei" | |
# @Email : "[email protected]" | |
# @Link : ${https://github.com/jwz-ecust} | |
# @Version : $Id$ | |
from goose import Goose | |
from goose.text import StopWordsChinese |
This file contains 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
# -*- coding:utf-8 -*- | |
import re | |
IDCARD_REGEX = '[1-9][0-9]{14}([0-9]{2}[0-9X])?' | |
# 新身份证18位, 最后一位可能是X; 老身份证15位 | |
def is_valid_idcard(idcard): | |
"""Validate id card is valid.""" | |
if isinstance(idcard, int): |
This file contains 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
import paramiko | |
import os | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
IP = "***********" | |
# port = 22 | |
# user = "riic" | |
# key = "/Users/zhangjiawei/.ssh/id_dsa_138_jwzhang.jwzhang" |
This file contains 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
class zjw(): | |
def __init__(self): | |
self.name = 1 | |
@classmethod | |
def classmethod(cls, arg): | |
print dir(cls) | |
print cls | |
print dir(arg) | |
print arg |
This file contains 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
from collections import Counter | |
from collections import defaultdict | |
def solution(A): | |
c = Counter(A) | |
repeat = [i for i in c if c[i] > 1] | |
ddict = defaultdict(list) | |
for i in range(len(A)): | |
ddict[A[i]].append(i) | |
dis = [max(ddict[i]) - min(ddict[i]) for i in ddict if len(ddict[i]) > 1] |
This file contains 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
import requests | |
import re | |
url = "http://muchong.com/bbs/logging.php?action=login" | |
sess = requests.session() | |
# 构建headers | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) \ | |
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 \ |
This file contains 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
import os | |
import sys | |
from glob import glob | |
from ase.io import read, write | |
from ase import Atoms | |
import numpy as np | |
from ase.utils import natural_cutoffs | |
from ase.build import molecule | |
import matplotlib.pyplot as plt |
This file contains 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
import os | |
import sys | |
from glob import glob | |
from ase.io import read, write | |
from ase import Atoms | |
import numpy as np | |
from ase.utils import natural_cutoffs | |
from ase.build import molecule | |
import matplotlib.pyplot as plt |
OlderNewer