Last day at Micron

After around 1.5 years I am leaving Micron. It has been a great journey here. Although I have worked full time in another two companies, this was the first job that I liked.

The benefits were good and work was also good. Although didn’t have a lot of learning opportunities in the department, I managed to utilize my time effectively learning new things and trying out many things to troubleshoot user issues. This has actually given me some confidence that I can manage to be in a highly technical position. I also believe that the work I have done here will keep my memories here too.

I am moving to a new position as Cloud Engineer in a small company called 1Cloudstar. My previous experience with a small company was bad, and I hope this won’t be the same. I have been hoping to be in the cloud industry for some time, and when I got this offer, I decided to go forward with it even though the money that I am getting will be go down deeply. Any way, I took the decision, and I hope that this decision is a deal breaker in my career.

Looking forward to learn new technologies, meet new people, learn soft skills and to have responsibilities. 🙂

My experience with RHCE and RHCSA exams

In one word, I can say the following:

RHCSA – Easy

RHCE – Doable

Although I have been using desktop linux , particularly Ubuntu for a while, I never had a chance to do proper system administration. So in a way, I was a fresher. One advantage I had was that I had some domain knowledge on how all these things works, and some things in general. So the terms were not aliens to me.

For exam prep, I did an online course by IPSR, a training institute from India. They claims to have produced the most number of Red Hat professionals in the world. One thing that I can assure is that their training is good. Even if the course is not taken, it is really good to do mock exams using their practice papers.

Coming to the exams, they follow a pattern. RHCSA was 2.5 hours exam, but they were following an exactly similar pattern of questions as that from IPSR’s practice papers. Once you are familiarized with these questions, it is almost 100% chance to pass this exam. In fact, there are people who learn these answers by-heart and pass the exam. There are a lot of model questions that I found online, but most of them wont help for this exam ( They help for real life situations for sure ). I managed to complete the exam in just over an hour, and managed to score 294 out of 300.

Verdict : Simple

For RHCE also, the questions follow a pattern. IPSR’s questions help us familiarize with them too. But unlike RHCSA, the content is huge, and you cant just pass by learning them by heart. You really need to understand the concepts and learn how to apply them. Its a 3.5 hours exam, and it will take you at least 3 hours to finish all.

In my case, I was really confident on the exam, and started doing well. At around 2.5 hour point, I had completed 2/3rd of the questions. But for the next question, I did a huge mistake and messed up the whole partition in my server machine. It was not able to boot up, so I had to start from scratch at that point. My client was still there, so I had to redo everything that I did in the server again. I only managed to reach the 2/3rd point by the end of 3.5 hours.

I thought I would fail, but when the result came, I passed with 232 out of 300. I think it is good to say that dont attempt the question if you dont know. It is better to leave it there rather than messing it up.

Verdict : Doable, but need to do proper time management, and should have enough knowledge on commands and how to read through man pages.

I did the exams on Dec 2016

How to display a pop up message in a remote computer using powershell

In my daily work, there are times which I need to contact a user who is using a particular PC, but they don’t respond. Mostly, I need to contact them to inform about something, or get them to reboot, or install something etc. There are some cases which it is not possible, such as :

  • They use a generic account which is shared, so we can’t find who exactly is using that PC
  • They are logged off from IM
  • They don’t respond to IM or just ignore them.

In these kind of cases, it is easier if we have some way to forcefully push a message to the PC. I found an easy solution from internet that can do this in every computer that you have admin access.

Open a text editor and add the following in it, then save it with .ps1 extension.

Function remote_message{

$server = read-host -prompt ‘Input PC name’;
$message = read-host -prompt ‘Enter the message’;

Invoke-WmiMethod -Class win32_process -ComputerName $server -Name create -ArgumentList  “c:\windows\system32\msg.exe * $message” }

remote_message

To run this, open powershell, then navigate to the saved location and run. And follow the input prompt.

