Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
---
# Python 简介
@su27 and @menghan
----
高级
-
易学易读易维护
| import ( | |
| "crypto/md5" | |
| "encoding/hex" | |
| ) | |
| func GetMD5Hash(text string) string { | |
| hasher := md5.New() | |
| hasher.Write([]byte(text)) | |
| return hex.EncodeToString(hasher.Sum(nil)) | |
| } |
| - What do Etcd, Consul, and Zookeeper do? | |
| - Service Registration: | |
| - Host, port number, and sometimes authentication credentials, protocols, versions | |
| numbers, and/or environment details. | |
| - Service Discovery: | |
| - Ability for client application to query the central registry to learn of service location. | |
| - Consistent and durable general-purpose K/V store across distributed system. | |
| - Some solutions support this better than others. | |
| - Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state. | |
| - Centralized locking can be based on this K/V store. |
| ################################################################## | |
| # /etc/elasticsearch/elasticsearch.yml | |
| # | |
| # Base configuration for a write heavy cluster | |
| # | |
| # Cluster / Node Basics | |
| cluster.name: logng | |
| # Node can have abritrary attributes we can use for routing |
| #!/usr/bin/env python | |
| #from fabric.api import * | |
| from fabric.api import env, cd, put, sudo, settings, task, parallel | |
| from fabric.contrib.files import sed | |
| env.user = 'zhaopeng' | |
| env.password = '******' | |
| PHPDir = '/usr/local/php' | |
| #!/bin/bash | |
| vpn_host=202.108.39.190 | |
| user=zhaopeng #用户名 | |
| key=123456 #密码中不变的部分 | |
| sudo whoami > /dev/null | |
| read -s -p "Enter dynamic digital password: " passwd | |
| echo "" | |
| #vpnc运行必须要有root权限, |
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import requests | |
| from bs4 import BeautifulSoup | |
| signin_url = "http://www.v2ex.com/signin" | |
| award_url = "http://www.v2ex.com/mission/daily" | |
| main_url = "http://www.v2ex.com" |
| #!/usr/bin/env python | |
| import re | |
| import urllib2 | |
| import sys | |
| url = "http://music.douban.com" | |
| GetSrc = urllib2.urlopen(url).read() | |
| #r = re.compile(r'data-url=\"(.+?)\".+\)\;\">(.+?)<.+?data-url=\"(.+?)\".+\)\;\">(.+?)<.+?', re.DOTALL) |
| #!/usr/bin/env python | |
| import os,sys,re | |
| import curses | |
| import locale | |
| import math | |
| from optparse import OptionParser | |
| locale.setlocale(locale.LC_ALL, '') |
| import tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.options | |
| import tornado.web | |
| from tornado.options import define, options | |
| define("port", default=8000, help="run on the given port", type=int) | |
| class IndexHandler(tornado.web.RequestHandler): | |
| def get(self): |