{"id":183420,"date":"2013-06-15T14:34:02","date_gmt":"2013-06-15T10:34:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=183420"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=183420","title":{"rendered":"<span class=\"post_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 Python c \u0441\u0430\u0439\u0442\u043e\u043c \u043d\u0430 Go<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 <a href=\"http:\/\/sezn.ru\/\">\u0444\u043e\u0440\u0443\u043c\u044b \u201c\u0421\u0435\u0442\u0438 \u0417\u043d\u0430\u043d\u0438\u0439\u201d<\/a>.<\/p>\n<p>  \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0418\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0434\u0432\u0438\u0436\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Python. \u041a\u0430\u0436\u0434\u044b\u0439 \u0444\u043e\u0440\u0443\u043c \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u0435 \u0444\u043e\u0440\u0443\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437 \u043e\u0434\u043d\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430.<a name=\"habracut\"><\/a><\/p>\n<h6>\u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0435.<\/h6>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u043f\u0435\u0440\u0432\u044b\u0435, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0444\u043e\u0440\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u0443 \u043d\u0430 \u0441\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0430 \u0432\u0445\u043e\u0434\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/rrC6CdU.png\" alt=\"image\"\/><\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0439\u0442\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0441\u0442\u0438 \u043d\u0438\u043a \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u043b\u0438\u0431\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f OpenID \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430 \u0432 \u044d\u0442\u0438 \u043f\u043e\u043b\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0434\u0432\u0438\u0436\u043a\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b, \u0438 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0432\u0441\u0435\u0445 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. \u0412\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043c\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430.<\/p>\n<h6>\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/h6>\n<p>  \u0412 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/Do0ymkZ.png\" alt=\"image\"\/><\/p>\n<p>  \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<ul>\n<li>\u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0441\u0435\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u0432\u043e\u0435\u0434\u0438\u043d\u043e;<\/li>\n<li>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0430\u0437\u044b;<\/li>\n<li>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u0439;<\/li>\n<li>\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u043e\u0440\u0443\u043c\u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u2014 <code>SeznID<\/code>. \u0412 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0430\u0437\u044b. <br \/>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u043a (\u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f), \u043d\u043e \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u0443\u043c\u0430\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0440\u0430\u0437\u043d\u044b\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c (\u043d\u0430 \u0434\u044b\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u201c\u0421\u0435\u0442\u0438 \u0417\u043d\u0430\u043d\u0438\u0439\u201d \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u0432\u0441\u0435\u0445 12 \u0444\u043e\u0440\u0443\u043c\u0430\u0445). <\/p>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0431\u0430\u0437 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u0441 sezn.ru \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u0441\u0435 \u0444\u043e\u0440\u0443\u043c\u044b \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u043d \u0432 \u0431\u0430\u0437\u0435, \u0438 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 \u0444\u043e\u0440\u0443\u043c \u0435\u0433\u043e ID. <\/p>\n<pre><code class=\"go\">func load_forum_users(forumUrl string) { \tusersCount := get_users_count(forumUrl, false) \tfor i := 0; i &lt; usersCount; i += UsersCountPerRequest { \t\tusers := get_forum_users(forumUrl, i, UsersCountPerRequest, false) \t\tfor _, user := range users { \t\t\tforumId := user.Id \t\t\texist, selectedUser := mmgr.ModelLoader.IsExist(user)\t \t\t\tif !exist { \t\t\t\tif err := add_new_froum_user(user); err == nil { \t\t\t\t\tsetup_forum_user_profile (user.Id, forumId, forumUrl)\t \t\t\t\t\tuser.Sync(forumUrl) \t\t\t\t} \t\t\t\t\t\t\t\t \t\t\t} else { \t\t\t\tsetup_forum_user_profile (selectedUser.Id, forumId, forumUrl) \t\t\t}\t \t\t}  \t} } <\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u043e\u0440\u0443\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 SeznID \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">def setup_user_sezn_id(request, uid, sid):     try:         user = User.objects.get(id=uid)         user.sid = sid         user.save()          json = simplejson.dumps({&quot;Result&quot;: &quot;Success&quot;})     except:         json = simplejson.dumps({&quot;Error&quot;: &quot;Invalid sezn id or user id&quot;})      return HttpResponse(json, mimetype='application\/json') <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u0443\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 sezn.ru. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <code>SeznID<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. <\/p>\n<p>  \u041a\u043e\u0434 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u0435\u043d <code>sezn.ru<\/code><\/p>\n<pre><code class=\"go\">func forumUserRegisterHandler(w http.ResponseWriter, r *http.Request) {\t\t \tw.Header().Set(&quot;Content-Type&quot;, &quot;application\/json&quot;) \tregData := get_register_data(w, r)\t\t \tuser, err := create_forum_user(regData) \tif err != nil || user == nil { \t\tb, _ := json.Marshal(JsonErrorResponse{&quot;Invalid input data&quot;}) \t\tw.Write(b) \t\treturn \t} \t     \tb, _ := json.Marshal(user.UserModel) \tw.Write(b)\t } <\/code><\/pre>\n<p>  \u0412 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0444\u043e\u0440\u043c\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u0430\u0445. \u0418\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043d\u0438\u043a, \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c Django: \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u043d\u0438\u043a\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0438 \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<pre><code class=\"python\">def check_password(raw_password, enc_password):     algo, salt, hsh = enc_password.split('$')     return hsh == get_hexdigest(algo, salt, raw_password) <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>get_hexdigest<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<pre><code class=\"python\">def get_hexdigest(algorithm, salt, raw_password):     raw_password, salt = smart_str(raw_password), smart_str(salt)     if algorithm == 'crypt':         try:             import crypt         except ImportError:             raise ValueError('&quot;crypt&quot; password algorithm not supported in this environment')         return crypt.crypt(raw_password, salt)      if algorithm == 'md5':         return md5_constructor(salt + raw_password).hexdigest()     elif algorithm == 'sha1':         return sha_constructor(salt + raw_password).hexdigest()     raise ValueError(&quot;Got unknown password algorithm type in password.&quot;) <\/code><\/pre>\n<p>  \u0412 Go \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"go\">func user_by_email_and_raw_pass(email, pass string) (*User, error) { \tuser, err := mmgr.ModelLoader.LoadUserByEmail(email) \tif user == nil || err != nil { \t\treturn nil, err \t}\t  \t \tif err = check_password(&user.UserModel, pass); err == nil { \t\treturn &user, nil\t\t\t \t} \t \treturn nil, errors.New(\u201cUser does not exist.\u201d)\t\t\t } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>check_password<\/code>:<\/p>\n<pre><code class=\"go\">func check_password(model *UserModel, rawPassword string) error { \tpass := strings.Split(model.Password, Divider) \t \tif len(pass) != 3 { \t\treturn errors.New(&quot;Invalid format\u201d) \t} \t \thash := SHA1Passwd(pass[0], pass[1], rawPassword) \t \tif hash != model.Password { \t\treturn errors.New(&quot;Invalid password&quot;) \t} \treturn nil } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>SHA1Passwd<\/code>:<\/p>\n<pre><code class=\"go\">func SHA1Passwd(alg, salt, rawPassword string) string { \th := sha1.New() \tio.WriteString(h, salt+rawPassword) \t \treturn fmt.Sprintf(&quot;%s$%s$%x&quot;, alg, salt, h.Sum(nil)) } <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0414\u043b\u044f \u043d\u0430\u0441 \u0441\u0430\u043c\u044b\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u043a, \u043f\u043e\u0447\u0442\u0430, \u043f\u0430\u0440\u043e\u043b\u044c \u0438 OpenID \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0444\u043e\u0440\u0443\u043c\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0430\u0437\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u043e\u0440\u0443\u043c\u0430\u0445. \u0422\u043e\u043d\u043a\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/36hXU3z.png\" alt=\"image\"\/><\/p>\n<p>  \u0412\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 API \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0442\u0430\u043a\u043e\u043c \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b:  <\/p>\n<ul>\n<li>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438;<\/li>\n<li>\u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0444\u043e\u0440\u0443\u043c;<\/li>\n<li>\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/li>\n<li>\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f;<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 OpenID \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0445\u043e\u0447\u0443 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e. \u0414\u0430\u043b\u0435\u0435 \u0441\u0435\u043a\u0446\u0438\u044f Q&#038;A. <\/p>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0437\u0430\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0430\u0448\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u043e\u0441\u0442\u0443, \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u0435 \u0425\u044d\u0448\u041a\u043e\u0434 c \u043c\u0435\u0442\u043a\u0430\u043c\u0438 <a href=\"http:\/\/hashcode.ru\/questions\/tagged\/go\/\">\u201cGo\u201d<\/a> \u0438 <a href=\"http:\/\/hashcode.ru\/questions\/tagged\/python\/\">\u201cPython\u201d<\/a> \u0438\u043b\u0438 \u0432 \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445. \u041b\u0443\u0447\u0448\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  1. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <a href=\"http:\/\/habrahabr.ru\/users\/antarx\/\" class=\"user_link\">antarx<\/a> \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a <a href=\"http:\/\/habrahabr.ru\/post\/182602\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043f\u043e\u0441\u0442\u0443<\/a> \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u0430\u0437\u0435.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0441\u0438\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0443 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0431\u0430\u0437\u044b \u043f\u043e <code>ID<\/code> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2014 <code>GetQuestionByUserId(id int)<\/code>. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0430\u0442\u044b, \u0442\u043e \u043d\u0430\u0434\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u2014 <code>GetQuestionByUserIdAndDate(id int, date time.Time)<\/code>. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0441\u0432\u0435\u0440\u0445 \u043a\u0440\u0443\u0442\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0434\u0430\u0442\u0435 \u0438 \u0433\u043e\u043b\u043e\u0441\u0430\u043c \u0437\u0430 \u2014 <code>GetQuestionByUserIdAndDateAndScore(id int, date time.Time, score int)<\/code>. \u0412 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u043e\u0447\u043a\u0430\u043c \u0434\u043b\u044f \u0432\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0418 \u0442\u0430\u043a \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u041a\u043e\u0434\u0430 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435. \u0412\u044b\u0445\u043e\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<pre><code class=\"go\">type QuestionQuery struct { \tUserId int         Date time.Time         Score int          \/\/ \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\t } <\/code><\/pre>\n<p>  \u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0432 <code>GetQuestion(query QuestionQuery)<\/code>. \u041c\u0438\u043d\u0443\u0441 \u2014 \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0445\u043e, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0435\u0441\u0442\u044c. <\/p>\n<p>  2. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0442 \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <a href=\"http:\/\/habrahabr.ru\/users\/antarx\/\" class=\"user_link\">antarx<\/a> \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043d\u0438\u043a \u043a\u0430\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u0414\u0430, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043d\u0435 \u0432\u0435\u0440\u043d\u043e. \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u043d\u0438\u043a\u0438 \u0435\u0449\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043d\u0438\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"go\">func myFunc() { \tdefer func() { \t\tif x := recover(); x != nil { \t\t\tLogger.Printf(&quot;run time panic: %v&quot;, x) \t\t} \t}() \tDoSomeAction() \tDoSomeOtherAction() } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0430\u043d\u0438\u043a\u0443 \u043c\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u043c \u043b\u0438\u0448\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438!<\/p>\n<p>  3. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <a href=\"http:\/\/habrahabr.ru\/users\/sectronix\/\" class=\"user_link\">sectronix<\/a> \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/178963\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439<\/a> \u043f\u0438\u0441\u0430\u043b, \u0447\u0442\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0443\u043c\u0431\u0443\u0440\u043d\u043e\u0435.<\/p>\n<p>  \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0437\u0430 \u0432 3 \u0431\u043e\u043b\u044c\u0448\u0435. \u041f\u0435\u0440\u0435\u0434 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u044f \u0435\u0435 \u0443\u0440\u0435\u0437\u0430\u044e \u0434\u043e 6-8 \u0442\u044b\u0441\u044f\u0447 \u0437\u043d\u0430\u043a\u043e\u0432. \u041a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u043e. \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u043a\u0446\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0439\u0442\u0435 \u043c\u0435\u043d\u044f \u043e\u0431\u043e \u0432\u0441\u0435\u043c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043b\u043e\u0445\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e.<\/p>\n<p>  4. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <a href=\"http:\/\/habrahabr.ru\/users\/jetman\/\" class=\"user_link\">jetman<\/a> \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043f\u0440\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 110 \u0442\u044b\u0441 \u0441\u0442\u0440\u043e\u043a. \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0443 \u043d\u0430\u0441. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  countWords=0 for file in .\/*.go do   num=`wc -l $file | cut -d ' ' -f 1`;    countWords=`expr $countWords + $num` done  echo $countWords <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<ul>\n<li><a href=\"http:\/\/careers.hashcode.ru\/\">careers.hashcode.ru\/<\/a> \u2014 33378<\/li>\n<li><a href=\"http:\/\/sezn.ru\/\">sezn.ru\/<\/a> \u2014 4241<\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/183420\/\"> http:\/\/habrahabr.ru\/post\/183420\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 <a href=\"http:\/\/sezn.ru\/\">\u0444\u043e\u0440\u0443\u043c\u044b \u201c\u0421\u0435\u0442\u0438 \u0417\u043d\u0430\u043d\u0438\u0439\u201d<\/a>.<\/p>\n<p>  \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0418\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0434\u0432\u0438\u0436\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Python. \u041a\u0430\u0436\u0434\u044b\u0439 \u0444\u043e\u0440\u0443\u043c \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u0435 \u0444\u043e\u0440\u0443\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437 \u043e\u0434\u043d\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-183420","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/183420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=183420"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/183420\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=183420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=183420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}