Skip to content

Instantly share code, notes, and snippets.

@7cc
7cc / fgrep.sh
Last active February 20, 2020 03:21
remove a path from the $PATH in Bash
# this will leave trailing :
removeFromPath() {
PATH=$(echo -n $PATH | tr ":" "\n" | fgrep -vx "$1" | tr "\n" ":")
}
@7cc
7cc / gitbash_Windows_Defender memory_increase.md
Created February 16, 2020 07:00
gitbash Windows Defender memory increase

Windows Defender memory not released

It may be a Windows Defender problem, but this is the only app having the trouble afaik.

  1. Starting usr\bin\bash.exe increases memory usage of Windows Defender
  2. The memory will not be reduced after closing a gitbash process

This does not occur by adding an exclusion to Windows Security C:\Program Files\Git\usr\bin\bash.exe as process.

@7cc
7cc / git-bash.txt
Last active February 11, 2020 19:54
command
$MSYSTEM
$PATH
"C:\Program Files\Git\usr\bin\bash.exe" -l
MSYS
/c/Users/UserName/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:Windows_PATH:/usr/bin/vendor_perl:/usr/bin/core_perl
"C:\Program Files\Git\usr\bin\sh.exe" -l
MSYS
/c/Users/UserName/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:Windows_PATH:/usr/bin/vendor_perl:/usr/bin/core_perl
"C:\Program Files\Git\bin\bash.exe" -l
@7cc
7cc / online_storage_comp-data-omakoku.tsv
Last active January 2, 2020 05:25
個人で使うオンラインストレージ比較
名称 料金 容量 ファイルの最大サイズ URL
Office 365 Personal $7 1TB 15GB https://onedrive.live.com/about/en-us/plans/
Office 365 Home $10 1TB*6 15GB
Amazon Drive(.com) $11/年 100GB
Amazon Drive(.com) $60/年 1TB
@7cc
7cc / 管理者権限で実行.ps1
Last active November 30, 2019 02:03
管理者権限で実行
powershell -command Start-Process cmd -verb runas -ArgumentList /k,cd,$PWD
# 相対パス
powershell -command Start-Process notepad -verb runas -ArgumentList (Resolve-Path .\file.txt)
powershell -command Start-Process notepad -verb runas -ArgumentList $PWD\file.txt
@7cc
7cc / developer-tools-functions.js
Last active September 11, 2019 18:52
developer tools functions
var $ = (selector)=> document.querySelector(selector)
var $$ = (selector)=> Array.from(document.querySelectorAll(selector))
var $x = (xpathExpression)=> {
let result = document.evaluate(xpathExpression, document, null, 7)
for (let i=0; i<result.snapshotLength; i++) {
ret[i] = result.snapshotItem(i)
}
return ret
}
@7cc
7cc / index.html
Last active April 4, 2019 11:47
no dot for links, input, button
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>remove dot</title>
<link rel="stylesheet" href="no-dot.css" type="text/css" />
</head>

Windowsでフォルダーを別ドライブに移動する

cmd.exe の move は同一ドライブ間でしか移動できない。
エラーメッセージ "アクセスは拒否されました"

cmd.exe

移動先にフォルダーネーム必須

git config --global alias.up '!git remote update --prune; git merge --ff-only @{upstream}'
<repo> <branch> <commit>
# diff
git show /= git diff HEAD^ = git diff HEAD^..HEAD
git diff HEAD dev # branch
git diff HEAD v1 # tag
git diff @{u} # remote =? git diff FETCH_HEAD