Skip to content

Instantly share code, notes, and snippets.

View muxueqz's full-sized avatar

muxueqz muxueqz

View GitHub Profile
def send_mail(subject, content, address_from, address_to, smtp_host, smtp_user, smtp_password, smtp_port=25,using_tls=False, attachment=[]):
import smtplib
smtp = smtplib.SMTP()
# smtp = smtplib.SMTP(smtp_host)
is_gmail = False
if smtp_host == "smtp.gmail.com":
is_gmail = True
if is_gmail:
smtp_port = 587
smtp.connect(smtp_host, smtp_port)
word uid 0
work 123 2
work 123 3
home 123 1
home 123 1
home 123 2
#!/usr/bin/env python2
#-*- coding: utf-8 -*-
"""
统计每UID及UID各WORD中的pv, uv
"""
import dpark
#这个文件在 https://gist.github.com/4748763
file_path = 'test_word.log'
%%%
%%% ejabberd configuration file
%%%
%%% The parameters used in this configuration file are explained in more detail
%%% in the ejabberd Installation and Operation Guide.
%%% Please consult the Guide in case of doubts, it is included in
%%% your copy of ejabberd, and is also available online at
%%% http://www.process-one.net/en/ejabberd/docs/
#!/usr/bin/python
import qmp_shell
import sys
sock,file_name = sys.argv[1:]
print file_name
q = qmp_shell.QMPShell(sock)
q.connect()
import pymongo
import dpark
mongodb_host = 'x.x.x.x'
db = pymongo.Connection(host=mongodb_host)
def save_to_mongo(sdict):
result_db = db.log_result.result
result_db.insert(sdict)
db.disconnect()
N = 100000
#!/usr/bin/env python2
#-*- coding: utf-8 -*-
"使用mesos多机的话,在reduceByKey时None的key没有合并,单机无此问题"
import dpark
def xmap_none(line):
for i in range(1, 3):
key = (str(i), None)
yield (key, ({line}, 1))
@muxueqz
muxueqz / company wifi eap
Created June 20, 2013 10:16
company wifi eap
name = Uni
author = Me
version = 1
require identity *Identity password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="$_ESSID"
scan_ssid=$_SCAN
proto=RSN
#!/usr/bin/env luajit
-- Copyright (C) 2012 by Yichun Zhang (agentzh)
local ffi = require "ffi"
local assert = assert
module(...)
_VERSION = '0.01'
#!/usr/bin/env python
import sys
print(sys.stdin.read())