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
time tar zxvf weather.tz -O 2>&1 | awk '{if(substr($2,0,4)>=1996){a=$1" "substr($2,0,7);split($3,max,":");split($4,min,":");arr[a]+=max[2]-min[2];num[a]+=1}}END{for(i in arr) print i,arr[i]/num[i]}' | awk '{if(max[$1]<$3){max[$1]=$3;date[$1]=$2;} else if(max[$1]==$3){date[$1]=date[$1]" "$2}}END{for(i in max) print i,date[i],max[i]}' > res |
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 -*- | |
"""计算各大城市温差最大的月份 | |
@author:linyi | |
""" | |
from __future__ import division | |
from sys import argv | |
city_month={} |
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
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
public class OuterClass { | |
private static int x = 0; | |
private int y = 0; | |
//非static内部类 |
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 | |
#=================================== | |
#按split分割文件,并发处理,提高效率 | |
#=================================== | |
##默认分割为3份 | |
split=3 | |
if [ $2 ]; then | |
split=$2 |
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/python | |
# -*- coding:utf-8 -*- | |
import random | |
devs=[ | |
'临意','凤豪','不罕','乞儿','千宜', | |
'容若','少夕','少符','本相','盈轩', | |
'苓心','青树','黑崎','卜巨','平威', | |
'承泽','条子','畅博' |
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
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
/** | |
* 一种本地缓存的无锁实现思路 | |
* 适用场景:预先知道的需要缓存的一批数据,比如卖家品牌授权,馆信息,达人信息 | |
* 数据更新不太频繁,定时更新或者更新由自己手动控制 | |
*/ | |
public abstract class AbstractLocalCache<K, V> { |
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
package pattern; | |
import java.util.Observable; | |
import java.util.Observer; | |
public class ObserverExample { | |
public static void main(String[] args) { |