start new:
tmux
start new with session name:
tmux new -s myname
# This is the script download a page from the server and then search from it the required keyword | |
import urllib2 | |
def get_all_occurences(page): | |
length = len(keyword) | |
start_link = page.find(keyword) | |
if start_link == -1: | |
return None, 0 | |
end_quote = start_link + length |
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools | |
# Install dependencies | |
apt-get install automake libtool | |
# Fetch sources | |
git clone https://github.com/sass/libsass.git | |
git clone https://github.com/sass/sassc.git libsass/sassc | |
# Create configure script |
def get_all_data(datasource): | |
#print "In get_all_data" | |
#datasource = datasource.replace('\n','') | |
start = datasource.find('\\textb') | |
#import pdb; pdb.set_trace() | |
#print start | |
if start == -1: | |
return None,0 | |
st_data = datasource.find('f', start) |
ALSO SEE THIS: http://eddychan.com/post/18484749431/minimum-viable-ops-deploying-your-first-django-app-to | |
AND THIS: http://bitnami.com/stack/django | |
These are my notes on how to quickly setup a python, virtualenv (use virtualenv-burrito FTW), and django. | |
Setup an EC-2 instance: | |
======================= | |
Use the quick launch wizard: |
{% extends "admin/base_site.html" %} | |
{% load i18n admin_static admin_modify %} | |
{% load admin_urls %} | |
{% load url from future %} | |
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} | |
{% if not is_popup %} | |
{% block breadcrumbs %} | |
<ul> | |
<li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li> |
server { listen 80; | |
server_name example.com; | |
access_log /var/log/example.com/nginx.access.log; | |
error_log /var/log/example.com/nginx.error.log; | |
root /var/www/apps/example.com/public; | |
charset utf-8; | |
location / { | |
rewrite ^ https://$host$request_uri? permanent; | |
} |
#!/bin/bash | |
NAME="hello_app" # Name of the application | |
DJANGODIR=/webapps/hello_django/hello # Django project directory | |
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=hello # the user to run as | |
GROUP=webapps # the group to run as | |
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
As configured in my dotfiles.
start new:
tmux
start new with session name:
The python module basic commands | |
to clean and remove the module | |
$ python setup.py sdist (this command will remove the module from your systems python) | |
$ python setup.py install ( this command will install the module to your system's python) | |
$ python setup.py register ( this command will register your module to the pypi) | |
$ python setup.py sdist upload ( this command will upload your newer module version) |