ln -s

[vagrant@localhost tests]$ ls
index.php  test
[vagrant@localhost tests]$ cat index.php
<?php

?>
<!DOCTYPE html>
<html>
<head>
        <meta charset="UTF-8">
        <script src="tinymce/js/tinymce/tinymce.min.js"></script>
        <script>
                tinymce.init({
                        selector:"#tiny",
                        // menubar: false,
                        plugins: "textcolor image link",
                        toolber: [
                                "undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",
                                "fontsizeselect forecolor image link"
                        ],
                        statusbar: false,
                });
        </script>
</head>
<body>
        <textarea id="tiny" name=""></textarea>
</body>
</html>

[vagrant@localhost tests]$ ln -s index.php copy
[vagrant@localhost tests]$ ls
copy  index.php  test
[vagrant@localhost tests]$ cat copy
<?php

?>
<!DOCTYPE html>
<html>
<head>
        <meta charset="UTF-8">
        <script src="tinymce/js/tinymce/tinymce.min.js"></script>
        <script>
                tinymce.init({
                        selector:"#tiny",
                        // menubar: false,
                        plugins: "textcolor image link",
                        toolber: [
                                "undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",
                                "fontsizeselect forecolor image link"
                        ],
                        statusbar: false,
                });
        </script>
</head>
<body>
        <textarea id="tiny" name=""></textarea>
</body>
</html>

すげーーーーーーー linux

rm -rf ${dir_name | file name}

-r
This is used to delete directories. Even if there is a directory in the directory, all deletion will be done.

-f
It is ok to delete the file on linux without confirmation. For example, when deleting a large number of files, it is commonly used option when it is troublesome to check each time. Also, no warning will be issued even if the file does not exist.

[vagrant@localhost tests]$ ls
dmm index.php test
[vagrant@localhost tests]$ rm -rf dmm
[vagrant@localhost tests]$ ls
index.php test

chown -R ${dir_name}

Check the permission with the “ll” command.

[vagrant@localhost tests]$ ll
合計 12
drwxr-xr-x 2 vagrant vagrant 4096 2月 17 14:36 2019 dmm
-rw-rw-r– 1 vagrant vagrant 551 2月 10 11:26 2019 index.php
drwxr-xr-x 4 vagrant vagrant 4096 2月 15 08:53 2019 test
[vagrant@localhost tests]$ cd dmm
[vagrant@localhost dmm]$ ll
合計 0
-rw-rw-r– 1 vagrant vagrant 0 2月 17 14:36 2019 dmm.txt

drwxr-xr-x is 755
-rw-rw-r– is 644

[vagrant@localhost tests]$ chmod -R 764 dmm
[vagrant@localhost tests]$ ll
合計 12
drwxrw-r– 2 vagrant vagrant 4096 2月 17 14:36 2019 dmm
-rw-rw-r– 1 vagrant vagrant 551 2月 10 11:26 2019 index.php
drwxr-xr-x 4 vagrant vagrant 4096 2月 15 08:53 2019 test
[vagrant@localhost tests]$ cd dmm
[vagrant@localhost dmm]$ ll
合計 0
-rwxrw-r– 1 vagrant vagrant 0 2月 17 14:36 2019 dmm.txt

tail -f ${file_name}

originally tail is a command to display the last 10 lines(default) of the file.
As a command to be paired there is head, display the top 10 lines of the file. To change the number of lines to display, specify the number of lines with the -n option for both commands.

First i will make a sample file of 26 lines.

[vagrant@localhost tests]$ tail test.txt
 -数字表記-
 0     ---
 1     --x
 2     -w-
 3     -wx
 4     r--
 5     r-x
 6     rw-
 7     rwx
※2進数に直した3bitに当てはめる。

[vagrant@localhost tests]$ tail -n 3 test.txt
 6     rw-
 7     rwx
 ※2進数に直した3bitに当てはめる。

tail -n
Even if it is displayed to the end of the file, it does not end and when the end of the file is updated, the addition is displayed continuously.

add new line

command line automatically updated.

こりゃ驚いた

cp -r ${dir_name}

The cp command on Unix/linux is a command to copy files and directories. Since the cp command has existed for a long time(it appeared in the first Unix V1), it can be used with any UNIX/Linux OS.

option
-R : copy directory recursively

[vagrant@localhost tests]$ ls
index.php test
[vagrant@localhost tests]$ cp -r test test2
[vagrant@localhost tests]$ ls
index.php test test2

すげーーーーーー

ssh -i /path/to/key

