首先 抓  kubernetes-dashboard.yaml

wget https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml


echochio 發表在 痞客邦 留言(0) 人氣()



 
hosts -->

echochio 發表在 痞客邦 留言(0) 人氣()

用 golang 當 ldap 主機 ...但 ldap client 寫不出來 ....挖哩 golang 沒有找到可用的
用 golang 呼叫 python --> ad.py 去當 ldap client

echochio 發表在 痞客邦 留言(0) 人氣()



import ldap
def authenticate(address, username, password):
    conn = ldap.initialize('ldap://' + address)
    conn.protocol_version = 3
    conn.set_option(ldap.OPT_REFERRALS, 0)
    try:
        result = conn.simple_bind_s(username, password)
    except ldap.INVALID_CREDENTIALS:
        return "Invalid credentials"
    except ldap.SERVER_DOWN:
        return "Server down"
    except ldap.LDAPError, e:
        if type(e.message) == dict and e.message.has_key('desc'):
            return "Other LDAP error: " + e.message['desc']
        else: 
            return "Other LDAP error: " + e
    finally:
        conn.unbind_s()
    return "Succesfully authenticated"

echochio 發表在 痞客邦 留言(0) 人氣()


程式參考  https://github.com/chio-nzgft/python-data/blob/master/test_class.py
               https://github.com/chio-nzgft/python-data/blob/master/test_class2.py

echochio 發表在 痞客邦 留言(0) 人氣()

import json
import urllib
print sum(x['count'] for x in json.loads(str(urllib.urlopen('http://python-data.dr-chuck.net/comments_349706.json').read()))['comments'])
 

echochio 發表在 痞客邦 留言(0) 人氣()

python 換成 3.3 有點不習慣
import urllib.parse
import urllib.request
import json

echochio 發表在 痞客邦 留言(0) 人氣()


import urllib
import json
serviceurl = 'http://maps.googleapis.com/maps/api/geocode/json?'

echochio 發表在 痞客邦 留言(0) 人氣()


 
沒幾行程式寫了快一小時

echochio 發表在 痞客邦 留言(0) 人氣()



安裝 pip & matplotlib &numpy &dateutil
pip install matplotlib
pip install matplotlib
pip install numpy
pip install dateutil

echochio 發表在 痞客邦 留言(0) 人氣()

試用看看 find strip float max
text = "   X-DSPAM-Confidence:    0.8475  "
text = text.strip()
lg=None
ll=None
for n in "01234567890":
    l = text.find(n)
    if l > 0:
        if lg is None:
            lg=l
        if ll is None:
            ll=l
        lg=max(lg,l)
        if l<ll:
            ll=l
print float(text[ll:lg+1])
        

echochio 發表在 痞客邦 留言(0) 人氣()


 
先寫個 html

echochio 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。