Wednesday 24 December 2014

Thursday 16 October 2014

nano syntax highlighting

git clone https://github.com/nanorc/nanorc.git
cd nanorc
make install
echo 'include ~/.nano/syntax/ALL.nanorc' >> ~/.nanorc

Thursday 26 June 2014

how I resolved nrpe configure: error: C preprocessor /lib/cpp fails sanity check

rpm -qa | grep glibc

see all glibc installations

for example, on a problem machine I found:

glibc-2.12-1.80.el6_3.5.i686
glibc-2.12-1.80.el6_3.5.x86_64
glibc-common-2.12-1.132.el6_5.2.x86_64
glibc-devel-2.12-1.132.el6_5.2.x86_64
glibc-common-2.12-1.80.el6_3.5.x86_64
glibc-2.12-1.132.el6_5.2.x86_64

yum erase glibc\*

install headers

yum install glibc-headers.x86_64 0:2.12-1.132.el6_5.2

fixed

Wednesday 18 June 2014

Where can I download Sql Server Management Studio 2012

Microsoft didn't make it easy to find..

read the whole post before clicking the link and deciding this is the wrong download :)

when finished reading, go to link at bottom of this post:

is will say sql server 2012 express, ignore that, click download, a new window will pop up, tick the box

ENU\x64\SQLManagementStudio_x64_ENU.exe
click next, download will start

http://www.microsoft.com/en-us/download/details.aspx?id=29062

Tuesday 17 June 2014

using sqlserver jdbc driver with maven

Download the driver JAR from the link provided by Olaf and add it to your local Maven repository with;

mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0 -Dpackaging=jar

Then add it to your project with;

<dependency> 
     <groupId>com.microsoft.sqlserver</groupId> 
     <artifactId>sqljdbc4</artifactId> 
     <version>3.0</version> 
</dependency>

Monday 9 June 2014

install cassandra 2+ as service from package

the documentation on datastax website is out of date, to install the latest version of cassandra as a deb package and have it run as a service, enter the following in to terminal:

gpg --keyserver keyserver.ubuntu.com --recv 4BD736A82B5C1B00

gpg --export --armor 4BD736A82B5C1B00 | sudo apt-key add - && sudo apt-get update

sudo apt-get install cassandra

Sunday 8 June 2014

#!/bin/bash - no such file or directory

This can be cause by an extra carriage return at the end of the first line

execute the following in termial:

head -1 yourscript | od -c

if it ends with \r \n then it is not in the correct format.

if it ends with \n with no \r preceding that, then it is correct.

to fix the file, use dos2linux

sudo apt-get install dos2linux

dos2linux yourscript

remove hidden files that show on desktop in osx

Sometimes its good to see hidden files in finder, but its annoying that they show up on the desktop.

If you want to stop these showing, here is the command to run in terminal:

defaults write com.apple.finder CreateDesktop -bool false && killall Finder

to make them appear again, use:

defaults write com.apple.finder CreateDesktop -bool true && killall Finder

Saturday 7 June 2014

linux: fatal error: pyconfig.h: No such file or directory

This error is most likely produce by not having the correct dependencies installed.

Run the following command:

sudo apt-get install python-dev libxml2-dev libxslt-dev

Thursday 5 June 2014

linux: cannot open shared object file libudev.so.0

For a 32-bit system:

sudo ln -sf /lib/i386-linux-gnu/libudev.so.1 /lib/i386-linux-gnu/libudev.so.0

For a 64-bit system:

sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0


Wednesday 28 May 2014

Windows vcvarsall problem

This is taken from: stackoverflow answer: building-lxml-for-python-2-7-on-windows

There's def find_vcvarsall(version): function (guess what, it looks for vcvarsall.bat) in distutils with the following comment

At first it tries to find the productdir of VS 2008 in the registry. If that fails it falls back to the VS90COMNTOOLS env var.

If you're not using VS 2008 then you have neither the registry key nor suitable environment variable and that's why distutils can't find vcvarsall.bat file. It does not check if the bat file is reachable through the PATH environment variable.

The solution is to define VS90COMNTOOLS variable to point to Tools directory of Visual Studio.

That being said take a look at 11.4. distutils.msvccompiler — Microsoft Compiler section in Python's docs which states

Typically, extension modules need to be compiled with the same compiler that was used to compile Python.

Martin v. Loewis in the email titled Download Visual Studio Express 2008 now on python-list mailing list states the same