remote_message

No matter who is logged in the remote PC, they will get the message pop up on top of all their windows.

remote_message_2

 

How to remove UAC prompt for a software in Windows

[This was originally published in my another blog on July 2016.]
Today I received a support request from a user who is facing issues while running a macro script. He was facing Run-time error 429 : ActiveX Component cannot create object.

Though I have never written macro, I decided to give a try. When clicked the debug button I got the following message.

OK. Data navigator is an internal software that we use for pulling some data. This message showed that this error has something to do with the Data Navigator. Its installed properly and is working fine when opening. However when compared to another PC which has no issue in running the script, found a small difference, there is a UAC Prompt in this PC when opening the software.
I am not sure why in some PCs it has this prompt while others not. Anyway I decided to find a way to remove this prompt and try again.

A quick google search brought me here.

Following the instructions, I downloaded and installed Microsoft application Compatibility toolkit. Once done, you will see 32 and 64 bit versions.

Take note that even if you have a 64 bit OS, the 64 bit version can only be used for 64 bit software. For my case, I have a 64 bit OS, but the data navigator is a 32 bit software.

Once opened the software, click on the Fix button.

Enter the necessary information.
Click Next and select the RunAsInvoker checkbox.
Click the Test Run button to make sure that there is no prompt when opening the mentioned software.

Click Next and make sure that the RunAsInvoker is checked there also.

Click Next, followed by Auto Generate from the next screen.
Click Finish

Now, we need to save the database. For that, click the Save button, and give the database a name.
Provide the save location when prompted.

Click on File, and then Install the database.
Now, click OK and close the Compatibility Administrator. Go to the Start menu and right-click your application, select properties and select the Advanced button. Make sure that  Run as administrator checkbox is cleared. Click OK.
Now click the Compatibility tab, then Change settings for all users and tick the Run this program as an administrator checkbox.
VOILA !! We are done.

This made the macro to run properly, and made my user really happy. I hope this helps you all too.

Year in review – 2016

[This post was originally published in my another blog, which I deleted in favor of this. It was published on Jan 1, 2017]

Its the new year. 2015 was really a bad year for me. I was hospitalised twice, had to undergo surgery, made some bad decisions, ahh..it was terrible.

But 2016 was probably the best year I had in years. The year started with a job in Micron, which is not really a bad job. At least I dont mind going there unlike my previous jobs. I learned quite few things, and its where I realised that my field is System Administration, not programming.

When the year started, I had some targets to do, such as :

  • Start hitting the gym
  • Gain some weight
  • Complete System Admin course and get the certification
  • Build this website

Really happy to say that I managed to do all these. Since started hitting the gym, I gained almost 9 kg of weight. I reached 60kg from 51kg in 9 months, which is remarkable considering the fact that I barely increased any weight since I came to Singapore. I also completed the Red Hat system adminstration course, and got the certificate, RHCE and RHCSA. Although I couldn’t take LFCS exam in 2016, I will take it in first week of 2017. Finally, building this website was one of my long time dreams, and finally it became true. I am not sure how often I update this, but nevertheless, a website is a website.

update: Passed LFCS exam on Jan 7th

For 2017, I have some targets. These are a bit more tougher than what I had in 2016, but if I can manage to get them done, that is going to be great. [hiding them now, because I am shy]

  • Reach xxxx
  • Learn xxxx
  • Buy xxxx
  • Complete xxxx
  • [Bonus: Get a xxxxx]

Let us see how it goes.

How to use your Raspberry pi to download movies automatically

DISCLAIMER: 

  • This is for educational purposes only. Do everything at your own risk. Using bit torrent is not illegal, but downloading copyrighted materials are.
  • Do not use this in a production environment. We are considering zero security in this case.

What we are going to build:

An always on torrent box that periodically checks for new torrents as defined and download them.

What we will be using:

