Memoru

System Engineering and Programming and IT

1905-powershell-env-path-grep

[powershell] Env:pathをgrep

console logs

PS G:\Users\sakai> $Env:path
C:\Ruby26-x64\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;G:\Users\Sakai\Desktop\tool;G:\Users\Sakai\Desktop;G:\Redis\;C:\Program Files\MongoDB\Server\3.2\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;G:\xampp\php;C:\Program Files\nodejs\;C:\Program Files (x86)\Graphviz2.38\;C:\Program Files (x86)\MeCab\bin;C:\Program Files (x86)\WinMerge;C:\Program Files (x86)\mosquitto;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\sakura;G:\Users\sakai\Downloads\vim80-kaoriya-win64-8.0.0596-20170502\vim80-kaoriya-win64;C:\Program Files\Microsoft VS Code\bin;G:\Users\sakai\AppData\Local\Microsoft\WindowsApps;G:\Users\sakai\AppData\Local\atom\bin;C:\Program Files\PostgreSQL\10\bin;G:\Users\sakai\AppData\Roaming\npm;G:\sqlite3;C:\Program Files\erl10.0.1\bin;G:\Users\sakai\AppData\Local\hyper\app-2.0.0\resources\bin;G:\workspace\gibo\gibo;C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.1\bin;;C:\Program Files\JetBrains\PyCharm 2018.3.1\bin;;G:\Anaconda3\Scripts;G:\Anaconda3\p;C:\Program Files (x86)\Geany\bin;C:\Program Files (x86)\Vim\vim81;C:\ProgramData\Microsoft\Windows\Start Menu\Programs;C:\Program Files\Typora;G:\apache-ant-1.9.14\bin;
PS G:\Users\sakai> ($Env:path).split(";")
C:\Ruby26-x64\bin
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\ProgramData\Oracle\Java\javapath
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\system32\config\systemprofile\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
G:\Users\Sakai\Desktop\tool
G:\Users\Sakai\Desktop
G:\Redis\
C:\Program Files\MongoDB\Server\3.2\bin
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
G:\xampp\php
C:\Program Files\nodejs\
C:\Program Files (x86)\Graphviz2.38\
C:\Program Files (x86)\MeCab\bin
C:\Program Files (x86)\WinMerge
C:\Program Files (x86)\mosquitto
C:\Program Files\Git\cmd
C:\WINDOWS\System32\OpenSSH\
C:\Program Files (x86)\sakura
G:\Users\sakai\Downloads\vim80-kaoriya-win64-8.0.0596-20170502\vim80-kaoriya-win64
C:\Program Files\Microsoft VS Code\bin
G:\Users\sakai\AppData\Local\Microsoft\WindowsApps
G:\Users\sakai\AppData\Local\atom\bin
C:\Program Files\PostgreSQL\10\bin
G:\Users\sakai\AppData\Roaming\npm
G:\sqlite3
C:\Program Files\erl10.0.1\bin
G:\Users\sakai\AppData\Local\hyper\app-2.0.0\resources\bin
G:\workspace\gibo\gibo
C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.1\bin

C:\Program Files\JetBrains\PyCharm 2018.3.1\bin

G:\Anaconda3\Scripts
G:\Anaconda3\p
C:\Program Files (x86)\Geany\bin
C:\Program Files (x86)\Vim\vim81
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
C:\Program Files\Typora
G:\apache-ant-1.9.14\bin
PS G:\Users\sakai> ($Env:path).split(";") | sls "cassandra"
PS G:\Users\sakai> ($Env:path).split(";") | sls "ant"

G:\apache-ant-1.9.14\bin


PS G:\Users\sakai> ($Env:path).split(";") | select-string "ant"

G:\apache-ant-1.9.14\bin


PS G:\Users\sakai>

GitHub Pagesでmarkdownを公開する3

**** GitHub Pagesでmarkdownを公開する3:Local環境を構築

*** overview

  • Jekyll Themeが適用されたGitHub Pagesのrepositoryを、Local PC側でも閲覧可能とする。

Image from Gyazo

*** relative posts

sakai-memoru.hateblo.jp

*** reference

*** environment

(base) g:\workspace\www>ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]

(base) g:\workspace\www>bundle --version
Bundler version 2.0.1

*** procedure

** note

  • Jekyll本体とSupported Themeをまとめてinstallするgithub-pages gemを利用してinstallする。
    • Gemfileを作成して、実行する。

** logs

* install

  • bundle install
(base) g:\workspace\www>bundle init
Writing new Gemfile to g:/workspace/www/Gemfile

(base) g:\workspace\www>vim Gemfile

(base) g:\workspace\www>type Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "github-pages", group: :jekyll_plugins

