Skip to content

Instantly share code, notes, and snippets.

@chappyhome
chappyhome / gist:7593839
Created November 22, 2013 02:34
dropbox linux安装
通过命令行安装 Dropbox
Dropbox 守护程序可在所有 32 位与 64 位 Linux 服务器上正常运行。若要安装,请在 Linux 终端运行下列命令。
32-bit:
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
64-bit:
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
接着,从新建的 .dropbox-dist 文件夹运行 Dropbox 守护程序。
@chappyhome
chappyhome / gist:7593903
Created November 22, 2013 02:41
Installing git on CentOS 5 using yum
Installing git on CentOS 5 using yum
Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command:
$ sudo yum install <packagename>
However, when trying to install git this way, you'll encounter the following error on CentOS 5:
$ sudo yum install git
Setting up Install Process
Parsing package install arguments
No package git available.
@chappyhome
chappyhome / gist:7594741
Created November 22, 2013 04:09
nginx配置总是显示404
location /static/ {
autoindex on;
alias /home/user/www/oil/oil_database/static_files/;
}
@chappyhome
chappyhome / gist:7595706
Created November 22, 2013 06:25
在centos 6.2,python2.7 下安装QT 4.8.3,pyqt 4.9.5 详细步骤
在centos 6.2,python2.7 下安装QT 4.8.3,pyqt 4.9.5 详细步骤
作者:轻舞肥羊 日期:2012-11-22
字体大小: 小 中 大
在linux 下开发桌面应用,最常见的开发工具就是QT,而python是开源世界的轻骑兵,学习简单,开发高效,因此有了 pyqt 这个包用 python 来做 QT 开发。下面详细介绍其步骤。
一、基础环境配置
二、在centos 下编译,安装QT-4.8.3
三、安装pyqt
四、测试
@chappyhome
chappyhome / gist:7615403
Created November 23, 2013 14:51
ImproperlyConfigured: The SECRET_KEY setting must not be empty
You can't just fire up python and check things, django doesn't know what project you want to work on. You have to do one of these things:
Use python manage.py shell
Use django-admin.py shell --settings=mysite.settings (or whatever settings module you use)
Set DJANGO_SETTINGS_MODULE environment variable in your OS to mysite.settings
Use setup_environ in the python interpreter:
from django.core.management import setup_environ
from mysite import settings
@chappyhome
chappyhome / gist:7615718
Created November 23, 2013 15:20
利用rsync自动同步服务器与本地代码的python脚本
利用rsync自动同步服务器与本地代码的python脚本
四 07 二月 2013
tags: Python
菜鸟表示写web时 每次修改完后把文件往VPS上丢很麻烦
用ssh sshfs scp都太慢 小东西又懒得用git
sublimetext上得sftp不支持中文 emacs干脆就只能ssh
于是用linux自带的rsync写了个同步脚本
可以手动或自动往服务器上差异性同步 不用scp一堆东西 也不用忍受ssh那个渣速度
@chappyhome
chappyhome / gist:7622557
Created November 24, 2013 02:30
rsync的验证错误问题
服务端或者密码都是只能本用户使用,chmod 600 ,这个问题常常是造成验证错误的原因
@chappyhome
chappyhome / gist:7625090
Created November 24, 2013 09:13
优化ulimit 以及减少Linux服务器TIME_WAIT过多问题
2. 在/etc/security/limits.conf文件中设置最大打开文件数, 下面是一行提示:
#
添加如下这行。
* - nofile 8192
这行设置了每个用户的默认打开文件数为2048。 注意"nofile"项有两个可能的限制措施。就是项下的hard和soft。 要使修改过得最大打开文件数生效,必须对这两种限制进行设定。 如果使用"-"字符设定, 则hard和soft设定会同时被设定。
硬限制表明soft限制中所能设定的最大值。 soft限制指的是当前系统生效的设置值。 hard限制值可以被普通用户降低。但是不能增加。 soft限制不能设置的比hard限制更高。 只有root用户才能够增加hard限制值。
当增加文件限制描述,可以简单的把当前值双倍。 例子如下, 如果你要提高默认值1024, 最好提高到2048, 如果还要继续增加, 就需要设置成4096。
另外一种情况是在创建索引的时候,也有两种可能,一种是合并因子太小,导致创建文件数量超过操作系统限制,这时可以修改合并因子,也可以修改操作系统的打开文件数限制;另外一种是合并因子受虚拟机内存的限制,无法调整到更大,而 需要索引的doc 数量又非常的大,这个时候就只能通过修改操作系统的打开文件数限制来解决了。
在此基础上,我还修改了以下一个配置文件
@chappyhome
chappyhome / python_resources.md
Created November 25, 2013 01:20 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@chappyhome
chappyhome / javascript_resources.md
Created November 25, 2013 01:20 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage