Support LQ: Use code LQ3 and save \$3 on Domain Registration
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org General

Notices

- - - - - As of February 1st 2014 this blog is no longer updated - - - - -
General General tips, tricks and other handy stuff

Convert Metric <-> Imperial

Posted 01-03-2014 at 05:14 AM by druuna
Updated 01-31-2014 at 04:24 AM by druuna
Tags

Converting from metric to imperial and vice versa using bc.

Here are a few examples in the form of functions:

# -------------------------------------------------------------------------- #
# - Imperial to metric
# -------------------------------------------------------------------------- #

• pounds to kilograms
PHP Code:
``` # Function : lbToKg # Syntax   : lbToKg <pounds> # # Convert pounds to kilogram function lbToKg() {  ```
...
LQ Veteran
Posted in General

Convert numeral systems (dec <-> bin <-> hex <-> oct)

Posted 12-10-2013 at 04:41 AM by druuna
Updated 01-31-2014 at 04:24 AM by druuna
Tags

Converting from one numeral system to another can be done using the bc command.

Here are a few examples in the form of functions:

# -------------------------------------------------------------------------- #
# - Decimal to ....
# -------------------------------------------------------------------------- #
• Binary
PHP Code:
``` # Convert decimal to binary function decToBin() {   echo "obase=2;\$1" | bc }  ```
Code:
```\$ decToBin 19
10011```
...
LQ Veteran
Posted in General

Date and time functions

Posted 12-09-2013 at 12:34 PM by druuna
Updated 01-31-2014 at 04:25 AM by druuna (Small changes to layout)
Tags

A handful of date and time related functions that might come in handy.
• Convert a date or time string to seconds from epoch
PHP Code:
``` # ------------------------------------------------------------------ # # Function : dateToSecs # Syntax   : dateToSecs "[date]" # Convert a date or time string to seconds from epoch. # ------------------------------------------------------------------ # function dateToSecs() {   [[ \$# -eq 0 ]] && date --utc  ```
...
LQ Veteran
Posted in General

RHEL local DVD Repo

Posted 04-23-2013 at 04:37 AM by druuna
Tags

This article describes how to make a local repository from a RHEL installation DVD.

First and foremost:
Warning: RHEL is not a free product.

To get access to the fully up-to-date repositories (RHN) a paid subscription is needed.

Without this subscription it will not be possible to get security updates and the newest versions of packages.

An alternative for using RHEL would be CentOS or Scientific Linux. Both are free and almost identical
...
LQ Veteran
Posted in General

Resources / References / Useful links

Posted 02-25-2013 at 08:16 AM by druuna
Tags

LQ Veteran
Posted in General