(base) g:\workspace\www>bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using concurrent-ruby 1.1.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.11.1
Using public_suffix 3.0.3
Using addressable 2.6.0
Using bundler 2.0.1
Using coffee-script-source 1.11.1
Using execjs 2.7.0
Using coffee-script 2.4.1
Using colorator 1.1.0
Using ruby-enum 0.7.2
Using commonmarker 0.17.13
Using dnsruby 1.61.2
Using eventmachine 1.2.7 (x64-mingw32)
Using http_parser.rb 0.6.0
Using em-websocket 0.5.1
Using ffi 1.10.0 (x64-mingw32)
Using ethon 0.12.0
Using multipart-post 2.0.0
Using faraday 0.15.4
Using forwardable-extended 2.6.0
Using gemoji 3.0.1
Using sawyer 0.8.2
Using octokit 4.14.0
Using typhoeus 1.3.1
Using github-pages-health-check 1.16.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using sass-listen 4.0.0
Using sass 3.7.4
Using jekyll-sass-converter 1.5.2
Using ruby_dep 1.5.0
Using listen 3.1.5
Using jekyll-watch 2.2.1
Using kramdown 1.17.0
Using liquid 4.0.0
Using mercenary 0.3.6
Using pathutil 0.16.2
Using rouge 2.2.1
Using safe_yaml 1.0.5
Using jekyll 3.8.5
Using jekyll-avatar 0.6.0
Using jekyll-coffeescript 1.1.1
Using jekyll-commonmark 1.3.1
Using jekyll-commonmark-ghpages 0.1.5
Using jekyll-default-layout 0.1.4
Using jekyll-feed 0.11.0
Using jekyll-gist 1.5.0
Using jekyll-github-metadata 2.12.1
Using mini_portile2 2.4.0
Using nokogiri 1.10.3 (x64-mingw32)
Using html-pipeline 2.11.0
Using jekyll-mentions 1.4.1
Using jekyll-optional-front-matter 0.3.0
Using jekyll-paginate 1.1.0
Using jekyll-readme-index 0.2.0
Using jekyll-redirect-from 0.14.0
Using jekyll-relative-links 0.6.0
Using rubyzip 1.2.2
Using jekyll-remote-theme 0.3.1
Using jekyll-seo-tag 2.5.0
Using jekyll-sitemap 1.2.0
Using jekyll-swiss 0.4.0
Using jekyll-theme-architect 0.1.1
Using jekyll-theme-cayman 0.1.1
Using jekyll-theme-dinky 0.1.1
Using jekyll-theme-hacker 0.1.1
Using jekyll-theme-leap-day 0.1.1
Using jekyll-theme-merlot 0.1.1
Using jekyll-theme-midnight 0.1.1
Using jekyll-theme-minimal 0.1.1
Using jekyll-theme-modernist 0.1.1
Using jekyll-theme-primer 0.5.3
Using jekyll-theme-slate 0.1.1
Using jekyll-theme-tactile 0.1.1
Using jekyll-theme-time-machine 0.1.1
Using jekyll-titles-from-headings 0.5.1
Using jemoji 0.10.2
Using minima 2.5.0
Using unicode-display_width 1.5.0
Using terminal-table 1.8.0
Using github-pages 198
Bundle complete! 1 Gemfile dependency, 85 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
  • view directory
(base) g:\workspace\www>tree /F
Folder PATH listing for volume Users
Volume serial number is 04A1-7D2F
G:.
│  .Gemfile.un~
│  .gitignore
│  .index.md.un~
│  Gemfile
│  Gemfile.lock
│  index.md
│  README.md
│  _config.yml
│
├─.sass-cache
│
├─logs
│      1905-clone-and-push-markdowns-for-jekyll-publishment.md
│      1905-github-pages-with-jekyll-publishment.md
│
└─_site
    │  index.html
    │  README.html
    │
    ├─assets
    │  ├─css
    │  ├─fonts
    │  ├─images
    │  │
    │  └─js
    │          main.js
    │
    └─logs
            1905-clone-and-push-markdowns-for-jekyll-publishment.html
            1905-github-pages-with-jekyll-publishment.html

* bundle exec jekyll serve

(base) g:\workspace\www>jekyll serve
Traceback (most recent call last):
        10: from C:/Ruby26-x64/bin/jekyll:23:in `<main>'
         9: from C:/Ruby26-x64/bin/jekyll:23:in `load'
         8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/exe/jekyll:11:in `<top (required)>'
         7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
         6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler.rb:107:in `setup'
         5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:26:in `setup'
         4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:26:in `map'
         3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:148:in `each'
         2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:148:in `each'
         1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:31:in `block in setup'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:319:in `check_for_activated_spec!': You have already activated liquid 4.0.3, but your Gemfile requires liquid 4.0.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
