Skip to content

Instantly share code, notes, and snippets.

View nettedfish's full-sized avatar
💭
I may be slow to respond.

nettedfish nettedfish

💭
I may be slow to respond.
View GitHub Profile
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
mysqladmin -P__port__ -umon -ppass -h127.0.0.1 -r -i 2 extended-status |awk -F "|" 'BEGIN { count=0; } { if($2 ~ /Variable_name/ && ++count%15 == 1){print "----------|---------|--- MySQL Command Status --|----- Innodb row operation -----|-- Buffer Pool Read --"; print "---Time---|---QPS---|select insert update delete| read inserted updated deleted| logical physical";} else if ($2 ~ /Queries/){queries=$3;} else if ($2 ~ /Com_select /){com_select=$3;} else if ($2 ~ /Com_insert /){com_insert=$3;} else if ($2 ~ /Com_update /){com_update=$3;} else if ($2 ~ /Com_delete /){com_delete=$3;} else if ($2 ~ /Innodb_rows_read/){innodb_rows_read=$3;} else if ($2 ~ /Innodb_rows_deleted/){innodb_rows_deleted=$3;} else if ($2 ~ /Innodb_rows_inserted/){innodb_rows_inserted=$3;} else if ($2 ~ /Innodb_rows_updated/){innodb_rows_updated=$3;} else if ($2 ~ /Innodb_buffer_pool_read_requests/){innodb_lor=$3;} else if ($2 ~ /Innodb_buffer_pool_reads/){innodb_phr=$3;} else if ($2 ~ /Uptime / && count >= 2){ printf(" %s |%9d
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@nettedfish
nettedfish / q-check-redis-server-status
Last active December 22, 2015 23:39
模仿percona的nagios监控插件,实现一个简单的redis服务状态监控插件,判断redis服务器是否存活,是否因为未知原因自动重启过
#!/bin/bash
# ########################################################################
# This program is part of Qunar Monitoring Plugins
# Authors: yinggang.zhao@qunar.com
# ########################################################################
# ########################################################################
# Redirect STDERR to STDOUT; Nagios doesn't handle STDERR.
# ########################################################################
@nettedfish
nettedfish / go.sh
Last active December 14, 2015 01:09
方便你登陆服务器
#!/bin/bash
read -p "请输入6位token动态密码: " token
sshcmd='ssh -o StrictHostKeyChecking=no -o NumberOfPasswordPrompts=1 -o ConnectTimeout=2'
online_login_ssh (){
expect -c "set timeout -1;
spawn -noecho $sshcmd -tt $1
expect "*password*";
send -- 这儿是一长串密码,注意保留本行末尾的3个字符\r;
expect "*PASSCODE*";
#token的可变部分