<Python Web开发实战>
This file contains 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
-- Tit Petric, Monotek d.o.o., Thu 27 Oct 2016 10:43:38 AM CEST | |
-- | |
-- Delete nginx cached assets with a PURGE request against an endpoint | |
-- | |
local md5 = require 'md5' | |
function file_exists(name) | |
local f = io.open(name, "r") | |
if f~=nil then io.close(f) return true else return false end |
This file contains 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 json | |
import pickle | |
import msgpack | |
TEST_REDIS = False | |
if TEST_REDIS: | |
import redis | |
rconn = redis.StrictRedis() | |
dataset = [(('key:%d' % i), {'a': 1, 'b': list(range(100)), 'c': ('z' * 25)}) for i in range(1000000)] |
This file contains 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 collections import defaultdict | |
import json | |
import os | |
import os.path | |
import shutil | |
from pygments.formatters import HtmlFormatter | |
from pygments.lexers import get_lexer_for_filename | |
from pygments import highlight |
This file contains 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
module.exports = {"title":"Australia","version":"1.1.2","type":"FeatureCollection","copyright":"Copyright (c) 2015 Highsoft AS, Based on data from Natural Earth","copyrightShort":"Natural Earth","copyrightUrl":"http://www.naturalearthdata.com","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:3112"}},"hc-transform":{"default":{"crs":"+proj=lcc +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=134 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","scale":0.000158093982027,"jsonres":15.5,"jsonmarginX":-999,"jsonmarginY":9851.0,"xoffset":-2082021.85219,"yoffset":-1210304.51735}}, | |
"features":[{"type":"Feature","id":"AU.NT","properties":{"hc-group":"admin1","hc-middle-x":0.48,"hc-middle-y":0.58,"hc-key":"au-nt","hc-a2":"NT","labelrank":"2","hasc":"AU.NT","alt-name":null,"woe-id":"2344701","subregion":null,"fips":"AS03","postal-code":"NT","name":"Northern Territory","country":"Australia","type-en":"Territory","region":null,"longitude":"133.78","woe-name":"Northern Territory","latitude":"-20.102 |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
This file contains 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 socket | |
import sys | |
import time | |
import struct | |
host = 'localhost' | |
port = 8888 | |
buffersize = 1024 | |
N = 1000000 | |
server_address = (host, port) |
This file contains 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
#!/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import logging | |
from logging.handlers import TimedRotatingFileHandler | |
LOG_DIR = "/tmp/" |
This file contains 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
local redis_c = require "resty.redis" | |
local ok, new_tab = pcall(require, "table.new") | |
if not ok or type(new_tab) ~= "function" then | |
new_tab = function (narr, nrec) return {} end | |
end | |
local _M = new_tab(0, 155) |
Resources for golang web development.
NewerOlder