Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / git-dig.sh
Last active November 8, 2020 21:01
git でそのファイルのすべての版を落としてくる。どこでおかしくなったか探すときにいちいち git checkout COMMIT_NUM -- hoge.txt とか繰り返すのがめんどいので書いた。リグレッションテストのお供に。
#!/bin/sh
help() {
script=`basename $0`
echo "USAGE: $script FILENAME"
echo "Equivalent to: git checkout ALL-COMMITS -- FILENAME"
}
if [ $# -ne 1 ]; then
help
@hidsh
hidsh / 0-print.sh
Created November 8, 2020 18:07
awk example: print
#!/bin/sh
ls -l
echo ---------------
ls -l |awk '{print $1}'
@hidsh
hidsh / bak.sh
Created November 7, 2020 18:09
backup command by CUI
#!/bin/sh
#
# Filename: bak.sh
# Last modified: Sat Jul 24 2004 19:21:58 LMT
#
# description:
# backup a file to FILE.bak or FILE.orig
# also revert from FILE.bak or FILE.orig
#
# this script also allows to backup directories.
@hidsh
hidsh / emacs-test-advice-add.el
Last active January 29, 2023 02:11
emacs: test for advice-add :before, :around, :after
(defun func-1 () (message "aaa")) ;; target function
(defun my-func-1-adv () ;; advice function
(message "before"))
(advice-add 'func-1 :before #'my-func-1-adv)
;(func-1)
;---> before
;---> aaa
@hidsh
hidsh / emacs-tare-isearch-for-region.el
Created October 31, 2020 01:49
emacs: evilでexpand-regionしたあと"/"したら、選択したリージョンの文字列を検索してくれるようになるタレ(リージョン指定できるならexpand-regionでなくてもevilでなくてもいいはず)
(defun my-isearch-shit-at-point-insert-func ()
(remove-hook 'isearch-mode-hook #'my-isearch-shit-at-point-insert-func)
(when my-isearch-shit-at-point-str
(isearch-yank-string my-isearch-shit-at-point-str)
(setq my-isearch-shit-at-point-str nil)
(setq unread-command-events (listify-key-sequence (kbd "RET")))))
(defvar my-isearch-shit-at-point-str nil)
(defun my-isearch-shit-at-point ()
@hidsh
hidsh / emacs-test-emulate-key-input-and-exec-minibuffer.el
Last active April 5, 2023 20:30
elispでミニバッファに何か入力して実行するテスト
;; M-x ttt すると f2関数がコール
;; -> 自動でミニバッファに文字列を入力
;; -> 自動でEnter入力
;; -> 結果が表示される
(defun f2 ()
"ミニバッファに文字列を入力してEnterする。"
(insert "(1+ 5)")
(setq unread-command-events (listify-key-sequence "\C-j")) ;; Enterキー入力をエミュレート
;;(setq unread-command-events (listify-key-sequence (kbd "RET"))) ;; こっちでないとダメなときがある
# on WSL
ciso="/mnt/c/Program Files (x86)/danny_kay1710/PSP ISO Compressor/files/ciso.exe"
#ciso="/mnt/c/Program\ Files\ \(x86\)/danny_kay1710/PSP\ ISO\ Compressor/files/ciso.exe"
level=1
if [ ! -f "${ciso}" ]; then
echo "ERROR: File not found: $ciso"
exit 1
fi
@hidsh
hidsh / .vimrc
Created September 26, 2020 23:14
my vim setting
"
" key bindings
"
"------------------------------------------------------
"MODE NO-REMAPPING REMAPPING
"normal nnoremap nmap
"visual vnoremap vmap
"command mode cnoremap cmap
"insert mode inoremap imap
"normal + vilual noremap map
@hidsh
hidsh / History\-176f8d10\entries.json
Last active August 8, 2023 01:15
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///d%3A/_docu/unity_proj/arpg2/Assets/script/player_controller.cs","entries":[{"id":"yaKU.cs","timestamp":1658181100504},{"id":"b1DB.cs","timestamp":1658181174267},{"id":"QOqC.cs","timestamp":1658181262517},{"id":"Vki9.cs","timestamp":1658181293474},{"id":"06hw.cs","timestamp":1658181388790},{"id":"BHHp.cs","timestamp":1658181540740},{"id":"g8jf.cs","timestamp":1658181582683},{"id":"ANDE.cs","timestamp":1658222063623},{"id":"92ys.cs","timestamp":1658222335751},{"id":"g2YC.cs","timestamp":1658222367658},{"id":"kZ6x.cs","timestamp":1658228505694},{"id":"BIFx.cs","timestamp":1658269759406},{"id":"YjIw.cs","timestamp":1658269774517},{"id":"rxLk.cs","timestamp":1658272891281},{"id":"QucJ.cs","timestamp":1658343377894},{"id":"xjyU.cs","timestamp":1658343469871},{"id":"Q3Dz.cs","timestamp":1658343804211},{"id":"B8br.cs","timestamp":1658343976899},{"id":"rwOn.cs","timestamp":1658344026839},{"id":"i9Vi.cs","timestamp":1658346136641},{"id":"ZrpI.cs","timestamp":1658346439331},{"id":"zpDm.c
@hidsh
hidsh / settings.json
Last active July 11, 2020 11:44
my settings.json for Windows Terminal 1.0.1811.0
// C:\Users\XXX\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{