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 SparkStreaming; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
import org.apache.spark.SparkConf; | |
import org.apache.spark.SparkContext; |
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
public class IOUtils { | |
/** | |
* 解压缩本地文件到hdfs。 | |
* @param srcPath | |
* @param tgtPath | |
*/ | |
public static void gzipFileToHdfs(String srcPath,String tgtPath){ | |
Configuration conf=new Configuration(); | |
GzipCodec zip=new GzipCodec(); |
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
awk -f file.dat.awk file.dat > new_file.dat | |
## file.dat.awk | |
begin | |
{ | |
print substr($0,1,254)"**************""*****"substr($0,19) | |
} | |
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
dbaccess etl_db<<! | |
call test1(); | |
! |
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 hadoopDemo; | |
import java.io.File; | |
import java.net.URL; | |
import org.apache.avro.Protocol; | |
import org.apache.avro.generic.GenericData; | |
import org.apache.avro.generic.GenericRecord; | |
import org.apache.avro.ipc.HttpTransceiver; | |
import org.apache.avro.ipc.Transceiver; |
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 hadoopDemo; | |
import java.io.File; | |
import org.apache.avro.Protocol; | |
import org.apache.avro.Protocol.Message; | |
import org.apache.avro.generic.GenericData; | |
import org.apache.avro.generic.GenericRecord; | |
import org.apache.avro.ipc.HttpServer; | |
import org.apache.avro.ipc.Server; |
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 hadoopDemo; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import org.apache.avro.Schema; | |
import org.apache.avro.file.DataFileReader; | |
import org.apache.avro.file.DataFileWriter; | |
import org.apache.avro.generic.GenericData; |
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
# -*- coding:utf-8 -*- | |
from datetime import datetime | |
class Get(object): | |
""" | |
Lazy value calculate for object | |
""" | |
def __init__(self, getter): | |
self.getter = getter |
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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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 requests | |
import eventlet | |
eventlet.monkey_patch() | |
with eventlet.Timeout(10): | |
requests.get("http://ipv4.download.thinkbroadband.com/1GB.zip", verify=False) | |
##### r = requests.get("get("http://ipv4.download.thinkbroadband.c", verify=False, timeout=10) | |
NewerOlder