Author: Mattias Hemmingsson

Elasticsearch controller

So we uses alot of easticsearch. And here is i small script to get status and do some simple task with es server. You can get cluster status and cron for index deletions.   import urllib2 # # # Clean up elastich search index by removing old stuff. #The defult ip to es server dhost=’10.101.1.31′ #The index name you are… Read more →

Python DOS protection (iptables,dos)

here are a small script I use to have some sort of dos protection on my webservers.   import subprocess whitelist=[‘192.168.1.2’] blockvalue=2 alertvalue=1 proc = subprocess.Popen(“netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n”, shell=True,stdout=subprocess.PIPE) running = proc.stdout.read() runing_sorted = running.split(‘\n’) for r in runing_sorted: con =r.split() if len(con) ==2: #If… Read more →

Move an Megento site to new url

So I hade to move en megent site from topunder.se to test.topunder.se this is so that you can test and try new stuff on a site that is not you primary site. Moving magneto was some hazzel it not as easy as other site is take som sql to make it work.       First setup you webbserver  (This… Read more →

Foreman provision to bare and libvirtd (Centos7, foreman, libvirtd, KVM)

So I have started to play around with foreman and to get it to provision my diffrent servers. I started by starting up some local virtual servers on my laptop and played around with them. The flow is i started installing foreman as a virtual server. Then i provisin a new virtual server as bare matal (I created a virtual… Read more →

Build Openvpn centos 7

Here is how i build and setup openvpn on my centos 7 box. 1. Download and install openvpn latest Some yum packages   yum install openssl-devel lzo-devel pam-devel     https://openvpn.net/index.php/open-source/downloads.html   wget https://swupdate.openvpn.org/community/releases/openvpn-2.3.7.tar.gz tar zxvf openvpn-2.3.7.tar.gz cd openvpn-2.3.7 ./configure make make install # /usr/local/sbin/openvpn –version     So now we have the latest version setup and lets create some cert… Read more →

Python3 and rabbitmq

Im using rabbitmq in some of my python apps. Here is a small guide to get pyton3 to send and recive data from rabbitmq   I uses the code from https://code.google.com/p/py-amqplib/ And read some guide from http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/ from 2009 !!!!   Get the pip you need to connect sudo pip3 install amqp     My python code for sending and reciving… Read more →

Raspberry pi And Tellusd

Im using tellus to get info from my sensors like huminity and temp. And to get to work am using my rasp pi to recive and send siganls. Here is a quick guide to install and setup tellusd on you raspberry.   1. Verify that tellus is there pi@raspberrypi ~ $ lsusb Bus 001 Device 002: ID 0424:9512 Standard Microsystems… Read more →

Setup SPI on Raspberry pi (mcp3008, Adafruit)

Im building my own watering system and to that I will have some sensores.. They are connected to my pi over SFI and a mcp3008 from Adafruit.   The gear http://www.adafruit.com/products/1989 http://www.adafruit.com/products/856 http://www.kjell.com/sortiment/el/elektronik/elektroniklab/kopplingsplatta-lodfri-p87886 http://www.elecfreaks.com/store/octopus-soil-moisture-sensor-brick-p-422.html   Setup the cables Use this guide and se how the you should connect the mcp3008 and the sensore. http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/   Get the Pi ready  … Read more →

Php HHVM (aka the HipHop Virtual Machine) on Centos 7

To get my php projects running as fast as possible om trying to use hhvm. And here is my small guide how to install it on centos 7 I used the docs from https://github.com/facebook/hhvm/wiki/Building-and-installing-hhvm-on-CentOS-7.x   1. First setup you centos linux host   yum localinstall http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc}-devel \ {sqlite,tbb,bzip2,openldap,readline,elfutils-libelf,gmp,lz4,pcre}-devel \ lib{xslt,event,yaml,vpx,png,zip,icu,mcrypt,memcached,cap,dwarf}-devel… Read more →

Installing Go build server on centos 7

Installing the go build server in centos 7 with some easy step     1. First head over to the go page and have a look around http://www.go.cd/ 2. Download go server to you centos box   wget http://download.go.cd/gocd-rpm/go-server-14.4.0-1356.noarch.rpm wget http://download.go.cd/gocd-rpm/go-agent-14.4.0-1356.noarch.rpm 3. Install it First start by adding the go user (something broken in install) useradd go Now run yum localinstall… Read more →

%d bloggers like this: