Skip to content

Instantly share code, notes, and snippets.

View paomian's full-sized avatar
🤕
I don't know.

localhost paomian

🤕
I don't know.
View GitHub Profile
#! /usr/bin/python
# -*- coding: utf-8 -*-
import struct
import socket
def ip2int(ip):
'''将ip映射到int范围,并保证从0.0.0.0到255.255.255.255递增'''
return struct.unpack("!I", socket.inet_aton(ip))[0]
3757543037,3757543139,"223.247.142.125","223.247.142.227","中国","安徽","亳州","","电信"
3757543140,3757543140,"223.247.142.228","223.247.142.228","中国","安徽","亳州","","电信"
3757543141,3757543287,"223.247.142.229","223.247.143.119","中国","安徽","亳州","","电信"
3757543288,3757543288,"223.247.143.120","223.247.143.120","中国","安徽","亳州","","电信"
3757543289,3757543387,"223.247.143.121","223.247.143.219","中国","安徽","亳州","","电信"
3757543388,3757543388,"223.247.143.220","223.247.143.220","中国","安徽","亳州","","电信"
3757543389,3757543489,"223.247.143.221","223.247.144.65","中国","安徽","亳州","","电信"
3757543490,3757543511,"223.247.144.66","223.247.144.87","中国","安徽","亳州","","电信"
3757543512,3757543779,"223.247.144.88","223.247.145.99","中国","安徽","亳州","","电信"
3757543780,3757543811,"223.247.145.100","223.247.145.131","中国","安徽","亳州","","电信"
user=> (def a (agent 1))
#'user/a
user=> (defn aa [a] 33)
#'user/aa
user=> (shutdown-agents)
nil
user=> (send a aa)
SocketException The transport's socket appears to have lost its connection to the nREPL server
clojure.tools.nrepl.transport/bencode/fn--5570/fn--5571 (transport.clj:95)
clojure.tools.nrepl.transport/bencode/fn--5570 (transport.clj:95)
@paomian
paomian / gist:f7b3a512af2fc5badd38
Created September 13, 2014 12:00
clojure quick sort
(defn nom [n] (take n (repeatedly #(rand-int n))))
(defn sort-parts
[work]
(lazy-seq
(loop [[part & parts] work]
(if-let [[pivot & xs] (seq part)]
(let [smaller? #(< % pivot)]
(recur (list*
(filter smaller? xs)
queue = Queue
class A():
def __init__(queue): #传入一个'queue'的字符串
exec('global %s' % queue)
self.queue = queue
tableApp.directive('myDisabled', function($compile) {
return {
restrict: 'A',
replace: true,
scope: {
myDisabled: '='
},
link: function(scope, element, attrs) {
// console.log(attrs.myDisabled);
// console.log(typeof(attrs.myDisabled));
curl -d 'surveyAnsw301=421&surveyAnsw301=431' http://www.chuzhou.gov.cn/module/survey/opr_survey_form.jsp\?formid\=261\&cateid\=2
(map (fn [v] [(second v) (last v)]) (re-seq #"<td>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})</td>\n<td>(\d{2,4})</td>" mys))
;; hash map 数据处理
(pre-process {:deviceToken "abcdefghi" :channel ["a" "b" "c"]}
[:deviceToken :channel :_Installattion] nil)
[{
"_Installattion<>":"",
"channel":["a","b","c"],
"channel=a":1,
"channel=b":1,
"channel=c":1,
struct Point {
x: int,
y: int,
}
fn transform(p: Point) -> Point {
Point { x: p.x + 1, y: p.y + 1}
}
fn main() {