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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
file_location = '~/VMs/ubuntu/src' | |
Vagrant.configure("2") do |config| | |
# All Vagrant configuration is done here. The most common configuration | |
# options are documented and commented below. For a complete reference, | |
# please see the online documentation at vagrantup.com. |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Usage: | |
fab deploy:appname | |
""" | |
from fabric.api import env, run, cd, local, put | |
env.hosts = ['myserver.com'] | |
env.user = 'eric' |
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
# deb http://mirrors.aliyun.com/ubuntu trusty main restricted | |
# deb http://mirrors.aliyuncs.com/ubuntu trusty main restricted | |
# deb http://mirrors.aliyun.com/ubuntu trusty-updates main restricted | |
# deb http://mirrors.aliyuncs.com/ubuntu trusty-updates main restricted | |
# deb http://security.ubuntu.com/ubuntu trusty-security main restricted | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. | |
deb http://mirrors.aliyun.com/ubuntu trusty main restricted |
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
#-*- coding:utf-8 -*- | |
import time | |
import subprocess | |
""" | |
select last_name || "" || middle_name || "" || first_name as name, mobile_phone, other_phone from contacts where categories like "%通讯录%" and (mobile_phone <> '' or other_phone <> '') | |
""" | |
people = [ |
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 flask import Flask, request, session, url_for, redirect, \ | |
render_template, abort, g, flash | |
from werkzeug.contrib.sessions import Session, SessionStore | |
from cPickle import HIGHEST_PROTOCOL | |
from random import random | |
from flask import json | |
class MemcachedSessionStore(SessionStore): | |
def __init__(self, servers=None, key_prefix=None, default_timeout=300): |
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
package main | |
import ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"strings" | |
"github.com/go-ini/ini" |
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 os | |
import uuid | |
from PIL import Image | |
from flask.ext.uploads import extension | |
def random_filename(): | |
"""生成伪随机uuid字符串,用做文件名""" | |
return str(uuid.uuid4()) |
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
// | |
// How to set timeout for http.Get() in golang | |
// | |
package main | |
import ( | |
"io" | |
"io/ioutil" | |
"log" | |
"net" |
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
""" | |
This is a simple example of WebSocket + Tornado + Simple EventEmitters usage. | |
Thanks to pyee by https://github.com/jesusabdullah | |
@Author:: Narayanaperumal G <gnperumal@gmail.com> | |
""" | |
import tornado.httpserver | |
import tornado.websocket | |
import tornado.ioloop | |
import tornado.web | |
from collections import defaultdict |
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 flask import Flask | |
app=Flask(__name__) | |
@app.route('/') | |
def index(): | |
return """ | |
<span id="now">loading<span> | |
<script type="text/javascript"> | |
window.WebSocket=window.WebSocket || window.MozWebSocket || false; |
OlderNewer