•    Raspberry pi 3 model b with Raspbian Jessie installed.
•    Official raspberry pi 3 PSU as third party PSU’s may not provide enough power
•    External HDD
•    USB fan or heatsink (Recommended, not necessary)

mysetupmy current setup

Assumptions:

•    You have vnc / physical access with GUI to your pi
•    You have a user named pi with sudo access (this available by default)
•    You know the password of user pi

Note: We will be doing most of the configurations in a terminal.


1) Install and enable apache webserver
This will help to access the contents over a webserver. Install it by typing

sudo apt-get install apache2

Once installed, start and enable it

sudo systemctl enable apache2
sudo systemctl start apache2

Give everyone full permission to the documentroot. [This is not safe at all in  a production environment.]

sudo chmod 777 /var/www/html

2) Connect the hard disk, create mountpoint and setup automount

•    Connect your hard disk to the pi. Make sure that it works by accessing the contents. If you see a lightning bolt symbol on the top right corner of the screen, that means the pi is not getting enough power to work properly. Use the official PSU in this case.
•    Open a terminal, and see where the hard disk is mounted, by using the following command

df

In this case, it is mounted in /var/www/html. This will not be your case. It will probably in something like /media/pi/xxx . Whatever it is take note of it. Let us call this value as initial_mount_point

•    Get the block id of the hard disk. Take note of the value starting from UUID

•    Configure fstab so that the hard disk will mount to a certain point after reboot

sudo nano /etc/fstab

• This will open the fstab file in nano text editor in the terminal. Navigate to the end of the line, and type the following

UUID=”xxxxxxxx” /var/www/html ntfs defaults 0 0

Where “xxxxx” is the block id that you got from the previous step.

Type CTRL+O to save and CTRL+X to exit the editor.

•    Unmount the hard disk from initial mount point

sudo umount initial_mount_point

where initial_mount_point is what you got from the first step, which is something like /media/pi/xxxx • Now mount the hard disk to the new mount point.

sudo mount –a

• Verify that it worked by typing the df command. You should get output like this.

3) Install and configure flexget

Felxget will be the tool that we use to download torrent files based on our preferences. The following information is from their website.(https://www.flexget.com/InstallWizard/Linux)
•    Python
FlexGet requires Python 2.7, 3.3 or newer to run. You can check your version with command.

python -V

If it is not available, install it by using the following command in terminal

sudo apt-get install python3.5

PIP

Second piece of required software is python package manager called PIP. This can be usually found from operating system package repository under name python-pip or python3-pip. If you install python3-pip it may need to be used via command pip-3.5 or something similar.
Install it by using the following command
sudo apt-get install python-pip5

• Upgrade setuptools

Using latest setuptools will save headaches in some older installations, this can be achieved with
sudo pip install --upgrade setuptools

• Install in a virtualenv

This is the recommended way unless you want multiple accounts in the system to be able to use FlexGet without each having to install it themselves.

Install virtualenv:

sudo pip install virtualenv

Create Virtualenv: This creates isolated python environment. You can create as many of these as you like for each python application you use.

virtualenv ~/flexget/

Install FlexGet in the virtualenv:

cd ~/flexget/
bin/pip install flexget

Create a folder to save the torrent files that are downloaded.

sudo mkdir /home/torrents
sudo chmod 777 /home/torrents

Configure flexget to download torrents automatically

This is the most important and confusing part. Here I am sharing only what I did and found to be working. You can find many other configurations from here and here.

We will configure only to download new Malayalam movies published in extratorrent.cc , English movies published in yts.ag and new episodes of Sherlock from anywhere.

To do that,
Navigate to the install directory

cd ~/flexget

Create a configuration file using nano editor

nano config.yml

Type the following:

tasks:
  Download Sherlock:
    rss: https://showrss.info/show/269.rss
    series:
      – Sherlock
    regexp:
      accept:
        – 720p
    download: /home/torrents/
  Download movies:
    rss: http://extratorrent.cc/rss.xml?type=search&search=malayalam+2016
    regexp:
      accept:
        – DVDRip
      reject:
        – cam
        – 2GB
    download: /home/torrents/
  Download english movies:
    rss: https://yts.ag/rss/2016/720p/all/5
    regexp:
      accept:
        – yts
    download: /home/torrents/

IMPORTANT: DO NOT USE TABS, INSTEAD USE SPACES. WATCH THE ABOVE VIDEO AND READ THROUGH THE SITE FOR MORE INFO ON HOW TO FILL THIS FILE

CTRL+O and CTRL+X to save and exit

•    Test the configuration
Navigate to the flexget install folder and make it executable

cd ~/flexget/bin
sudo chmod +x flexget

Test the configuration by following command:

./flexget --test execute

If your output is similar to the following, there is something wrong with your config.

 

If everything is OK, you will get something like this:

Now let us execute flexget to download the torrent files.

./flexget execute

This will download the torrent files to the folder we created earlier, to /home/torrents. Let us verify

ls /home/torrents

There will be a lot of .torrent files. Mine has that .added name because all of them are already completed downloading.

4) Install and configure transmission to download the files using the torrent files already downloaded.