It uses ssh(secure shell) protocol(encrypt communication between client and remote machine), so you can safely execute command. In addition, since the ssh command can use key authentication using secret key / public key, you can further improve security by using them.

ssh -i /path/to/key

Specify the private key file(identity file). In the initial setting, SSH version 1 is /.ssh/identity, ssh version 2 is /.ssh/id_rsa and /.ssh/id_dsa

Install the Truffle framework

We will use the Truffle framework to issue tokens. Truffle is Ethereum’s Smart Contract Development Framework, which has functions such as compiling, linking, deploying, and binary management.

[vagrant@localhost crypto]$ npm -v
1.3.6

First of all, we will install Truffle.

[vagrant@localhost crypto]$ npm install -g truffle
npm http GET https://registry.npmjs.org/truffle
npm http GET https://registry.npmjs.org/truffle
npm http GET https://registry.npmjs.org/truffle
npm ERR! Error: CERT_UNTRUSTED
npm ERR!     at SecurePair. (tls.js:1430:32)
npm ERR!     at SecurePair.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:1029:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:521:13)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:341:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:418:25)
npm ERR!     at doWrite (_stream_writable.js:226:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:216:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR!     at write (_stream_readable.js:602:24)
npm ERR! If you need help, you may report this log at:
npm ERR!     
npm ERR! or email it to:
npm ERR!     

npm ERR! System Linux 2.6.32-754.3.5.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "truffle"
npm ERR! cwd /home/vagrant/local/crypto
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/vagrant/local/crypto/npm-debug.log
npm ERR! not ok code 0

what!?

Issue ERC 20 token

ERC 20 token is a standard for issuing tokens with Ethereum, and by issuing a token conforming to ERC20, simplification of exchange between different tokens has been realized. In addition, we can manage tokens collectively by utilizing ERC 20 compatible wallet. ERC stands for Ethereum RFC and ERC 20 stands for the 20th specification. Representative ERC 20 tokens include 0x, Augur, OmiseGo and others.

Requirements for creating ERC 20 tokens are defined, and seems to be able to issue tokens by implementing the following six methods and two events.

fucntion totalSupply() constant returns(unit totalSupply);

function balanceOf(address _owner) constant returns (unit balance);

function transfer(address _to, unit _value) returns (bool success);

function transferFrom(address _from, addess _to, unit _value) returns (bool success);

function approve(address _spender, unit _value) returns(bool success);

function allowance(address _owner, address _spender) constant returns (unit remaining);

event Transfer(address indexed _from, address indexed _to, unit _value);

event Approval(address indexed _owner, address indexed _spender, unit _value);

vagrant : default paused (virtualbox)

I never seen 404 like below.

>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: The requested URL returned error: 404
==> default:
==> default: If you want to check for box updates, verify your network connection
==> default: is valid and try again.
==> default: Unpausing the VM...

what does it mean?

>vagrant status
Current machine states:

default                   paused (virtualbox)

The VM is paused. This VM may have been paused via the VirtualBox
GUI or the VBoxManage command line interface. To unpause, please
use the VirtualBox GUI and/or VBoxManage command line interface so
that vagrant would be able to control the VM again.

once again, put “vagrant up” on the command line.

>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: The requested URL returned error: 404
==> default:
==> default: If you want to check for box updates, verify your network connection
==> default: is valid and try again.
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

That says “vagrant provision”. Try again, boy.

>vagrant provision

>vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

What!? I know, I’m just playing.

vagrant has multiple choices for machine provisioning, from simple shell scripts to more complicated industry standard configuration management systems.

I you have never used a configuration management system in the past, starting with basic shell scripts for provisioning is recommended.

git diff

First of all, as a basic concept of git diff, the basic behavior of “git diff” is “display of changes made in the working tree”.

Then, if you do not specify the comparison source, you can specify “comparison source” as an argument, but by default, the difference when compared with “index” → ”working tree” with “index” as the comparison source and it will display.

[vagrant@localhost tests]$ git diff
diff –git a/sample.txt b/sample.txt
deleted file mode 100644
index 106287c..0000000
— a/sample.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello Git!
diff –git a/tests/test b/tests/test
— a/tests/test
+++ b/tests/test
@@ -1 +1 @@
-Subproject commit 180cf3fcce48d905ede71a57ed0bd3973e1f90c8
+Subproject commit 180cf3fcce48d905ede71a57ed0bd3973e1f90c8-dirty
[vagrant@localhost tests]$ git diff –name-only
sample.txt
tests/test

あれ?

[vagrant@localhost test]$ git diff –name-only
addfile.txt
[vagrant@localhost test]$

OK、理解した。