This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # author: Arpegius | |
| # link: https://stackoverflow.com/users/142039/arpegius | |
| import json | |
| class JSONObject: | |
| def __init__( self, dict ): | |
| vars(self).update( dict ) | |
| #this is valid json string | |
| data='{"channel":{"lastBuild":"2013-11-12", "component":["test1", "test2"]}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "net/http" | |
| ) | |
| type Profile struct { | |
| Name string | |
| Hobbies []string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| var ( | |
| dbhostsip = "10.10.12.2:3306" //IP地址 | |
| dbusername = "aogooc" //用户名 | |
| dbpassword = "123456" //密码 | |
| dbname = "ops" //表名 | |
| dbcharset = "utf8" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bytes" | |
| "encoding/binary" | |
| "encoding/json" | |
| "fmt" | |
| ) | |
| func main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "encoding/binary" | |
| "bytes" | |
| ) | |
| bs := make([]byte, 4) | |
| msg := "ssssssss" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import rsa | |
| import base64 | |
| def split_len(seq, length): | |
| return [seq[i:i+length] for i in range(0, len(seq), length)] | |
| def encrypt(text, pub_key): | |
| block_size = rsa.common.byte_size(pub_key.n) - 11 | |
| encrypted = "" | |
| for part in split_len(text, block_size): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tornado.web | |
| from jinja2 import Environment, FileSystemLoader, TemplateNotFound | |
| class TemplateRendering: | |
| def render_template(self, template_name, **kwargs): | |
| template_dirs = [] | |
| if self.settings.get('template_path', ''): | |
| template_dirs.append( | |
| self.settings["template_path"] | |
| ) |