Showing posts from 2012

Raspbery Pi as a home file server

I've wanted more from my PI, besides Time Machine functions, established in my earlier articles. So I've decided to make it a SAMBA server. I have a Mac and a Windows PC. And several iPads/iPhones. So the decision was obvious. To access my storage content I'd need a samba share. Because it is recognized by all this tech. iPad has Oplayer, to watch movies without conversion... GoodReader for docs. One word - SAMBA share. SO this article will be about adding a samba share to your Raspberry Pi.
Note I have a Time Machine already set up. But it won't matter much. I only have another drive index letters and so on. I'll try to cover this as much as possible. And macs somewhat easily read NTFS filesystems. So we will be mounting NTFS filesystem volume to a Raspberry Pi with SAMBA network sharing. Let's get on to it.

To set up a Raspbery Pi home network Samba server you will need to:
- Connect an external drive (USB HDD in my case).
- Update fstab for auto-mounting of i…

Raspbery Pi Time Capsule HDD managing power saving mode

I want to sugest power saving changes after installing and handling creation of Time Capsule for Time Machine for my home network (form my previous article). I like when it's quiet. And like when disks does not spin, when it'snot necessary to do so. So if you usually backup once in some hours and main time (Night and a part of the day) you do not touch a Time Machine... You would probably want to slow down your disks for that time. Fortunately Linux does it very well. And support of it is encoded into Linux core (kernel). You just would need a UI for this possibilities and a bit of knowledge and luck ;)
Warning: Operations described farther may be potentially hazardous to your hardware. So now after you are warned ;) let's continue. I guess I will not touch those hazardous functions, but you may, typing wrong letters to this command in Linux shell... So be careful. Better read manuals for farther commands and so on...

Anyway what we need is a UI. And we have it in form of…

Time Capsule for $25

The real article name might be something like: Configuring Raspbery Pi to serve like a Time Capsule with Netatalk 3.0 for Mountain Lion.  But it's too long ;) Here I will describe the process of using Raspberry Pi like a Time Machine in my network. To be able to backup your MAC's remotely (Like it would be NAS of some kind). It assumes you have a Raspberry Pi and have installed a Raspbian there and have a ssh connection, or somehow having access to it's console. Refer to my previous article for details.

Now that we have a Pi that is ready for action let's animate it. So to make it suit you as a Time Capsule (NAS) for your MAC's you need to do those basic steps:
- connect and configure USB hard drive(s)
- install support of HFS+ filesystem to be able to use MAC's native filesystem
- make mount (auto-mount on boot) of your hard drive
- install Avahi and Netatalk demons
- configure Netatalk daemon to make it all serve as a Time Machine
- configure avahi demon
- p…

Raspberry Pi first steps and basic network configuration on a Mac

Here are my first steps. And I hope you will find something useful here, while configuring your Pi...
First of all. Mine have been bought on ebay, from resellers. And were delivered a while ago. Main purpose of this purchase war to attach a headless server to my router. I have 2 external HDD's and would like to have torrents, Time Mashine fro my macs and so on. So buying a handheld computer like this would be a bargain for me.

As for built in decisions like some kinds of NAT devices and different routers with external HDD features... They are either cost a lot or lack some kinds of desired functionality. So the goal is to make some kind http/api manageable server in my local network with Time Mashine and file storage/backup. Just for fun. And to have only laptop on my work table.

SO back to the Pi. If you are buying "device only" configuration, like I did. First of all you'll need some different kind of things many computer fans usually have for backup purposes, or …

Migration from HDD to SSD with Mac OS X Lion

Today I'll try to cover my migration experience. I have bought myself an OCZ Technology 128GB Vertex 4 SSD from Amazon. And I also have an external 1 Tb HDD. I'm using it for migration purposes as a backup Time Mashine. So to migrate yourself without reinstalling operating system and so on you need:

1. Compact your data. Usually HDD's, installed in Mac's, are much bigger then SSD's you buying. And to tell you the truth, you probably do not need a 512 Gigabytes SSD at all. Most of data are accessed rarely and do not require speedy storage. So COMPACT them. Move to an external HDD and/or delete. Time to cleanup one word. There are also several places that can be easily deleted without much troubles. They are iTunes backup caches for your iOS devices, like iPhones and iPads.
they are usually sotred on your user library path.
You can delete them without sorry from either:
~/Library/Application Support/MobileSync/Backup 
folder or in your iTunes => Preferences =>…

Django Log Files Viewer documents

Django Log File Viewer. This is a PYPI package django-log-file-viewer documents.
Github repo: Usage: Useful to add log files view functionality to your Django admin web site.
Instead of using database log files storage, it gives you ability to store/view log files through GUI.
It requires a directory with Django log files to function. E.g. directory structure:

$ project_dir/logs/: applog.log applog.log.2012-09-22... errors.log applog.log.2012-09-22...

To parse/display these log files you need: 1. Install an app and add it to your INSTALLED_APPS section:
# INSTALLED_APPS =(# ...'django-log-file-viewer',# ...) 2. Set UP 2 django variables in
# LOG_FILES_DIR ='/path/to/your/log/directory'# Relative or static path string of your log files directory.# I recommend using more pythonic way of defining tis with os module. E.g. :# L…

SSH Unix/Lunux Recipes for daily usage.

I've decided to create a post with several recipes for commands I need to use daily. I use them from a Mac OS X Lion default console, except for some mac ports installed... Remote is special linux distribution.
How do I Compress a Whole Linux or UNIX Directory?  You need to use tar command as follows (syntax of tar command): tar -zcvf archive-name.tar.gz directory-name
-z: Compress archive using gzip program-c: Create archive-v: Verbose i.e display progress while creating archive-f: Archive File name For example, you have directory called /home/garmoncheg/data and you would like to compress this directory then you can type tar command as follows: $ tar -zcvf data.tar.gz /home/garmoncheg/data/ Above command will create an archive file called data.tar.gz in current directory. If you wish to restore your archive then you need to use following command (it will extract all files in current directory): $ tar -zxvf data.tar.gz Where,
-x: Extract files Put or Retrieve a file from/…

Python: simple recipe to measure your function's execution time

We always write something unusual while doing basic things. Our own bicycles and crutches to work out some unusual situation. Here is another recipe to do a thing like so. I have tried several libraries and readymade decisions. But it assumes you have them installed. And you often try things in console, don't you?

Anyway the recipe is simple and quite straightforward.

import datetime # Getting first timestamp t1 = Your function e.g.: data =[ for g in request.user.groups.all()]# Second timestamp t2 ="Execution time: %s"%(t1-t2)
It is rude and quite simple but may often suit you well to measure execution time in a simple and straightforward manner.
Also nice idea to write down this function into logs. It may be handy on refactoring of your core app for e.g.;

import datetime import logging log = logging.getLogger('mylogger')# Getting first timestamp t1 = Your function e.g.: data =[g…