Skip to content

Instantly share code, notes, and snippets.

View jeffery9's full-sized avatar

Jeffery CHEN Fan jeffery9

View GitHub Profile
@jeffery9
jeffery9 / default.vcl.pl
Created August 29, 2012 02:13 — forked from bmarini/default.vcl.pl
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
@jeffery9
jeffery9 / gist:e59fe7bd7f76bfc0f39a
Created February 14, 2015 11:02
odoo inital database script
c:\python27\python openerp-server -c oe.conf -i sales_team,sale_stock,sale_service,sale_order_dates,sale_mrp,sale_margin,sale_layout,sale_journal,sale_crm,sale_analytic_plans,purchase_analytic_plans,product_extended,product_visible_discount,product_margin,product_expiry,product_email_template,website_sale,website_sale_delivery,website_sale_options,website_quote,account_asset,hr_payroll_account,im_livechat,mrp_operations,payment_transfer,project_timesheet,delivery,crm_partner_assign,fleet,purchase_requisition --stop-after-init -d %1
@jeffery9
jeffery9 / gist:47b27afd35f32554934f
Last active August 29, 2015 14:20
pypi mirror
$ cat .pip/pip.conf
[global]
use-mirror=true
mirrors=http://mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
#!/bin/bash
##############################################################################
#
# Copyright (c) 2004-2009 TINY SPRL. (http://tiny.be)
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
@jeffery9
jeffery9 / redis_session_store.py
Created May 15, 2016 12:19 — forked from carlopires/redis_session_store.py
Werkzeug Redis Session Store
# -*- coding: utf-8 -*-
"""
Created on 09/11/2011
@author: Carlo Pires <carlopires@gmail.com>
"""
import tnetstring
from werkzeug.contrib.sessions import SessionStore
SESSION_TIMEOUT = 60*60*24*7 # 7 weeks in seconds
# !/bin/bash
for f in $(ls -d */)
do
f=${f%%/}
echo $f
touch $f/i18n/$f.pot
tx set --auto-local \
-r odoo-master.$f $f'/i18n/<lang>.po' \
--source-lang en \
@jeffery9
jeffery9 / graph_depends.py
Created December 14, 2016 07:34
use to graph odoo module depends....
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
@jeffery9
jeffery9 / RedisPythonPubSub1.py
Created April 8, 2017 09:59 — forked from jobliz/RedisPythonPubSub1.py
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
pandoc -s buy.docx -f docx -t markdown-simple_tables-multiline_tables+pipe_tables-grid_tables -o buy.md