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 | |
| // using asymmetric crypto/RSA keys | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" |
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 ( | |
| "net/http" | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| "os" | |
| ) |
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" | |
| "net/http" | |
| "sync" | |
| "time" | |
| ) | |
| func basics() { |
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
| * http://iswwwup.com/t/fe6fb8348903/nginx-how-to-setup-cross-domain-rules-in-discourse.html | |
| * http://discuss.emberjs.com/t/apache-rewrite-rule-for-html5-browser-history-url-bookmarkability/1013 | |
| * http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/ | |
| * https://gist.github.com/Stanback/7145487 | |
| * http://serverfault.com/questions/393532/allowing-cross-origin-requests-cors-on-nginx-for-404-responses | |
| * http://enable-cors.org/server_nginx.html |
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
| #!/usr/bin/python | |
| # Equivalent of "tail -f" as a webpage using websocket | |
| # Usage: webtail.py PORT FILENAME | |
| # Tested with tornado 2.1 | |
| # Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
| # http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
| import tornado.httpserver |
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" | |
| func StartsCapital(s string) bool { | |
| for _, v := range "ABCDEFGH" { | |
| if string(s[0]) == string(v) { | |
| return true | |
| } | |
| } |
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
| pick d0d13d0 1:removed some bullshit from __entrypoint.d _________9______ | |
| pick a44e878 2:Improvements to object.d and __entrypoint.d ________89______ | |
| pick 12c5b47 3:Add usage to build.d ___3____________ | |
| pick 318af43 4:Added .gitignore ______________e_ | |
| pick eb9ad0f 5:Attempting to add more array support _1_3_56_89abcd__ | |
| pick 8b8df05 6:Added some special support for ldc to object.d ________8_______ | |
| pick e630300 7:Removed imports from build ___3____________ | |
| pick 69ae673 8:c-main to d-main __2345_7_9______ | |
| pick c00b344 9:Implemented write an exit system calls _1_345678_______ | |
| pick 3901cca 10:Add wscript_build file 0__3____________ |
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
| # | |
| # CORS header support | |
| # | |
| # One way to use this is by placing it into a file called "cors_support" | |
| # under your Nginx configuration directory and placing the following | |
| # statement inside your location block(s): | |
| # | |
| # include cors_support; | |
| # | |
| # A limitation to this method is that Nginx doesn't currently send headers |
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
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
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
| from PIL import Image | |
| from PIL.ExifTags import TAGS, GPSTAGS | |
| def get_exif_data(image): | |
| """Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags""" | |
| exif_data = {} | |
| info = image._getexif() | |
| if info: | |
| for tag, value in info.items(): | |
| decoded = TAGS.get(tag, tag) |