11 2019 档案
摘要:#include <iostream> #include <algorithm> #include <string> #include <vector> int main() { std::string str; while(std::cin>>str) { std::vector<char> v_
阅读全文
摘要:#!/bin/bash cat iplist | while read ip username do printf "${ip}, ${username}, " eval $(ssh -q ${ip} "awk -v user_name=$username -F':' '\$0 ~ user_nam
阅读全文
摘要:prochapawd.sh #!/usr/bin/expect set timeout 5 set ipaddress [lindex $argv 0] set username [lindex $argv 1] set newpassword [lindex $argv 2] spawn ssh
阅读全文
摘要:- hosts: myjob gather_facts: True vars: IP: "{{ ansible_default_ipv4['address'] }}" HOST_NAME: "{{ ansible_hostname }}" OS: "{{ ansible_distribution }
阅读全文
摘要:统计cpu和内存一个月的平均使用率: #!/bin/bash totalcpu_rate=0.0 totalmem_rate=0.0 num_days=$(ls -l /var/log/sa/sa[0-3]* | wc -l) echo $num_days for file in /var/log/
阅读全文
摘要:- hosts: myjob gather_facts: false tasks: - name: chage user passwd user: name={{ item.name }} password={{ item.chpass | password_hash('sha512') }} up
阅读全文
摘要:{ if(NR % 2 == 0) printf("%s\n", $0) else printf("%s, ", $1) } awk -f awk.awk data
阅读全文
摘要:#include <iostream> #include <vector> int main() { enum {size = 4}; std::vector<int> num(size); size_t i=0; while(std::cin>>num.at(i++)) { if(i == siz
阅读全文
摘要:#include <iostream> int main() { int num; while(std::cin>>num) { int mod, left, sum=0; left = num % 3; while(num/3) { mod = num / 3; left = num % 3; s
阅读全文
摘要:#include <iostream> #include <string> #include <cmath> int main() { std::string hex; while(std::cin>>hex) { int sum=0, flag=0; for(std::string::const_
阅读全文
摘要:#include <iostream> #include <set> int main() { int n; std::set<int> i_set; while(std::cin>>n) { i_set.clear(); int data_in; for(size_t i=0; i<n; ++i)
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> int main() { int N, M; while(std::cin>>N>>M) { std::vector<int> v_data; v_data.clear(); for
阅读全文