Skip to content

Instantly share code, notes, and snippets.

@DecKen
DecKen / ServiceLoader.java
Created September 22, 2018 12:44
spark 2.2中的的spi服务实现
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
@DecKen
DecKen / settings.xml
Last active October 12, 2015 03:20
maven的开源中国镜像配置文件, 复制到.m2的根目录即可
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
you under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
@DecKen
DecKen / tran_ip_num
Created March 28, 2015 13:30
ip数值化转换
import socket
import struct
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr):
return socket.inet_ntoa(struct.pack("!I", addr))
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def test(string):
u"""
>>> test(u"Hello")
u'Hello'
>>> test(u"你好")
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from urlparse import urljoin
from pyquery import PyQuery as pq
url = "http://www.szeros-wedding.com/html/service/804.html"
area = pq(url)('.pic img')
urllist = []
area.each(lambda index, element: urllist.append(urljoin(url, pq(element).attr('src'))))
$raceroute static.wenku.bdimg.com
traceroute to static.wenku.bdimg.com (183.60.131.119), 30 hops max, 60 byte packets
1 113.105.128.126 (113.105.128.126) 1.876 ms 1.957 ms 2.101 ms
2 10.8.1.10 (10.8.1.10) 1.371 ms 1.380 ms 1.434 ms
3 192.168.252.1 (192.168.252.1) 0.253 ms 0.259 ms 0.367 ms
4 * * *
5 * * *
6 113.98.25.129 (113.98.25.129) 1.644 ms 1.822 ms 113.98.5.149 (113.98.5.149) 1.814 ms
7 183.59.12.157 (183.59.12.157) 2.749 ms 2.785 ms 183.59.14.209 (183.59.14.209) 3.649 ms
8 * * *
不知道http://或者https://要不要算上去的
ea38128d67a97d4b41049ffec063cafd
1.cn
0b9e64ac68b3a501dd50050ce4e9ea1b
www.1.cn
e7944964d13ef53341049ffec063cafd
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html locale="true" xhtml="http://www.w3.org/1999/xhtml">