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/python | |
# -*- coding:utf-8 -*- | |
#this script is used to do some operations more convenient via ftp | |
#1.[p]upload many files in the same time,show md5s | |
#2.[g]download many files in the same time,show md5s | |
#3.[l]list all the files on ftp site | |
#4.[f]search a file on ftp site,return True or Flase | |
#5.[h]show help info | |
#add upload and download operations 20111210 version0.1 |
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 | |
# -*- coding: utf-8 -*- | |
__all__ = ['timeout'] | |
import ctypes | |
import functools | |
import threading |
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
var http = require('http'); | |
http.createServer(function(req, res){ | |
res.wirteHead(200, {'Content-Type': 'text/html'}); | |
res.wirte('<h1>Node.js</h1>'); | |
res.end('<p>Hello World</p>'); | |
}).listen(3000); | |
console.log("HTTP Server is lisetening at port 3000."); |
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
var http = require('http'); | |
var querystring = require('querystring'); | |
var server = http.createServer(function(req, res){ | |
var post = ''; | |
req.on('data', function(chunk){ | |
post += chunk; | |
}); | |
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
server { | |
listen 8001; | |
server_name localhost; | |
charset utf-8; | |
root /opt/celery_web; | |
location / { | |
root /opt/celery_web; | |
} | |
location ^~ /choi_wan_api/ { | |
#add_header 'Access-Control-Allow-Origin' '*'; |
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
server { | |
listen 443; | |
charset utf-8; | |
ssl on; | |
ssl_certificate /opt/disk2/var/serverconfig/server.cert; | |
ssl_certificate_key /opt/disk2/var/serverconfig/server.key; | |
location / { | |
root /opt/disk2/var/www; | |
uwsgi_pass 127.0.0.1:9001; |
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/bash | |
#celery web deploy | |
NGINX_CONF=/opt/disk2/var/serverconfig/www-nginx.conf | |
SVN_USERNAME="" | |
SVN_PASSWORD="" | |
CELERY_WEB_SVN="" | |
WEB_PROJECT_DIR=/opt/disk2/var/www |
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
def get_user_events(user_id, appname, new_flag=False): | |
""" | |
get the last 7 days events from reportevent table by user_id | |
param: user_id: the user id, appname: the app name | |
""" | |
if new_flag: | |
starttime = datetime.datetime.combine(datetime.date.today(), datetime.time.min) | |
else: | |
starttime = datetime.datetime.combine(datetime.date.today() - datetime.timedelta(days=6), | |
datetime.time.min) |
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 urllib2 | |
import sys | |
import time | |
import os | |
import random | |
from multiprocessing.dummy import Pool as ThreadPool | |
type_ = sys.getfilesystemencoding() | |
def rename(): |
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
$(document).ajaxSend(function(event, xhr, settings) { | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
OlderNewer