Python 2.6, 2.7, and 3.1 are all built with that release (i.e. 2008). Because of another long tradition, Python extension modules must be built with the same compiler version (more specifically, CRT version) as Python itself. So to build extension modules for any of these releases, you need to have a copy of VS 2008 or VS 2008 Express.

SET VS90COMNTOOLS=%VS100COMNTOOLS%

Sunday 18 May 2014

the path is not a valid path to the kali kernel headers vmware tools

using root

append

deb http://http.kali.org/kali kali main contrib non-free

to

/etc/apt/sources.list

apt-get update

apt-get install build-essential linux-headers-$(uname -r)

ln -s /usr/src/linux-headers-$(uname -r)/include/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

now install vmware tools

done

Tuesday 13 May 2014

install ruby 2.1 ubuntu

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:brightbox/ruby-ng 

sudo apt-get update 

sudo apt-get install ruby2.1 

ruby2.1 -v 
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux-gnu]

using .ruby-version instead of .rvmrc

imagine you want to create a my ruby application called myrubyapp which will use ruby version 2.1.0

/bin/bash --login

rvm --create --ruby-version use ruby-2.1.0@myrubyapp


previously, you would have had a file .rvmrc, inside your myrubyapp dir, and in it would have been:

rvm use 2.1.0@myrubyapp


now, you would not create the .rvmrc file, and instead, create two files as follows: 

create a file named: .ruby-version:

in it, enter: 2.1.0

create a file named: .ruby-gemset:

in it, enter: myrubyapp

all done...

Monday 12 May 2014

enable .net 4.5 IIS 8 Windows Server 2012

in powershell, enter:

dism.exe /Online /Enable-Feature /all /FeatureName:IIS-ASPNET45

Monday 21 April 2014

Install Java 8 Ubuntu

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

Wednesday 2 April 2014

sstable2json for cassandra usage

I found the documentation to be incorrect, but this is how I use it on aws:

sudo touch /jsonfile
sudo chown ubuntu:ubuntu /jsonfile

sudo /cassandra/bin/sstable2json /cassandra/data/keyspacename/sstabledirectory/sstablename-data-db > /jsonfile

enjoy (thats not part of the code)

Tuesday 25 March 2014

Convert wmv to mp4 for free

When you look around for solutions to this problem, you are usually met with either paid software, or free software bundled with spyware. When all along, there has been ffmpeg, an application that will convert most formats, and is freely available with a big community, and no spyware.

To convert an wmv to an mp4, heres what you need to do:

For Windows:

Download the ffmpeg application here:

http://ffmpeg.zeranoe.com/builds/ (pick 32 or 64 bit as required)

If you dont have 7zip, download it here 

http://www.7-zip.org/download.html

and install it.

Now extract the ffmpeg 7zip file. Now navigate in to the extracted directory and see a file called:

ff-prompt.bat

double click it to open the ffmpeg command prompt. With the command prompt open, type this command and press enter to begin the conversion:

ffmpeg -i c:\pathToInput.wmv -f mp4 -s 500x400 -strict -2  c:\pathToOutput.mp4

For Linux, do:

sudo apt-get install ffmpeg

open terminal, and run command:

ffmpeg -i /pathToInput.wmv -f mp4 -s 500x400 -strict -2  /pathToOutput.mp4



Convert flv to mp4 for free

When you look around for solutions to this problem, you are usually met with either paid software, or free software bundled with spyware. When all along, there has been ffmpeg, an application that will convert most formats, and is freely available with a big community, and no spyware.

To convert an flv to an mp4, heres what you need to do:

For Windows:

Download the ffmpeg application here:

http://ffmpeg.zeranoe.com/builds/ (pick 32 or 64 bit as required)

If you dont have 7zip, download it here 

http://www.7-zip.org/download.html

and install it.

Now extract the ffmpeg 7zip file. Now navigate in to the extracted directory and see a file called:

ff-prompt.bat

double click it to open the ffmpeg command prompt. With the command prompt open, type this command and press enter to begin the conversion:

ffmpeg -i c:\pathToInput.flv -f mp4 -s 500x400 -strict -2  c:\pathToOutput.mp4

For Linux, do:

sudo apt-get install ffmpeg

open terminal, and run command:

ffmpeg -i /pathToInput.flv -f mp4 -s 500x400 -strict -2  pathToOutput.mp4


Monday 20 January 2014

find large files on linux hard drive

sudo find / -name '*' -size +1G 

sudo find / -name '*' -size +500M

or 

sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'