Skip to content

Instantly share code, notes, and snippets.

View jwz-ecust's full-sized avatar
:shipit:
=。=

jwzhang jwz-ecust

:shipit:
=。=
View GitHub Profile
@jwz-ecust
jwz-ecust / vasp.script
Created August 6, 2020 09:17
vasp.script
#! /bin/bash
#SBATCH --nodes=$${nodes}
#SBATCH --ntasks=$${ntasks}
#SBATCH --ntasks-per-node=$${ntasks_per_node}
#SBATCH --cpus-per-task=$${cpus_per_task}
#SBATCH --gres=$${gres}
#SBATCH --qos=$${qos}
#SBATCH --time=$${walltime}
#SBATCH --partition=$${queue}
#SBATCH --account=$${account}
@jwz-ecust
jwz-ecust / my_qadapter.yaml
Last active August 6, 2020 09:14
my_qadapter.yaml
_fw_name: CommonAdapter
_fw_q_type: SLURM
rocket_launch: rlaunch -c /home/catml/atomate/config rapidfire
nodes: 1
ntasks: 48
walltime: '1680:00:00'
queue: null
account: null
job_name: null
pre_rocket: null
@jwz-ecust
jwz-ecust / WorkFunctionPlot.py
Last active November 5, 2019 07:17
WorkFunctionPlot
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pymatgen.analysis.surface_analysis import WorkFunctionAnalyzer
plt.figure(figsize=(20, 15))
kwargs = {
"poscar_filename": './CONTCAR',
@jwz-ecust
jwz-ecust / traj2pov.py
Last active August 31, 2019 02:10
ase traj to pov input
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
@jwz-ecust
jwz-ecust / traj2pov.py
Created August 31, 2019 02:09
ase traj to pov input
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
@jwz-ecust
jwz-ecust / getmuchongcredit.py
Created August 15, 2017 16:41
木虫金币自动领取
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 \
@jwz-ecust
jwz-ecust / python
Created July 11, 2017 08:48
计算相距最远的两个相等元素
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]
@jwz-ecust
jwz-ecust / test.py
Created April 11, 2017 02:30
decorator
class zjw():
def __init__(self):
self.name = 1
@classmethod
def classmethod(cls, arg):
print dir(cls)
print cls
print dir(arg)
print arg
@jwz-ecust
jwz-ecust / paramiko_download_linux.py
Last active March 24, 2017 02:43
paramiko download from linux server
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"
@jwz-ecust
jwz-ecust / identifyid.py
Created March 22, 2017 01:17
身份证验证
# -*- 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):