dig DNS lookup utility

commandline session

$dig

; <> DiG 9.8.4-rpz2+rl005.12-P1 <>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44167
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.				IN	NS

;; ANSWER SECTION:
.			17373	IN	NS	a.root-servers.net.
.			17373	IN	NS	b.root-servers.net.
.			17373	IN	NS	c.root-servers.net.
.			17373	IN	NS	d.root-servers.net.
.			17373	IN	NS	e.root-servers.net.
.			17373	IN	NS	f.root-servers.net.
.			17373	IN	NS	g.root-servers.net.
.			17373	IN	NS	h.root-servers.net.
.			17373	IN	NS	i.root-servers.net.
.			17373	IN	NS	j.root-servers.net.
.			17373	IN	NS	k.root-servers.net.
.			17373	IN	NS	l.root-servers.net.
.			17373	IN	NS	m.root-servers.net.

;; Query time: 53 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Thu Jun 20 20:40:07 2013
;; MSG SIZE  rcvd: 228

$

$dig a.root-servers.net

; <> DiG 9.8.4-rpz2+rl005.12-P1 <> a.root-servers.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27425
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;a.root-servers.net.		IN	A

;; ANSWER SECTION:
a.root-servers.net.	14389	IN	A	198.41.0.4

;; Query time: 41 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Thu Jun 20 20:43:28 2013
;; MSG SIZE  rcvd: 52

$

http://pluto.infoclub.in/wp-content/uploads/2013/06/dig.c

mv command GNU bash

commandline session

$> 1
$echo hello > 1
$cat 1
hello
$ls
1
$mv 1 2
$ls
2
$cat 2
hello
$

http://pluto.infoclub.in/wp-content/uploads/2013/06/mv.c

code section

  while ((c = getopt_long (argc, argv, "bfint:uvS:T", long_options, NULL))
         != -1)
    {
      switch (c)
        {
        case 'b':
          make_backups = true;
          if (optarg)
            version_control_string = optarg;
          break;
        case 'f':
          x.interactive = I_ALWAYS_YES;
          break;
        case 'i':
          x.interactive = I_ASK_USER;
          break;
        case 'n':
          x.interactive = I_ALWAYS_NO;
          break;
        case STRIP_TRAILING_SLASHES_OPTION:
          remove_trailing_slashes = true;
          break;
        case 't':
          if (target_directory)
            error (EXIT_FAILURE, 0, _("multiple target directories specified"));
          else
            {
              struct stat st;
              if (stat (optarg, &st) != 0)
                error (EXIT_FAILURE, errno, _("accessing %s"), quote (optarg));
              if (! S_ISDIR (st.st_mode))
                error (EXIT_FAILURE, 0, _("target %s is not a directory"),
                       quote (optarg));
            }
          target_directory = optarg;
          break;
        case 'T':
          no_target_directory = true;
          break;
        case 'u':
          x.update = true;
          break;
        case 'v':
          x.verbose = true;
          break;
        case 'S':
          make_backups = true;
          backup_suffix_string = optarg;
          break;
         case_GETOPT_HELP_CHAR;
         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
        default:
          usage (EXIT_FAILURE);
        }
    }

http://stackoverflow.com/questions/10606250/macros-like-case-getopt-help-char-risky

cp command GNU bash

commandline session

$> 1
$echo hello > 2
$cat 1
$
$cat 2
hello
$cp -b 2
cp: missing destination file operand after ‘2’
Try 'cp --help' for more information.
$cp -b 2 2b
$ls
1  2  2b
$cat 2b
hello
$cp -x 2b 2c
$ls
1  2  2b  2c
$cat 2c
hello
$cp -x 2b /proc/
cp: cannot create regular file ‘/proc/2b’: Permission denied
$sudo cp -x 2b /proc/
cp: cannot create regular file ‘/proc/2b’: Permission denied
$cp -s 2c 2d
$ls -l
total 12
-rw-r--r-- 1 jeffrin jeffrin 0 Jun  1 22:28 1
-rw-r--r-- 1 jeffrin jeffrin 6 Jun  1 22:28 2
-rw-r--r-- 1 jeffrin jeffrin 6 Jun  1 22:28 2b
-rw-r--r-- 1 jeffrin jeffrin 6 Jun  1 22:29 2c
lrwxrwxrwx 1 jeffrin jeffrin 2 Jun  1 22:31 2d -> 2c
$

http://pluto.infoclub.in/wp-content/uploads/2013/06/cp.c
http://stackoverflow.com/questions/5740042/enum-use-in-a-c-program

Scatter Plot using R

ABOUT SCATTER PLOT

A scatter plot (also called a scatterplot, scatter graph, scatter chart, scattergram, or scatter diagram)
[3] is a type of plot or mathematical diagram using Cartesian coordinates to display values for typically
two variables for a set of data. If the points are color-coded, one additional variable can be displayed.
The data are displayed as a collection of points, each having the value of one variable determining the
position on the horizontal axis and the value of the other variable determining the position on the
vertical axis.[4]

