Archive
Tags
About
Dheerendra Mehar
DevOps | Programmer | Trader
Flood In The Jungle
Flood in the Jungle (100 Marks) A group of monkeys are living in Sunderbans forests. There are N trees in Sunderbans (numbered from O to N-l) on which these monkeys live. Every year floods hit the forest of Sunderbans The monkeys have a tradition of meeting on a tree after the flood. Last night Sunderbans has been hit hard by a sudden flood. The flood was very strong and it has submerged everything except the mighty trees on which the monkeys live.
Bob The Bear
Bob - The Bear (100 Marks) Bob is a grizzly bear and just like all grizzlies he loves hunting salmon fish. Bob has a strategy for catching salmons. He stands at the edge of the river and waits for the fishes to cross him. Whenever a fish comes in the same line as that of Bob, he catches it For the sake of the problem assume the river is flowing from left to right and Bob is currently sitting at x-coordinate = 0 (origin).
Ben - The Gamer
Ben - The Gamer (100 Marks) Ben is one of the best gamers in India. He also happens to be an excellent programmer. So, he likes to play games which require use of both gaming skills as well as programming skills. One such game is SpaceWar. In this game there are N levels and M types of available weapons. The levels are numbered from 0 to N-1 and the weapons are numbered from 0 to M-1.
Ruby Necklace
Ruby Necklace (100 Marks) It is the wedding day of Sanchi, the beautiful princess of Byteland. Her fiance Krishna is planning to gift her an awesome ruby necklace. Krishna has currently b-blue rubies, g-green rubies, r-red rubies and y-yellow rubies. He has to arrange the rubies next to each other in a straight line to make the necklace. But, there are a couple of rules to be followed while making this necklace:
How to get Internet on a server using Squid Proxy and SSH port forwarding
Do the setup as follows: Setup on Host A: Install proxy server Squid on Host A . By default Squid listens on port 3128. yum install squid Comment the http_access deny all then add http_access allow all in /etc/squid/squid.conf If Host A itself uses some proxy say 10.140.78.130:8080 to connect to internet then also add that proxy to /etc/squid/squid.conf as follows: refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 cache_peer 10.140.78.130 parent 8080 0 no-query default never_direct allow all Setup on Host B:
How to create a cronjob using Ansible
How to create a cronjob using Ansible: --- - name: Playbook to add new entries in crontab hosts: all remote_user: user_name tasks: - name: check whether user_name has permission to create crontab shell: 'grep "user_name" /etc/cron.allow' register: user_status failed_when: "user_status.rc == 2" changed_when: false become: yes - name: Add user to /etc/cron.allow if it doesn't exist shell: 'echo "user_name" | sudo tee -a /etc/cron.allow' when: user_status.rc == 1 - name: add new crontab entry if the user is newly added shell: 'echo "43 15 * * * /bin/bash /home/user_name/script_name.
Running pwdx $(pidof java) command on remote nodes
Script to get output of pwdx $(pidof java) command #!/bin/bash if [ "$1" ]; then echo "you are good to go" else echo "Usage: $(basename "$0") takes an ip file as input" exit fi if [ -s "$1" ]; then echo "Good!Got something inside the file" while IFS= read -r line # IFS= before read to avoid removing leading and trailing spaces do { remote_output="$(ssh -qni <path-to-your-private-ssh-key> <username>@"$line" "pgrep java | xargs pwdx")" echo -e "$line""\n""$remote_output""\n" | tee -a pwdx_output.
Upgrading VMWare Tools and Network adapter from E1000 to VMXNET3
VMware tools installation: You can install VMWare tools manually or automatically. Sometimes you don’t have any choice except to install manually. Automatic Installation: Right click on the VM -> Guest -> Install/Upgrade VMWare tools Choose Automatic Tools Upgrade and click on OK. Installation will take some time, you can see it’s status in Tasks shown at the bottom of the window. Manual Installation: Right click on the VM -> Guest -> Install/Upgrade VMWare tools Choose Interactive Tools Upgrade and click on OK.
Disabling VLC volume increase
If you use the VLC player, it is suggested that you do not increase the volume higher than 100% in order to avoid potential damage to speakers. Why is it needed? Increasing volume above 100% in VLC can damage your speakers. Dell and HP do not cover this damage under warranty. Why does it happen? The VLC player can allow large power output through speaker than the original sound output.
Older Posts
→