2018年8月26日日曜日

NVIDIA Corporation GF108 [GeForce GT630]のドライバのubuntu系へのインストール

2018 Sep. 02.
2018 Aug. 26.

# apt install nvidia-352

大画面表示になったので 、表示フォントを3ポイント上げた。

2018年8月19日日曜日

BitbucketへのSSH認証導入

2018 Aug. 19.
 
$ cd ~/.ssh
$ mkdir bitbucket
$ cd bitbucket
$ ssh-keygen -t rsa -C YourMail@Address
 Enter file in which to save the key の問いに ~/.ssh/bitbucket/id_rsa と入力する。
 パスワードの設定を2回問われるが、Enterのみを入力する。
  
$ mv id_rsa id_rsa.bitbucket
$ chmod 600 id_rsa.bitbucket

~/.ssh/config に次を記載する
 Host bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/bitbucket/id_rsa.bitbucket
  User git
  Port 22
  TCPKeepAlive yes
  IdentitiesOnly yes
 
https://bitbucket.org にアクセスし、
「Manage Account」→「SSH keys」→「Add Key」と鍵設定画面に移る。
 Label:任意の文字列(クライアントデバイス名とか)
 Key:「id_rsa.bitbucket.org.pubの内容(メールアドレスを含む)」コピー&ペースト
 「鍵追加」ボタンを押す。

接続テスト
$ ssh -T git@bitbucket.org
(表示) 
 conq: logged in as ユーザ名.
You can use git or hg to connect to bitbucket. Shell access is disabled.
 
それまでhttps/sslで認証していたリポジトリは削除して再クローンを要するみたい。
 

ruby 配列を値とするハッシュ

2018 Aug. 19.


http://simanman.hatenablog.com/entry/2013/09/24/211044

  list = Hash.new{|hash, key| hash[key] = []}
  Hash.newにブロックを与えるとブロック引数の1番目がhash自身、2番目がkeyとなります。
  そこで上記のように配列を定義してあげると、keyごとに配列を初期化することが出来るようになります。

  RubyはHashのデフォルト値をHash.newの引数として渡すことで実現できますが、配列を渡すと同じ参照になってしまうのでうまくいきません。
    失敗例:list = Hash.new([])

2018年8月18日土曜日

ruby Could not locate Gemfile or .bundle/ directory スクリプトのファイル属性を実行可能に

2018 Aug. 18.

rubyスクリプトを起動すると
Could not locate Gemfile or .bundle/ directory
で止まった。

Bundler設定を疑ったが、単にファイル属性に実行可能属性が無いだけだった。

2018年8月17日金曜日

git ブランチの統合

2018 Aug. 17.

devブランチのmasterブランチへの統合

(現在のブランチを確認する)
$ git branch

(devブランチに移る)
$ git checkout dev

(devブランチを最新に)
$ git fetch origin dev
$ git merge FETCH_HEAD

(masterブランチにチェック移る)
$ git checkout master

(masterブランチを最新に)
$ git fetch origin master
$ git merge FETCH_HEAD

(devブランチをmasterブランチに統合)
$ git merge dev

git ブランチの削除

2018 Aug. 17.

ローカルブランチの削除
$ git branch -d BRANCH

リモートブランチの削除
$ git push --delete origin BRANCH

2018年8月15日水曜日

シェルスクリプト テキストファイルを行の文字数順にソート

2018 Aug. 15.

$ cat TextFile | awk '{print length() ,$0}' | sort -n | awk '{$1 = ""; print}'
    各行の先頭にその行の文字数を書き込み、その数値でソートした後に、awkの$1 = "" によって文字数の数値を削除している。