Skip to content

Instantly share code, notes, and snippets.

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@vixh
vixh / gist:806182
Created February 1, 2011 17:14
deamontools debian
apt-get install deamontools
mkdir /etc/service
svcscanboot /etc/service
sudo easy_install virtualenv
mkdir ~/virtualenvs
virtualenv ~/virtualenvs/mysite
source ~/virtualenvs/mysite/bin/activate
easy_install pip
pip -E {{ env_name }} freeze # сохраняет текущею virtualenvs
@vixh
vixh / git helpers
Created October 9, 2010 16:36
Git helpers
Git helpers
PUSH NEW BRANCH
git push origin master:refs/heads/NEW_BRANCH
PULL REMOTE BRANCH
git branch -a
git checkout -b NEW_BRANCH remotes/origin/NEW_BRANCH
EXPORT
@vixh
vixh / decorators.py
Created October 9, 2010 08:42
Decorator for Django views that sends returned dict to render_to_response function with given template and RequestContext as context instance
from django.shortcuts import render_to_response
from django.template import RequestContext
def render_to(template):
"""
Decorator for Django views that sends returned dict to render_to_response function
with given template and RequestContext as context instance.
If view doesn't return dict then decorator simply returns output.
Additionally view can return two-tuple, which must contain dict as first
# Dublicate MySQL DB
mysqldump -u DB_user --password=DB_pass DB_name | mysql -u DB_user --password=DB_pass -h DB_host DB_name
# Dublicate PostgreSQL DB
CREATE DATABASE newdb WITH TEMPLATE originaldb;
@vixh
vixh / restore_drupal_content.sh
Created September 4, 2010 19:45
Restore Drupal content from remote server
#!/bin/bash
# Restore Drupal content from remote server
REMOTE_PATH='root@v4324.vps.masterhost.ru:/var/www/vhosts/'
REMOTE_HTML='/httpdocs/'
HOME_PATH='/home/'
HOME_HTML='/public_html/'
if [ $1 == '' ] ; then
@vixh
vixh / dump_drupal_content.sh
Created September 4, 2010 19:44
Dump drupal content files and DB
#!/bin/bash
# Dump Drupal content(files, sites) and MySQL database
HOST_PATH='/var/www/vhosts/';
if [ $1 != '' ] ; then
cd $HOST_PATH$1/httpdocs
fi
DUMP_DIRS=''