LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


- - - - - As of February 1st 2014 this blog is no longer updated - - - - -
Old
Rating: 2 votes, 4.50 average.

Convert Metric <-> Imperial

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

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
Views 3534 Comments 0 druuna is offline
Old

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

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

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
Views 3769 Comments 0 druuna is offline
Old

Date and time functions

Posted 12-09-2013 at 11:34 AM by druuna
Updated 01-31-2014 at 03:25 AM by druuna (Small changes to layout)
Tags date, seconds, time

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
Views 2401 Comments 0 druuna is offline
Old

RHEL local DVD Repo

Posted 04-23-2013 at 03:37 AM by druuna
Updated 05-16-2013 at 03:52 AM by druuna (added rhel subscription link)
Tags dvd, repo, rhel

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
Views 28029 Comments 0 druuna is offline
Old

Resources / References / Useful links

Posted 02-25-2013 at 07:16 AM by druuna
Updated 01-29-2014 at 06:31 AM by druuna (Added more links)

A collection of Linux related links and resources
Bash:
Awk:...
LQ Veteran
Posted in General
Views 3567 Comments 0 druuna is offline

  



All times are GMT -5. The time now is 01:25 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration