Generate a random string using the command line:
cat /dev/urandom | tr -cd [:graph:] | head -c 32 On OSX, the previous command might return a tr: Illegal byte sequence error, so try:
export LC_ALL=C; cat /dev/urandom | tr -cd [:graph:] | head -c 32
A command so important, it deserves its own page:
git reset --soft HEAD~1 The previous command undoes the last commit to git. I think this is one of those commands that I have typed many times during the last year. It’s very important to know which branch we currently are on, but sometimes excitement (or stress) may make us forget checking it.
If this is not enough, then we can reset our branch to master like this: (this will lose all our changes):
Netbeans is one of my beloved day to day applications. Yesterday, when I installed Ubuntu 15.10 (Wily Werewolf) on my computer, Netbeans started to hang on the startup screen, specifically at the Loading Modules phase. It took me hours looking for solutions on the internet; and reinstalling different versions of the Java Development Framework didn’t seem to help.
Finally I found the following fix at an Ubuntu forum, which turned out to be very simple to apply.
If you are new on the Linux platform, I am sure you feel overwhelmed with all the different versions available. Choosing one is not an easy task, and each version has its own pros and cons.
Let me tell you why I like CentOS:
It is very stable It has well tested features There is a big community around it It has many large software repositories It is Part of the RedHat / Fedora family Installing CentOS Installing a new operating system may seem challenging, but CentOS has always made this task a simple one.
The CentOS distribution is a famous and stable Linux version derived from RedHat Linux. It’s been one of my favorites and one that you can easily find with hosting providers.
In this article we will install CentOS and OracleXE. It’s worth mentioning the OS team improves the installation process with each version, and you will find out in this tutorial how straightforward it currently is.
1. Installing CentOS We’ll perform a minimal installation; this means, we will not install a graphical interface, because this server is meant to be a web / database test server.
Redirecting all your program output to a file is very simple and can be accomplished like this:
myapp > output.log This line will send all the output generated by myapp to a file named output.log. The contents of output.log will always be overwritten; but you can use a second > to append to the current content like this:
myapp >> output.log As well as with output, it is very useful to redirect the stderr (standard error output) to a file rather than to the screen.
Java 1.5 is the default Java version you get when you ask yum to install it on CentOS. However, several applications need 1.6 in order to run. Just follow the next steps to install it.
Remove Java 1.5
yum remove java-1.5-* Install the rpmforge repository
cd rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt Check if you have a 32 or 64 CentOS version
uname -a For 32 versions (i686) download and install the following repository
iptables is the default firewall you see on any linux computer. It works by allowing (ACCEPTing) or denying (DROPing) connections to the local computer. There are basically three scenarios you can deal with:
INPUT: Connections generated from a different computer targeting yours; for example, when you run a web server on your computer and others want to connect to it. OUTPUT: Connections generated from your computer targeting other computers; for example, when you open a web page or open a remote ssh session.
The first step is to configure the repositories. Create the following file /etc/yum.repos.d/10gen.repo with the following contents:
For 32-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1 For 64-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1 Install Mongo
yum install mongo-10gen mongo-10gen-server Configure MongoDB You can configure Mongo by editing the following file:
/etc/mongod.conf Set Mongo to autostart on system boot:
chkconfig mongod on Start Mongo
service mongod start Stop Mongo
Install the development environment Install the C/C++ development tools to your server:
yum install gcc gcc-c++ autoconf automake Now, before installing fcgi we need to add the epel repository:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm Once it is installed we can proceed to get the fcgi packages:
yum install fcgi-devel spawn-fcgi Let’s see if we can compile a simple file. Create a file named example.c and copy and paste the following code in it: