Thursday 8 December 2016

Open Source & Cloud based Application Links


As I am using a lot of open source and cloud based applications I decided to start a list for reference:


https://insightmaker.com/

https://trello.com/



Friday 25 November 2016

SSH Tunnel



The easiest way to create a socks compliant ssh tunnel:

From the computer inside the network:

ssh -D [port number] -fN user@server
Then you can configure the application or service on the machine to access the remote server via the SSH tunnel and port configured.

e.g.


ssh -D 3333 -fN user@server.com

bfgminer -S opencl:auto --socks-proxy localhost:3333 --debug



Apple OS X - command line network commands




How to show the routing table:

netstat -nr

How to add a route:

sudo route -n add [ip address]/[subnet] [gateway]
e.g.

$ sudo route -n add 10.0.0.0/24 172.16.0.1

List open files (Determine what target IP and application/process is connected to)

$ lsof -i
e.g. To determine what IP a Citrix session is connecting to:
$ lsof -i | grep -E "Citrix"




Sunday 18 September 2016

Favourite Linux Applications

I know what applications you use for day to day tasks is a very personal affair, however i had numerious people asking me what I use daily and sometimes what alternatives to commerial software I am using as such I though I would list them for reference, obviously all of these fit my spesific requirements. Lots of the time the need for me is to have applications that can work cross-platform with some sorts of a mechanism to sync between operating systems / devices.



As operating system for home and general use I am using Kubuntu Xenial.


 Then there is a few out of the box KDE applications I can't live without:
 

For Audio management there is nothing better on this planet than Amarok and an application i will never be without.


  VLC Media player is that swiss army knive for media playback.


Then for IRC I find Konversation the easiest to use.




For that dreaded email world we wlive in nothing do the task better than KMail. It integrates well with Google and for me the use of OpenPGP and encryption from within KMail was very easy to use.


Then to ensure all those Keys as managed easily KGpg is a simple interface for GnuPG.


For backups I found Back In Time to perform the easiest for me nad do have a KDE GUI.


Then more generic applications I use:

Favourite and first choice web browser is FireFox, as i find the web developer tools and Greasemonkey integration valuable.





Second choice for browser is Google Chrome.




Whenever I am not using Dolphins' location bar to perform FTP functionality, I will be using FileZilla client.



The one text editor that stands out head above the rest for me at this moment is Sublime Text. With multi column layout, Syntax Highlighting and the command pallet to perform actions it surely increase the productivity for anything that needs to be done in a text editor.


For all those backups and transfers, nothing better than Rsync, and if I need to use a GUI the best out there is Grsync.



Calibre eBook library management and reader application is another of those applications I will never be without. The ability to tag, and create series for my magamzines as well as convert to the proper format for reading on any of the devices in the household is invaluable.



Another one of those swiss army knives for audio tagging and management is Musicbrainz Picard. Written in Python with the ability to use plugins.



DupeGuru ME (Music Edition) does a great job at identifying duplicates in music collections and can do so based on many criteria.



Puddletag is the best to view & edit custom MP3 tags. As I add things like BPM to my MP3 audio files via a Picard plugin, Puddletag is a great way to confirm the BPM field.

Then for the tagging and library management of multimedia files, I have found the best GUI application to be MediaElch. Ability to sort Movies and Series and spesify source folders is great. It uses multiple scrapers as well.


Then for more work related stuff I do use:


Keepass for those password



I use KRDC for all those remote desktop connectivity (RDP and VNC)


yEd from yWorks is great for BPMN, flowcharts and semantic diagrams with an easy abillity to auto arrange and export.



One of those Gnome apps that I do use frequently as well is Dia.


then there is nothing better for those documents andspreadsheets than LibreOffice.



Graphical disk usage Filelight




Tuesday 13 September 2016

Mount linux from OS X

If you need to mount an ssh/sftp volume and make it visible in finder to be able to use it as if it were a local volume you can use.

The easiest way is to install FUSE for macOS.


Sunday 19 June 2016

Edit PDF files in Ubuntu / remove text from PDF

Recently I had to remove a footer from a pdf document, as the document is over
100 pages and I need to do this on a monthly basis manual editing was not an option (oh and I am waaaay to lazy to do it manually)

After some research the following command line options worked like a charm:

Install qpdf and pdftk:

sudo apt-get install qpdf pdftk

Uncompress the pdf document:

qpdf --qdf --object-streams=disable source.pdf uncompressed.pdf

Then remove the text (footer) with the following sed:
sed -e "s/string to be removed/ /g" <uncompressed.pdf >removed.pdf

And lastly repair the pdf and compress it again.
pdftk removed.pdf output target.pdf compress

remember to clean up and remove all the interim files.


Monday 6 June 2016

Easy way to determine missing file on Ubuntu

If you experience something like the following:

libXi.so.6: cannot open shared object file: No such file or directory 
apt-file can come in very handy,


sudo apt-get install apt-file 
then the following commands to identify and install the correct object containing the missing file.

sudo apt-get install apt-file 
apt-file update
apt-file search libXi.so.6 
libxi6: /usr/lib/x86_64-linux-gnu/libXi.so.6
sudo apt-get install libxi6  

