Category: Code

Setup SYCO on you centos box

So if you care about security and stability you must have syco installed on your server. Read more about syco on the github project https://github.com/systemconsole Im staring to use syco not only production but also on my “Own” server. So more of you should really start using it and here is i guide for you to start using syco 1. Installing… Read more →

Installing Asylguiden on centos Server

One of my own prodjects are Asylguiden. Its A python publish system build with django, Mysql and mongodb. You can find the code here on github https://github.com/mattiashem/asylguiden Asylguiden also works with wsgi for python and apache for displaying content here is my own how to for downloadning and setting up asylguiden on a production server. 1. Setting up server for… Read more →

ejabber users from postfixadmin (python,mysql,md5crypt)

So Im running my emails with postfix and have postfix admin to manager my users and domains. But now it should be nice to have i jabber server running and to have the same user and password for both email and jabber. Ejabber support custom auth plugins and with some python i now have a working plugin.   First install… Read more →

Install and setup Haystack search for Django

So Mysql is crap at doing full text search. So in one of my projects i use Haystack so i can do full text searches. I have a running Django project up and this is how I setup haystack for my project.   Install and config sudo pip install django-haystack   in settings.py under INSTALLED_APPS add haystack ‘haystack’,   And… Read more →

Custom nagios plugins in python

For monitoring different service and function you may need to build some custom monitoring plugins. I have some build for nrpe and will work with both nagios and icinga. This script will do and mysql check and then send the data back and also start graphing the data back if you use pnp4nagios 🙂 Every plugin must have two things.… Read more →

Install Bitsync on Raspberry Pi

So today im using dropbox to sync all my stuff between devices. But now there are so much there so my free space is almost full. So now its time for me to move to bitsync an then sync all my devices. Install bitsync Go to folder /opt cd /opt Download bitsync wget “http://btsync.s3-website-us-east-1.amazonaws.com/btsync_arm.tar.gz” unpack it chmod 700 btsync_arm.tar.gz tarr zxvf btsync_arm.tar.gz… Read more →

Python ConfigParser using you own config files in python

Storing settings in config files and then let python read the configfiles and to good stuff .   Read the file #Reading config file config = ConfigParser.ConfigParser() config.read(‘setting.cfg’) print all items and values in an section for name, value in config.items(“monitor”): print ‘ %s = %s’ % (name, value) Print all items in configfile for section_name in parser.sections(): print ‘Section:’,… Read more →

How the HELL is oncall ? (the oncall reminder script)

When you have oncall often sometimes is easy to forget hows oncall and when you are not. So for the last time wonder how is oncall and ask some python for some help,   The script #!/usr/bin/env python # # Mattias Hemmingsson # matte@elino.se # # Script for reminder friend when to bet # Uses and csv file and send… Read more →

Extracting HP-Switch running config

Every so othen I have to extract my running-config from my hp switches. And put them under OSSEC file monitoring. And to verify so that no changes has bean done to the original running-config. So here is an small script for extracting my running-config and mf5 check that they are the same as my standard config.   Make you own… Read more →

Django sending email

building and small webpage and in that page I want an small contact field. So my visitors (if any ) can contact me with an form input. So I made an small html template that has a very small form (No validation ) and then post the email and massages back to the view that send the email. small and simple and today work… Read more →

%d bloggers like this: