Skip to content

Instantly share code, notes, and snippets.

@jie
jie / qiniu_upload.py
Created September 2, 2019 16:19
upload qiniu by path
import os
import sys
import fire
import json
from qiniu import Auth, put_file, etag, BucketManager, build_batch_stat
fail_list = []
default_extname = 'jpg'
@jie
jie / python-adapter.py
Created August 12, 2013 07:44
adapter
import os
class Dog(object):
def __init__(self):
self.name = "Dog"
def bark(self):
return "woof!"
class Cat(object):
@jie
jie / supervisord.sh
Created July 17, 2012 09:48 — forked from SerhoLiu/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@jie
jie / supervisord.conf
Created January 10, 2012 09:43
supervisord.conf
; supervisor config file
[unix_http_server]
file=/var/run//supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
@jie
jie / nginx.conf
Created December 14, 2011 07:12
spawn-fcgi and nginx
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
use epoll;
}
http {
@jie
jie / nginx.config
Created August 14, 2011 09:09
nginx.conf http and https
user www-data;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@jie
jie / session.py
Created May 24, 2011 07:56
a gae session
import os
import time
import datetime
import random
import Cookie
import logging
from google.appengine.api import memcache
COOKIE_NAME = 'appengine-session-sid'
DEFAULT_COOKIE_PATH = '/'
@jie
jie / auto_width_layout.html
Created May 5, 2011 07:29
a auto width layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
* {-webkit-text-size-adjust:none; padding:0; margin:0;}
body {margin:0;padding:0;background:#fff;font-size:12px;/*background-attachment:fixed;*/}
a {text-decoration:none;color:#000;}
a:visited {color: #333;}
a:hover {text-decoration:underline;}
@jie
jie / django:login new user after signup
Created March 14, 2011 11:37
django:login new user after signup
from django.contrib import auth
from django.contrib.auth.forms import UserCreationForm
form = UserCreationForm()
new_user=form.save()
new_user.backend="%s.%s" %('django.contrib.auth.backends','ModelBackend')
auth.login(request, new_user)
upstream ghs {
server ghs.google.com:80;
}
server {
listen 80;
server_name www.example.com;
location / {
proxy_redirect off;