Skip to content

Instantly share code, notes, and snippets.

@dolugen
dolugen / .vimrc
Created July 29, 2010 08:02
Ажлын vim тохиргоо
set encoding=utf8
set nopaste
set expandtab
set textwidth=0
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set backspace=indent,eol,start
set incsearch
# from http://docs.webfaction.com/software/django/troubleshooting.htmlhighlight=django%20remote%20addres#accessing-remote-addr
class WebFactionFixes(object):
"""Sets 'REMOTE_ADDR' based on 'HTTP_X_FORWARDED_FOR', if the latter is
set.
Based on http://djangosnippets.org/snippets/1706/
"""
def process_request(self, request):
if 'HTTP_X_FORWARDED_FOR' in request.META:
@dolugen
dolugen / bashrc config
Created October 13, 2011 03:00
virtualenvwrapper.project example
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
source /usr/local/bin/virtualenvwrapper.sh
@dolugen
dolugen / usage
Created October 13, 2011 03:02
virtualenvwrapper.project example usage
$ mkproject tusul4
New python executable in tusul4/bin/python
Installing setuptools............done.
Installing pip...............done.
virtualenvwrapper.user_scripts creating /home/blackrock/.virtualenvs/tusul4/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/blackrock/.virtualenvs/tusul4/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/blackrock/.virtualenvs/tusul4/bin/preactivate
virtualenvwrapper.user_scripts creating /home/blackrock/.virtualenvs/tusul4/bin/postactivate
virtualenvwrapper.user_scripts creating /home/blackrock/.virtualenvs/tusul4/bin/get_env_details
Creating /home/blackrock/Projects/tusul4
@dolugen
dolugen / field.html
Created November 10, 2011 02:38 — forked from pydanny/field.html
django-uni-form + Twitter Bootstrap
<!-- this usually goes in <project-root>/templates/uni_form/field.html -->
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="clearfix {% if field.errors %}error{% endif %}">
<label for="{{ field.auto_id }}" {% if field.field.required %}class="requiredField"{% endif %}>
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
<div class="input">
@dolugen
dolugen / wsgi.py
Created March 12, 2013 03:10
a wsgi.py template for deploying virtualenv django project
import os
import sys⋅
import site
site.addsitedir('/home/user/.virtualenvs/venv/lib/python2.7/site-packages/')
activate_this = os.path.expanduser("~/.virtualenvs/venv/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
from django.core.handlers.wsgi import WSGIHandler
@dolugen
dolugen / osqa_about.txt
Last active December 14, 2015 23:49
OSQA l10n stuff
# OSQA default About page text
Please customize this text in the administration area
Here you can ask and answer questions, comment and vote for the questions of others and their answers. Both questions and answers can be revised and improved. Questions can be tagged with the relevant keywords to simplify future access and organize the accumulated material.
This Q&A site is moderated by its members, hopefully - including yourself! Moderation rights are gradually assigned to the site users based on the accumulated "karma" points. These points are added to the users account when others vote for his/her questions or answers. These points (very) roughly reflect the level of trust of the community.
No points are necessary to ask or answer the questions - so please - join us!
Control the complexity.
Don't be ugly.
Beautiful is the only answer.
Only one option is strict. # not clear?
Two can still be simple.
Three is funny, and more is complex.
#!/bin/bash
# A shell script to delete / drop all tables from MySQL database.
# Usage: ./script user password dbnane
# Usage: ./script user password dbnane server-ip
# Usage: ./script user password dbnane mysql.nixcraft.in
# -------------------------------------------------------------------------
# Copyright (c) 2008 nixCraft project
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
#!/bin/bash
# Save CSV for MN-UB, PM10
let page_size=65536
#parameter="pm25"
if [ $# -eq 0 ]
then
echo 'Parameter required. One of: pm10, pm25'