Hexa's Blog

Using command 'sudo' without password

18/03/2014 Linux

In the daily work, I may have to type sudo your_command and your password many times, it costs your time, in my case, it makes me feel crazy. The solution is that, you will add command which you mostly type into a list, then, when you want to type it with prefix sudo it wont ask you for password.

You have to modify file sudoers in /etc/sudoers. For example, you want to run command such as “yum”, “apachectl” without passwor

#1. Find the path of those commands by using command which in this case, those commands locates in /usr/sbin/apachectl and /usr/bin/yum.

#2. Modify file sudoers

username ALL=(ALL) NOPASSWD = /usr/sbin/apachectl, /usr/bin/yum

Now, you can run those command without password, REMEMBER, You still need prefix sudo

Command Alias, this feature will help you save your time if you want to assign group of command, for example, you have 2,3 user or group, it should be not convenient to type similar commands many times. Now, what you have to do is group them all, then use the command alias instead!

Cmmd_Alias CommandAliasName = /pathToCommand1, /pathToCommand2, /pathToCommand3
username1 ALL=(ALL) NOPASSWD = CommandAliasName
username2 ALL=(ALL) NOPASSWD = CommandAliasName

Ruby On Rails: Javascript did not active after follow a link

02/03/2014 Ruby on Rails 4

Description: After writing javascript code, There is an error, when users click on the hyperlink, javascript does not run. However, if users refresh the web page, javascript run automatically.My project using Jquery.

Instead of writing code like:

$(document).ready ->
  alert("page is load")

You should write:

$(document).on "page:change", ->
  alert "page has loaded!"

File Transfer, first child of my programming life

02/03/2014 Projects

I write this program to transfer files between Window and Linux computer.I knew that there are a software which already solved this issue. However,I believe that It could be an extra solution for you guy.

By using this software (required available LAN network), you can save time when transfer file to another computer.

1: Window vs Window, Microsoft support file sharing, It is absolutely good. However, setting FileTransfer as a plan B is a good practice

2: Window vs Linux, Linux vs Linux. Firstly, I write this software because I am a full-time Linux user. During using time you could face a case that you want to share file, it should be wasteful if you choose to upload your file to google drive, attached in gmail or any remote repository. Using this software saves your time and increases your performance.

Currently, this software allows users to sends file by once, if you want to send again, press send again after sending completely, or open two program. Anyway, I will enhance this feature soon, and it depend on the demand of users or only me. If you are interest in my FileTransfer, You can clone it with the branch “master” I also attach a jar file. FileTransfer.jar. It is an executable jar file.

Known issue: The speed of FileTransfer is low, approximately 0.5MB/s. The reason is that I did not cut file into multiple parts and transfer it concurently, this software send file in only one connection.

Link Download: https://github.com/nguyenvinhlinh/FileTransfer.git

Enjoy it.