sudo apt-get install transmission-gtk

Open transmission from the start menu

Go to edit-preferences, Set the speed limits you want from Speed tab


In the downloading tab,

In automatically add .torrent files from, select /home/torrents folder Untick show the Torrent Options Dialog Tick Start added torrents In Save to Location, navigate to your hard disk mount point, which is /var/www/html and select the folder you want.

You can leave the other settings as it is, or change it if you need. Now wait a few minutes and you can see that the torrents start downloading.

5) Configure flexget to check for torrents periodically

We will setup flexget to check for new torrents every hour and download it if found. For that, we will use crontab, which is pre installed in the system.

Open crontab by following command:

crontab –e

This will open the crontab file in a text editor. Navigate to the end and add the following lines:

# to run flexget without generating log files
20 * * * *  /home/pi/flexget/bin/./flexget execute

# start transmission-gtk version minimized if it is not already running
*/30 * * * * export DISPLAY=:0 && if pidof -x /usr/bin/transmission-gtk; then exit; else /usr/bin/transmission-gtk -m; fi &

CTRL+O and CTRL+X to save and exit

By now, you have your pi configured to check for new torrents every hour and download it to the hard disk connected to it. In the following steps, we will make it accessible via a web browser or as a network drive.

6) Configure a static ip address to the pi

sudo nano /etc/dhcpcd.conf

Go to the end of the file and add the following:

interface eth0

static ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface wlan0

static ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Here, you need edit based on your needs. My router address is 192.168.1.1 and I set my ip to be 192.168.1.200

7) Configure apache web server.

We will use the default configuration settings here. To verify it,

sudo  nano /etc/apache2/sites-enabled/000-default.conf

Just make sure that the DocumentRoot is set to be /var/www/html. If it is not, edit it. Mostly there is no need to edit.

Restart the web server

sudo systemctl restart apache2

Verify that it works by going to the webpage from a browser. Note that this device should be connected to your home network. You should be able to access the hard disk contents now.

You will be able to watch videos from your browser.

8) Install and configure samba for using as a network drive

sudo apt-get install samba
sudo nano /etc/samba/smb.conf

This will open samba configuration file in nano. Go to the end of the file and type the following, and save and exit.

[movies]
  path = /var/www/html/
  public = yes
  read only = yes
  guest ok = yes
  browseable = yes

Enable and restart samba.

sudo systemctl enable smbd
sudo systemctl restart smbd

Now you can map this as a network drive in your windows PC. To do this in windows 10, right click My PC, then click Map network drive.

Enter the ip address and share name as follows. Share name is movies as we configured earlier. Check connect using different credentials. Enter username as pi and the password to connect.

You should have it connected as a drive now.