Saturday 28 May 2016

Plex Media Server - Recently added stuck in front

So i had an issue where few movies were stuck in fromt of the recently added queue.

Tried removing and re-adding them to Plex with no luck.

As the metadata for all the items are stored in a sqlite3 database the following procedure were used to correct the instances.

Steps to follow:

  1. Find the item you want to edit
  2. Find the database to edit
  3. Exit Plex and update the database file.

Item you want to edit:

Select the movie or episode in question and select "..." >  "Info" or "Get Info" > "View XML" Bottom left of the window.
The property "ratingKey" is the id you need to update in the database.
Note: The date/time is stored in Unix Time in the XML output.

Database location:

On Windows install a SQLite editor e.g. SqliteBrowser
The database is located at


%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db


by default or can be found from the web interface: Settings > Server > General > "

Open the database and select the "metadata_items" table.



Browse or search for the id with the value of ratingKey.
Update the time to the correct date/time, easiest would be to make the added_at value same as the created_at value.

Write/Save the changes back to the sqlite3 database and restart plex.



Command line:

This can be done from the command line as well with a command like:

UPDATE metadata_items SET added_at = created_at WHERE id=[value of ratingKey]



Wednesday 25 May 2016

Splitting FLAC files based on CUE

image from https://en.wikipedia.org/wiki/FLAC
Install the following packages
  • cuetools
  • shntool
  • flac

sudo apt-get install cuetools shntool flac

Now the FLAC file can be split as follows:

cuebreakpoints inputfile.cue | shnsplit -o flac inputfile.flac

The result will be as follows: 
split-track01.flac
split-track02.flac
....



Wednesday 4 May 2016

For when nohup is not available

So I recently had to execute a long running job on a bash shell,
however none of my usual tools like nohup, screen or tmux were available so below is the method I used to make sure I can start the job and disconnect the session.

  1. run the job in bash
  2. whilst running press ctrl-z (this will suspend the current foreground job (task)  )
  3. enter the job control command bg to add it as a background task
  4. then remove the job from the shell's job list disown -h 
  5. exit


Tuesday 19 April 2016

A4988 Stepper Motor Driver



Helping out a friend with a new laser engraver led to me having to debug the circuit containing the A4988 Stepper motor driver.

Whilst doing that I used the following circuit and code on a Arduino UNO to test the various components.


The circuit use the following baseline from the Pololu website



Things to note:

It is important that VMOT be in the 8-35V range (I use 12V)

The Circuit used:


And the code:


Loading Gist: https://gist.github.com/madmouser1/dc271f3ed70175d9bd8c0b6b4edb50b7

Saturday 2 April 2016

Ubuntu - merge Video files

The following applications can be used to concatenate video files.

Some ways to determine details of the media files :
ffprobe file.mp4
ffmpeg -i file.mp4

Extracting AC3 audio with FFMpeg

ffmpeg -i video.avi -acodec copy audio.ac3
or if there are multiple audio streams use the map to select the correct stream to extract

ffmpeg -i my_input_file.m4v -map 0:2 -c:a copy output_file.ac3 

MP4

sudo apt-get install gpac 
 MP4Box -add file1.mp4 -cat file2.mp4 NameofCombinedFile.mp4

Update:

And a way with ffmpeg (if all files are the same format):
ffmpeg -f concat -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy ../destination.mp4

Update2:

And to compress the mp4 afterwards for something like Youtube:
ffmpeg -i source.mp4 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart target.mp4
Update 3: 

to add a audio channel to a video file:
MP4Box -new -add OriginalMovie.mp4 -add Track2.mp3#audio:delay=300 Output.mp4

MKV

sudo apt-get install mkvtoolnix

mkvmerge [global options] {-o out} [options1] {file1} [[options2] {file2}] [@optionsfile] 

AVI

sudo apt-get install transcode transcode-utils
avimerge -i part1.avi part2.avi -o joinedfile.avi

 




Wednesday 30 March 2016

Plex - Amazon Kindle HDX




Recently the Kindle Fire HD stopped playing videos from plex, transcoding was active on the Plex server but still only sound played on the kindle.

After some research the following DLNA settings fixed the playback.

Select the Plex Server settings and "show advanced"
Select DLNA > DLNA client preferences:

Add the following:
IP=[IP of Kindle],DirectPlay=true,DirectStream=true,LocalResolution=1920x1080,RemoteResolution=1280x720,OnlineResolution=1280x720,LocalVideoQuality=74,RemoteVideoQuality=49,OnlineVideoQuality=49,SubtitleSize=100,AudioBoost=100,MusicBitrate=64

Sunday 6 March 2016

Ubuntu - Node link to nodejs


If you use nodemon or another nodule that refer to node and not nodejs you can create a symbolic link:



sudo ln -s "$(which nodejs)" /usr/bin/node

Wednesday 24 February 2016

showing progress whilst copying drive with dd


pv -tpreb /dev/sda | dd of=/dev/sdb bs=64M


The syntax is
 
pv filename
pv filename > /path/to/output
pv options filename | command1
pv options filename | command1 > output.file
pv filename | command1
command1 | pv | command2
pv -options input.file | command1 | pv -options > output.file