(base) g:\workspace\www>bundle exec jekyll serve
Configuration file: g:/workspace/www/_config.yml
Invalid theme folder: _includes
Invalid theme folder: _includes
            Source: g:/workspace/www
       Destination: g:/workspace/www/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
   GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
                    done in 1.448 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled for 'g:/workspace/www'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

access url

Image from Gyazo

* modify _config.yml

(base) g:\workspace\www>type _config.yml
title: Memoru's Page
description: This site is sample site

theme: jekyll-theme-leap-day


(base) g:\workspace\www>bundle exec jekyll serve
Configuration file: g:/workspace/www/_config.yml
Invalid theme folder: _includes
Invalid theme folder: _includes
            Source: g:/workspace/www
       Destination: g:/workspace/www/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
   GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
                    done in 1.504 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled for 'g:/workspace/www'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

Image from Gyazo

* git push

(base) g:\workspace\www>git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   _config.yml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        Gemfile
        Gemfile.lock

no changes added to commit (use "git add" and/or "git commit -a")

(base) g:\workspace\www>git add .
warning: LF will be replaced by CRLF in Gemfile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.

(base) g:\workspace\www>git commit -m "set local env for jekyll"
[master 80f8694] set local env for jekyll
 3 files changed, 261 insertions(+), 1 deletion(-)
 create mode 100644 Gemfile
 create mode 100644 Gemfile.lock

(base) g:\workspace\www>git push
fatal: AggregateException encountered.
   One or more errors occurred.
Username for 'https://github.com': sakai-memoru
Password for 'https://sakai-memoru@github.com':
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 2.33 KiB | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To https://github.com/sakai-memoru/www.git
   cb6b658..80f8694  master -> master

Image from Gyazo

// --- end of markdown --- //

GitHub Pagesでmarkdownを公開する2

**** GitHub Pagesでmarkdownを公開する2:Repositoryをcloneし,markdownをpushする

*** overview

Image from Gyazo

*** relative posts

  • 1905-github-pages-with-jekyll-publishment

sakai-memoru.hateblo.jp

*** reference

  • N/A

*** procedure

** note

  • Jekyllを使ってGitHub Pagesで、markdownを公開するようにしたrepositoryを、 Localにcloneして、markdownを追加して、pushして公開してみる。

** logs

* git clone

(base) g:\workspace>git clone https://github.com/sakai-memoru/www.git
Cloning into 'www'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 13 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), done.

(base) g:\workspace\www>powershell ls


    Directory: G:\workspace\www


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         5/6/2019     15:11            278 README.md
-a----         5/6/2019     15:11             28 _config.yml

* modify index.md

(base) g:\workspace\www>type index.md
---
---

# memoru's page

## *** overview
- GitHub repository で、markdown filesを公開!

## *** contents

### ** Jekyll
    + [./logs/1905-github-pages-with-jekyll-publishment.md](./logs/1905-github-pages-with-jekyll-publishment.html)

    + [./logs/1905-clone-and-push-markdowns-for-jekyll-publishment.md](./logs/1905-clone-and-push-markdowns-for-jekyll-publishment.html)

// --- end of index --- //

* add /logs/1905-github-pages-with-jekyll-publishment.md, etc

  • Save target md files as UTF-8.
(base) g:\workspace\www\logs>powershell ls


    Directory: G:\workspace\www\logs


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         5/6/2019     15:33           2087 1905-clone-and-push-markdowns-for-jekyll-publishment.md
-a----         5/6/2019     15:32           2502 1905-github-pages-with-jekyll-publishment.md

* create .gitignore from gibo template

(base) g:\workspace\www>gibo dump vim python jekyll > .gitignore

(base) g:\workspace\www>ls

(base) g:\workspace\www>powershell ls


    Directory: G:\workspace\www


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         5/6/2019     15:33                logs
-a----         5/6/2019     15:35           1607 .gitignore
-a----         5/6/2019     15:25          13022 .index.md.un~
-a----         5/6/2019     15:26            407 index.md
-a----         5/6/2019     15:11            278 README.md
-a----         5/6/2019     15:11             28 _config.yml

* git commit and push

(base) g:\workspace\www>git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .gitignore
        index.md
        logs/

nothing added to commit but untracked files present (use "git add" to track)

(base) g:\workspace\www>git add .
warning: LF will be replaced by CRLF in logs/1905-clone-and-push-markdowns-for-jekyll-publishment.md.
The file will have its original line endings in your working directory.

(base) g:\workspace\www>git commit -m "add index.md and logs"
[master 3f72697] add index.md and logs
 4 files changed, 298 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 index.md
 create mode 100644 logs/1905-clone-and-push-markdowns-for-jekyll-publishment.md
 create mode 100644 logs/1905-github-pages-with-jekyll-publishment.md

