This file contains hidden or 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
| #!/bin/bash | |
| PATH=/bin:/sbin:/usr/bin:/usr/sbin | |
| export PATH | |
| if [ ! -f "/etc/fstab.bak" ]; then | |
| # 备份分区表 | |
| echo "cp /etc/fstab /etc/fstab.bak" | |
| fi | |
| echo "echo Start finding disk drives ...... !" |
This file contains hidden or 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
| # http://dongwm.blog.51cto.com/2621371/781099 | |
| #!/usr/bin/expect #设置解析器 | |
| set timeout 10 #设置超时时间 | |
| set password1089 ***** | |
| set passwordvps ***** | |
| set passwordkvm26 ***** | |
| set password4150 ***** #以上密码我隐藏了 | |
| set file1 [lindex $argv 0] #程序第一个参数 |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| """ | |
| @File: map-shuff-reduce.py | |
| @Author: Hao Tan | |
| @Date: | |
| @Email: tanhao2013@foxmail.com | |
| @Desc: | |
| """ |
This file contains hidden or 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 gcd_bruteforce(m,n): | |
| l = min(m,n) | |
| gcd = 0 | |
| for x in xrange(1,l): | |
| if m % x == 0 and n % x == 0: | |
| gcd = x | |
| return gcd | |
| def gcd_euclidean(m,n): | |
| l = n % m |
This file contains hidden or 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
| ### corbar 添加查看表 | |
| #!/bin/bash | |
| if [ $# != 3 ]; then | |
| echo "Usage: sh $0 old.sql table_num table_name|sh" | |
| echo "Example: sh job.sh old.sql 8 docdb" | |
| echo " old.sh: 每张表要添加的sql语句" | |
| echo " table_num: 每个ip有多少张表 [8]" | |
| echo " table_name: 每张表的名字 [docdb]" | |
| exit | |
| fi |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| @File: cmd.py | |
| @Author: Hao Tan | |
| @Date: 2014-12-06 | |
| @Email: tanhao2013@foxmail.com | |
| @Desc: A short script for stop and start cluster in patch. | |
| """ |
This file contains hidden or 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
| CREATE TABLE `refGene` ( | |
| `bin` smallint(5) unsigned NOT NULL, | |
| `name` varchar(255) NOT NULL, | |
| `chrom` varchar(255) NOT NULL, | |
| `strand` char(1) NOT NULL, | |
| `txStart` int(10) unsigned NOT NULL, | |
| `txEnd` int(10) unsigned NOT NULL, | |
| `cdsStart` int(10) unsigned NOT NULL, | |
| `cdsEnd` int(10) unsigned NOT NULL, | |
| `exonCount` int(10) unsigned NOT NULL, |
This file contains hidden or 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 Data::Dumper; | |
| while (<>) { | |
| my @tmp = split(/\s+/,$_); | |
| my $head = join("\t",@tmp[0,1,2,3]); | |
| my $end = &store_hash($tmp[9],$tmp[10]); | |
| my @key = sort {$a <=> $b} keys (%$end); | |
| foreach my $x (@key) { | |
| my $last = $end->{$x}; | |
| print "$head\t$x\t$last\n"; |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import socket, fcntl, struct | |
| def get_hostname(): | |
| return socket.gethostname() | |
| def get_local_ip(ifname = 'eth0'): | |
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| inet = fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15])) |
This file contains hidden or 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
| /** | |
| * 判断一个字符是否emoji表情字符 | |
| * | |
| * @param ch | |
| * 待检测的字符 | |
| */ | |
| public static boolean isEmoji(char ch) { | |
| return !((ch == 0x0) || (ch == 0x9) || (ch == 0xA) || (ch == 0xD) | |
| || ((ch >= 0x20) && (ch <= 0xD7FF)) | |
| || ((ch >= 0xE000) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0x10FFFF))); |