ABOUT R

R is a programming language and free software environment for statistical computing and graphics
supported by the R Foundation for Statistical Computing.[6] The R language is widely used among
statisticians and data miners for developing statistical software[7] and data analysis.[8] Polls, data
mining surveys, and studies of scholarly literature databases show substantial increases in popularity in
recent years.[9] As of January 2019, R ranks 12th in the TIOBE index, a measure of popularity of
programming languages.[10]

A GNU package,[11] source code for the R software environment is written primarily in C, Fortran and R
itself,[12] and is freely available under the GNU General Public License. Pre-compiled binary versions
are provided for various operating systems. Although R has a command line interface, there are several
graphical user interfaces, such as RStudio, an integrated development environment.[13][14]

TYPICAL SHELL SESSION RELATED
[code lang=”r”]
> plot(1,2,3)
Error in plot.xy(xy, type, …) : invalid plot type
> plot(12,45,55,67))
Error: unexpected ‘)’ in "plot(12,45,55,67))"
> plot(12,45,55,67)
Error in plot.window(…) : invalid ‘xlim’ value
> plot(12)
> png(file="basic.png")
> plot(12)
> dev.off()
null device
1
> plot(12,32)
> plot(12,55,99)
Error in plot.xy(xy, type, …) : invalid plot type
> plot(12,b,55)
Error in xy.coords(x, y, xlabel, ylabel, log) : object ‘b’ not found
>
[/code]

LINKS
http://www.mathsisfun.com/data/scatter-xy-plots.html
http://www.biomedware.com/files/documentation/spacestat/Statistics/Regression/Regression_line.htm
<!– basic –>
https://en.wikipedia.org/wiki/Scatter_plot
https://en.wikipedia.org/wiki/R_(programming_language)

objdump tinkering

commandline session

root>objdump -f nouveau.ko

nouveau.ko:     file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x0000000000000000

root>objdump -a nouveau.ko

nouveau.ko:     file format elf64-x86-64
nouveau.ko

root>objdump -p nouveau.ko

nouveau.ko:     file format elf64-x86-64

root>objdump -g nouveau.ko

nouveau.ko:     file format elf64-x86-64

root>

http://www.beautifulwork.org/wp-content/uploads/2013/05/objdump.c

Erlang Tinkering

ABOUT ERLANG

Erlang (/ˈɜːrlæŋ/ UR-lang) is a general-purpose, concurrent, functional programming language, as well as a garbage-collected runtime system.

The term Erlang is used interchangeably with Erlang/OTP, or OTP, which consists of the Erlang runtime system, a number of ready-to-use components mainly written in Erlang, and a set of design principles for Erlang programs.[3]

The Erlang runtime system is known for its designs that are well suited for systems with the following characteristics:

Distributed
Fault-tolerant
Soft real-time
Highly available, non-stop applications
Hot swapping, where code can be changed without stopping a system.[4]
The Erlang programming language is known for the following properties:[5]

Immutable data
Pattern matching
Functional programming

TYPICAL COMMANDLINE SESSION
[bash]
$erl
[/bash]
TYPICAL ERLANG SHELL RELATED
[erlang]
Eshell V5.10.1 (abort with ^G)
1> q().
ok
2> $erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V5.10.1 (abort with ^G)
1> q()
1>
1> .
ok
2> $erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V5.10.1 (abort with ^G)
1> 10
1> .
10
2> 23.
23
3> 2#000000
3> .
0
4> 2#111111.
63
5> 8#111111.
37449
6> 16#111111.
1118481
7> 16#jeffrin
* 1: illegal integer
7> 2#jeffrin
* 1: illegal integer
7> 2#jeffrin.
* 1: illegal integer
7> 2#j
* 1: illegal integer
7> 2#cafe
* 1: illegal integer
7>
[/erlang]
LINK
https://en.wikipedia.org/wiki/Erlang_(programming_language)

Testing For File Charactereristics

commandline session

$cat test.sh
#!/usr/bin/env bash
# cookbook filename: checkfile
#
DIRPLACE=/tmp
INFILE=/home/jeffrin/amazing.data
OUTFILE=/home/jeffrin/more.results
if [ -d "$DIRPLACE" ]
then
cd $DIRPLACE
if [ -e "$INFILE" ]
then
if [ -w "$OUTFILE" ]
then
doscience > "$OUTFILE"
else
echo "can not write to $OUTFILE"
fi
else
echo "can not read from $INFILE"
fi
else
echo "can not cd into $DIRPLACE"
fi

$sh test.sh
can not read from /home/jeffrin/amazing.data
$> /home/jeffrin/amazing.data
$sh test.sh
can not write to /home/jeffrin/more.results
$> /home/jeffrin/more.results
$sh test.sh
test.sh: 14: test.sh: doscience: not found
$

related source : Bash CookBook