(base) g:\workspace\www>git push
fatal: AggregateException encountered.
   One or more errors occurred.
Username for 'https://github.com': sakai-memoru
Password for 'https://sakai-memoru@github.com':
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 3.26 KiB | 0 bytes/s, done.
Total 7 (delta 0), reused 0 (delta 0)
To https://github.com/sakai-memoru/www.git
   864f39e..3f72697  master -> master

* access url

Image from Gyazo

Image from Gyazo

** notice

  • mdが、utf-8でない場合など、GitHub側のJekyllのgenerationでerrorが発生すると、以下のmailが飛んでくる。(GitHubも、LocalでJekyllを動かして、正しく生成されることを確認して、pushすることを推奨している)

Image from Gyazo

  • 次のpostで、LocalでのJekyllの確認について、記述する

// --- end of markdown --- //

sakai-memoru.hateblo.jp

GitHub Pagesでmarkdownを公開する1

**** GitHub Pagesでmarkdownを公開する1:GitHubにPagesに対応したReposを作る

*** overview

  • GitHub Pagesで、markdownファイルを、Jekyll Themeで公開する。

Image from Gyazo

*** procedure

** note

  • GitHubにrepositoryを作り、そのrepositoryを、GitHub Pagesとして公開。
  • GitHub RepositoryのREADME.mdを修正して、公開。

** logs

* 1. New GitHub Repository

  • create new repos named "www".

Image from Gyazo

  • review www repos.

Image from Gyazo

* 2. Set the settings of repos

  • Set GitHub Page abled and select target source.

Image from Gyazo

  • review settings

Image from Gyazo

  • choose Jekyll Theme

Image from Gyazo

  • review www repos

Image from Gyazo

  • confirm _config.yml

Image from Gyazo

* 3. access www page

Image from Gyazo

* 4. modify README.md

Image from Gyazo

Image from Gyazo

// --- end of markdown --- //

sakai-memoru.hateblo.jp

1905-create-github-repos-of-notebook-on-first-operation

**** 1905-create-github-repos-of-notebook-on-first-operation

*** overview

  • When creating github repository, operate first on terminal.

*** FIXME

  • [ ] To publish github.io/blog

*** logs

echo "# zzzzz" >> README.md
gibo dump python vim > .gitignore
git init
git add .
git status
git commit -m "first commit"
git remote add origin https://github.com/xxxxx/zzzzz.git
git config --list
git push -u origin master
  • files

    • README.md
    • README.ipnb
    • .gitignore
    • logging_debug.conf
  • logging_debug.conf (for jupyter notebook)

[loggers]
keys=root,functions

[handlers]
keys=fileHandler,stderrHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=DEBUG
handlers=fileHandler,stderrHandler

[logger_functions]
level=INFO
handlers=fileHandler,stderrHandler
qualname=functions
propagate=0

[handler_fileHandler]
class=handlers.TimedRotatingFileHandler
formatter=simpleFormatter
args=('apps.log','D')

[handler_stderrHandler]
class=StreamHandler
formatter=simpleFormatter
args=(sys.stderr,)

[formatter_simpleFormatter]
format=[%(asctime)s][%(levelname)s](%(lineno)s) %(message)s
datefmt=%Y/%m/%d %H:%M:%S

// --- end of markdown --- //

1905-sequence

**** 1905-sequence

*** overview

  • Sequence Types
    • Sequences represent ordered sets of objects indeed by non-negative integers and include strings, lists, and tuples.

*** logs

import logging.config
logging.config.fileConfig('./logging_debug.conf')
logger = logging.getLogger(__name__)
logger.info('------ start...')
[2019/05/03 08:21:27][INFO](1) ------ start...

*** contents

** Operations Common to All Sequence

s = '012345678'
res = s[1]
logger.debug(f's[1] = "{res}"')
[2019/05/03 08:21:27][DEBUG](2) s[1] = "1"
res=s[1:5]
logger.debug(f's[1:5] = "{res}"')
[2019/05/03 08:21:27][DEBUG](2) s[1:5] = "1234"
res=s[1:9:2]
logger.debug(f's[1:9:2] = "{res}"')
[2019/05/03 08:21:27][DEBUG](2) s[1:9:2] = "1357"
res=len(s)
logger.debug(f'len(s) = {res}')
[2019/05/03 08:21:27][DEBUG](2) len(s) = 9
s = 'python'
res=max(s)
logger.debug(f'max(s) = "{res}"')
[2019/05/03 08:21:27][DEBUG](3) max(s) = "y"
res=min(s)
logger.debug(f'min(s) = "{res}"')
[2019/05/03 08:21:27][DEBUG](2) min(s) = "h"
lst=list(s)
lst
['p', 'y', 't', 'h', 'o', 'n']

// --- end of notebook --- //