Skip to main content

Posts

Showing posts with the label server

POP3 Mock (Fake) server using python script

Having a need in POP3 server for my debugging purposes I have used this script. Letting it to be here in case of anyone would need to do something similar. Usage is: $ python pypopper.py 110 email_file.eml " " " pypopper: a file-based pop3 serve r Useage :     python pypopper.py <port> <path_to_message_file > " " " import logging import os import socket import sys import traceback logging . basicConfig ( format = " %(name)s %(levelname)s - %(message)s " ) log = logging . getLogger ( " pypopper " ) log . setLevel ( logging . INFO ) class ChatterboxConnection ( object ) : END = " \r \n " def __init__ ( self , conn ) : self . conn = conn def __getattr__ ( self , name ) : return getattr ( self . conn , name ) def sendall ( self , data , END = END ) : if len ( data ) < 50 : log . debug ( " send: %r " , data )    ...

Install Docker under Ubuntu 14.04 (Trusty)

Docker supports Ubuntu versions: Ubuntu Vivid 15.04 (64-bit) Ubuntu Trusty 14.04 (LTS) (64-bit) Ubuntu Precise 12.04 (LTS) (64-bit) Ubuntu Raring 13.04 and Saucy 13.10 (64 bit)  For both Vivid and Trusty you need nothing. It will work out of the box. Others will require some modifications. (Updating of some things, like kernel or installing with wget on 13.04) 1. To install docker from a repository do so: sudo apt - get update sudo apt - get install docker . io sudo ln - sf / usr / bin / docker . io / usr / local / bin / docker sudo sed - i '$acomplete -F _docker docker' / etc / bash_completion . d / docker . io 2. Now run it with: sudo apt - get install lxc - docker 3. Make it run on system boot: sudo update - rc . d docker . io defaults 4. Ready to go! Run container with an Ubuntu: sudo docker run - i - t ubuntu / bin / bash To disconnect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q . 

CentOS Install SSH server and configure for VirtualBox testing

I have had some tasks to configure and install a CentOS distribution for my bug-tracking needs. Hope to help out someone with similar problems and or tasks. I'll be using a fresh install of a CentOS Minimal 6.5.  And a Mac Book Pro with VirtualBox installed (as my testing environment). First after install of a clean CentOS you need an SSH server to work in your usual environment. So to connect to a Linux, installed in a VirtualBox you will need basically 2 things: openssh-server install disable firewall VirtualBox Port configuration/Access configuration OpenSSH server install To install server you need to run in your VirtualBox Guest system (CentOS VM): yum -y install openssh-server And start and add it to auto launch at system startup: chkconfig sshd on service sshd start Also make sure port 22 is opened in your VM. type: netstat -tulpn | grep :22 Firewall settings Because it's a VM you can simply disable the firewall. But be sure not to do this a...

install ssh-copy-id on Mac OS X best way

You often need to create identities for unknown/new servers. Then welcome to this article. I believe i have a best practice way of doing it on a MAC system. First of all you need your identity file: 1. Generating ssh keys set You need to use tool that any unix system usually has. It's ssh-keygen. (Skip if you have it already) Last login: Wed Aug 21 16 : 07 : 34 on ttys002 console@username:~$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/Users /username/ .ssh/id_rsa): yourkeyname Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in yourkeyname. Your public key has been saved in yourkeyname.pub. The key fingerprint is: XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX. console@username The key 's randomart image is: +--[ RSA 2048]----+ | + | | + | | + | | + ...

Django: How to debug Django

There are several ways of debugging Django. I'll try to cover most common and tell what I know/use time to time. This article may become useful to Django newbies and is not intended to be "the only truth". It may help you know in general about debugging techniques commonly used in Python/Django projects that author is aware of. Let's get started. There are several methods to discuss here. 1. Print out into console. It may become handy while working with critical bugs that only appear in production for e.g. and are not traceable at development environment... The only way here to run your project manually and do debug in production. Those requirements are so rare that I only use standart (builtin) tools. There is a thing called PDB (Python Debugger). That comes in a standart set of usual python distribution. So it will be available to you at almost any environment where you have console access to your project. Here is an official documentation for pdb module ....

Meteor. Request to host is not allowed by Access-Control-Allow-Origin.

As a novice I'd like to describe a situation when you may need to make calls to a different domain. In my case it was a requirement to access external API. Anyway I'd like to describe here my perspective of usage this in meteor. You would need to get those data and parse them. First thought is to use client. Wrong. You would need to add CORS support to your application. It means you need to have header  Access-Control-Allow-Origin: * added to all of your response objects. This will enable Meteor usage of external domain responses. And requires you to hack Meteor code. But there is more "proper" way to work with server. Code on a server is executed synchronously and so you can be sure it will be executed and result returned. So. First we need to make sure we have a Meteor.http package installed. You can install it by executing "meteor add http" in your project root directory. Meteor.http can work in both synchronous and asynchronous modes. It is d...

Automating everyday system routine with Fabric (Python)

Lets talk about your console work. I use it on everyday basis. I need to log on to  my deployment/stage/whatever, server and do some redundancy. E.g. download some logs, clean up some caches and/or redeploy something. Here is the occasion, when  Fabric  comes handy. You can eliminate all the redundancy and cover tons of operations you need to do every day, using console, shortcutting them to one of your simple commands, like:  fab deploy_production -H root@mydeployment.com  interested? Let's move on then. Notie this command is not a masterpiece, but must give you the understanding of usual workflow. 1. Installation and purposes Let's go ahead, installing Fabric and automating some simple operations. You can read  official docs  about alternative methods. But installation is fairly simple. And is the matter of typing: $pip install fabric Nothing more special is required. You will need fabric at system wide scale. I install...

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-mount...