Skip to content

Instantly share code, notes, and snippets.

View YumaInaura's full-sized avatar

いなうらゆうま ( 稲浦悠馬 ) YumaInaura

View GitHub Profile
@YumaInaura
YumaInaura / BASH.md
Last active November 12, 2023 19:07
Bash — split $PATH by colon and for in

Bash — split $PATH by colon and for in

for i in $(echo "$PATH" | sed 's/:/ /g'); do echo $i;  done;
  • Replace colon to space in $PATH
  • Pass to for command space separated $PATH
  • for command ( foo roop ) catches that strings as multiple arguments ( so not quote string )
    • So double quotationed string pattern does not work well because for command get in string one argument. ( e.g "$(echo "$PATH" | sed 's/:/ /g')" )
@YumaInaura
YumaInaura / RAILS.md
Last active August 3, 2023 03:11
Ruby on rails — How to change column comment with migration

Ruby on rails — How to change column comment with migration

Migration file

  class AddUsersComments < ActiveRecord::Migration[5.1]
  def up
    change_column :users, :first_name, :string, comment: "This is first name of user"
  end
@YumaInaura
YumaInaura / 00_README.md
Last active July 22, 2023 03:58
Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

I was so confused to understand behaviior of Golang channels, buffer, blocking, deadlocking and groutines.

I read Go by Example topics.

@YumaInaura
YumaInaura / GIT.md
Last active June 14, 2023 03:58
Git — Vim insert mode by default with git EDITOR ( e.g. when git commit editing )

Git — Vim insert mode by default with git EDITOR ( e.g. when git commit editing )

git config

~/.gitconfig
[core]
@YumaInaura
YumaInaura / GIST.md
Last active May 12, 2023 02:20
Vim—Remember gg and G keystroke with Gravity's G image ( move to top and move to bottom )

Vim—Remember gg and G keystroke with Gravity's G image ( move to top and move to bottom )

This.

Small letter gg is light.

Capital letter G is heavy.

image

@YumaInaura
YumaInaura / BASH.md
Last active February 20, 2023 10:41
Bash  —  Get current directory path of now executed script ( without $PWD env )

Bash — Get current directory path of now executed script ( without $PWD env )

When execute this script from some work dir

  • $ cd /some/work/dir
  • $ bash /path/to/script.sh

One line answer

@YumaInaura
YumaInaura / BIGQUERY.md
Last active February 9, 2023 01:28
BigQuery — Nested WITH clause ( WITH is like a Subquery )

BigQuery — Nested WITH clause ( WITH is like a Subquery )

Query Example

WITH result AS (
   WITH example AS ( SELECT * FROM `dataset.table` )
   SELECT * FROM example
)
@YumaInaura
YumaInaura / ZSH.md
Last active January 8, 2023 14:11
Zsh — How to create user defined widget and map with bindkey ( For very beginner of zle )

Zsh — How to create user defined widget and map with bindkey ( For very beginner of zle )

Another titles

  • How to add customized event and bind keymap
  • The very beginner to zle of zsh keymapping with bindkey

Step. Create function in shell

@YumaInaura
YumaInaura / SHELL.md
Last active April 28, 2022 14:03
Shell — Detect shell kind ( e.g sh or bash or zsh )

Shell — Detect shell kind ( e.g sh or bash or zsh )

Use dollar and zero variable. $0

This technique is for "shell" not "shell script".

Current Shell

$ echo $0
@YumaInaura
YumaInaura / ZSH.md
Last active April 17, 2022 10:11
Zle — Show all widget list ( $ zle -al )

Zle — Show all widget list ( $ zle -al )

zle widget can be used by zsh command bindkey.

Command

zle -al