Skip to content

Instantly share code, notes, and snippets.

@payshangjj
payshangjj / waya-dl-setup.sh
Created May 27, 2017 15:18 — forked from mjdietzx/waya-dl-setup.sh
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get install cuda
@payshangjj
payshangjj / run_fio.sh
Created January 23, 2017 05:26 — forked from sennajox/run_fio.sh
A script that runs fio test and genearates a simple result for each jobs
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev output_dir [iodepth]"
echo "example 1: Testing the whole block device. Attention: That will destory the filesystem on the target block device"
echo "./run_fio.sh /dev/sdb fio_test"
echo ""
echo "example 2: Testing a file, but not destory filesystem. Suppose the target device mount on /data"
echo "fallocate -l 1G /data/test.dat"
echo "./run_fio.sh /data/test.dat fio_test"
from SimpleXMLRPCServer import SimpleXMLRPCServer
def add(x, y):
return x + y
if __name__ == '__main__':
s = SimpleXMLRPCServer(('127.0.0.1', 8080))
s.register_function(add)
s.serve_forever()
s是一个绑定了本地8080端口的服务器对象,register_function()方法将函数add注册到s中。serve_forever()启动服务器。
from SimpleXMLRPCServer import SimpleXMLRPCServer
def add(x, y):
return x + y
if __name__ == '__main__':
s = SimpleXMLRPCServer(('127.0.0.1', 8080))
s.register_function(add)
s.serve_forever()
s是一个绑定了本地8080端口的服务器对象,register_function()方法将函数add注册到s中。serve_forever()启动服务器。
@payshangjj
payshangjj / Ansible
Last active January 21, 2017 15:15
Ansible
批量推送ssh密钥,设置免密登录
ansible test -m authorized_key -a "user=pe key='{{ lookup('file', '/home/pe/.ssh/id_rsa.pub') }}' path=/home/pe/.ssh/authorized_keys manage_dir=no"
ansible test -m authorized_key -a "user=root key='{{ lookup('file', '/root/.ssh/id_rsa.pub') }}' path=/home/pe/.ssh/authorized_keys manage_dir=no"
生成CMDB页面
ansible -i ip_list_file "172.*" -m setup --tree out/ -k -a ""filter=ansible_local""
ansible-cmdb -i ip_list_file "*" out/ >/export/yulei/software/redis-monitor/src/www/cmdb.html
lineinfile 模块:
vars: