Previous page | Next page
  • 20-May-15 20:40

    List VirtualBox machines

    ...so you can get the machine ID, for instance

    VBoxManage list vms
  • 18-Jun-14 11:06

    Production RubyOnRails on Debian/Apache

    Moving from development to production with RubyOnRails - how I set up my server

    Filed under: Apache, Debian, Rails, Server

    Install Ruby:

    sudo apt-get install ruby-full build-essential

    Install Rubygems:

    wget http://production.cf.rubygems.org/rubygems/rubygems-2.3.0.tgz
    tar xvzf rubygems-2.3.0.tgz
    cd rubygems-2.3.0
    sudo ruby setup.rb
    sudo gem update --system

    Install RVM:

    curl -L get.rvm.io | bash -s stable
    rvm requirements
    source /home/<path_to_rvm_user_home>/.rvm/scripts/rvm
    rvm install 2.1.2
    rvm use 2.1.2 --default

    Bit of cleanup:

    rm -r rubygems-2.3.0
    rm -r rubygems-2.3.0.tgz

    Install MySql for Ruby (if you plan to use it):

    sudo apt-get install libmysql-ruby libmysqlclient15-dev

    Install Passenger (App server for Ruby on Apache):

    sudo gem install passenger --pre
    sudo chmod o+t -R /tmp
    sudo apt-get install apache2-threaded-dev
    rvmsudo passenger-install-apache2-module

    Configure apache to use passenger:

    vim /etc/apache2/apache2.conf
    sudo vim /etc/apache2/sites-available/<name_of_apache_vhost>
    sudo a2ensite <name_of_apache_vhost>
    sudo /etc/init.d/apache2 restart

    Install nodejs:

    git clone git://github.com/ry/node.git
    cd node
    sudo make install
  • 15-Apr-14 17:07

    Virtualbox drops ssh connection when OSX goes to sleep

    Fix that pesky bug workflow interuption

    VBoxManage modifyvm "VM name" --natdnshostresolver1 on
  • 12-Dec-13 11:06

    Tailing and truncating log files

    Watching your log files and trimming them when they get too long

    Watch the last 100 lines of a log file:

    tail -fn100 <path_to_your_file>

    Truncate that file when it gets unweildy:

    truncate -s0 <path_to_your_file>
  • 18-Apr-13 17:29

    Get git to ignore file system permission changes

    You often need different file permissions on your dev env to your live env and don't need to track them

    Filed under: git, Debian, Server

    git config core.filemode false
  • 26-Feb-13 14:32

    Send ssh public key to an ssh server

    Negate the need to remember a huge list of passwords with ssh public key auth

    Filed under: bash, ssh, Server, Debian

    cat ~/.ssh/id_rsa.pub | ssh <username>@<hostname> "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

    And you may need to do a bit of this on the server afterwards:

    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
  • 03-Feb-13 21:38

    Get the Django path

    Need to know where your Django source files are?

    Filed under: bash, django, Server

    python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"
  • 03-Feb-13 21:22

    Getting ready for GIS development on Django

    Installing the dependencies (postgres, postgis) and tools (phppgadmin)

    Filed under: bash, Debian, Linux, Server, postgres

    This procedure assumes that you already have Django installed which should include GeoDjango.

    Start by installing all the software that you're going to need:

    sudo apt-get install postgresql-8.4 php5-pgsql phppgadmin postgresql-8.4-postgis 
    sudo apt-get install postgresql-server-dev-8.4 python-psycopg2 geos binutils libproj-dev gdal-bin proj
    sudo /etc/init.d/postgresql reload

    Install the postgis template:

    sudo su postgres
    createdb template_postgis
    createlang plpgsql template_postgis
    psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis.sql
    psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql

    Create the db and the user:

    sudo su postgres
    createdb -U postgres -T template_postgis -O <project_name> <project_name>

    Configure your Django project to use the following settings:

    Sync db:

    python manage.py syncdb
  • 30-Jan-13 18:06

    Enabling SSH key forwarding

    Sick of dropping your private key file all over the place? Forward it when you connect instead

    Filed under: bash, Debian, Linux, ssh, Server

    Edit your user ssh config file:

        vim ~/.ssh/config

    Adding the lines:

    Host <my_host_name>
        ForwardAgent yes

    You may also need to:

    ssh-add -K ~/.ssh/id_rsa

    This should now cause your ssh key to be forwarded when you connect to the host specified in the host section of the config file. Don't wild card the host in the config file or you'll be throwing your ssh keys around all over the place!

  • 11-Jan-13 11:51

    Prevent foreign key constraint checks during operation

    Useful when you're truncating lots of tables that relate to one another in your schema

    Filed under: Server, MySql

    <do some stuff>
Previous page Next page Pages: 1One of your Ditto templates are missing placeholders, please check the template below:One of your Ditto templates are missing placeholders, please check the template below: