Skip to content

Instantly share code, notes, and snippets.

@hkuno9000
hkuno9000 / git-rebase-onto.md
Last active October 14, 2022 05:20
git reabse --onto の動作解説

git rebase --onto の動作解説

https://git-scm.com/docs/git-rebase に記載されている説明を、厳密な正確性よりも分かりやすさを優先して書き換えたものです。 git reabse の使い方に悩む方々の参考になればと思い公開します。

コマンドライン

git rebase [--onto 接続先] 上流ブランチ [対象ブランチ]

引数解説

  • 対象ブランチ: 省略時はカレントのブランチが対象となる。
// wrapper functions to fix C4996 on VS2019
//#include <string.h>
//#include <stdlib.h>
//#include <stdio.h>
//#include <wchar.h>
//#include <tchar.h>
template <typename T> T* malloc_array(rsize_t size) {
return static_cast<T*>(malloc(sizeof(T) * size));
}
@hkuno9000
hkuno9000 / MFC detecting MACRO name
Last active January 16, 2019 02:07
How to detect MFC class in import headers
macro name | target
---------------|-------------
_AFX | MFC classes
__CSTRINGT_H__ | CString
__AFXSTR_H__ | MFC's CString
__ATLSTR_H__ | ATL's CString
#include <import.h>
en_US 0x409
ja_JP 0x411
zh_CN 0x804
zh_TW 0x404
ko_KR 0x412
@hkuno9000
hkuno9000 / push-to-multi-mirror-repos.sh
Last active September 13, 2018 00:00
git puth to multi mirror repos.
git clone https://[email protected]/who/proj.git
cd proj
# set remote mirror URL
git remote add --mirror=push mirror1 https://[email protected]/who/proj.git
git remote add --mirror=push mirror2 https://[email protected]/who/proj.git
# push to remote-mirrors
git push mirror1
git push mirror2
# push to direct-URL
git push --mirror https://[email protected]/who/proj.git
@hkuno9000
hkuno9000 / gitbucket-print-ready.css
Last active May 11, 2021 08:39
GitBucket print ready Bookmarklet and User-defined CSS
/** GitBuckect 4.3x's User-defined CSS にて gitbucket-print-ready.js と同等の印刷結果を得る */
/* コードブロックの背景色とボーダ設定が上書きされているので、さらに上書きする. */
div.markdown-body pre.prettyprint {
border: 1px solid #888!important;
background-color: #f5f5f5;
}
@media print {
/* コードブロックのスクロールバーは印刷時には無意味なので、行折り返しに変更する */
div.markdown-body pre.prettyprint {
@hkuno9000
hkuno9000 / cdx.sh
Created January 16, 2016 02:32
fuzzy chdir for bash: change folder on a current folder or parent folder.
# fuzzy chdir for bash
# USAGE: cdx <part-of-folder-names>
# HOW TO INSTALL: append "source cdx.sh" to your ".bashrc"
cdx()
{
for dir in $* $1* ../$1* ../../$1*; do
if [ -d "$dir" ]; then
pushd "$dir"
return
fi
@hkuno9000
hkuno9000 / .vimrc
Last active January 14, 2016 01:30
vimrc: 日本語文字化け回避と、ステータス行へ fenc 表示を追加する.
set enc=utf-8
set fencs=ucs-bom,iso-2022-jp,euc-jp,sjis,utf-8
set fileformats=unix,dos,mac
set laststatus=2
set statusline=%<%F%h%m%r\ [%Y][%{&ff}][%{&fenc!=''?&fenc:&enc}:0x\%02.6B]%=%l,%c%V\ %P
" FROM <http://www.kawaz.jp/pukiwiki/?vim>
" if fenc is iso-2022-jp and buffer is ascii only then change fenc as enc
" if this failed, do :e ++enc=utf-8
if has('autocmd')
@hkuno9000
hkuno9000 / git-diff-excel.md
Last active December 30, 2023 13:47
How to git diff for MS-Excel files(xls/xlsx) on Windows-OS

How to git diff for MS-Excel files(xls/xlsx) on Windows-OS

  1. Download the xdoc2txt tool from: http://ebstudio.info/home/xdoc2txt.html#download
  2. extract "xdoc2txt.exe" and locate it on your PATH folder
  3. edit your gitattributes as A:
  4. edit your gitconfig as B:

A: append following texts to "~/.config/git/attributes" or ".git/info/attributes"

*.xls	diff=xdoc2txt
@hkuno9000
hkuno9000 / cdx.bat
Created November 13, 2015 01:38
fuzzy chdir on Windows batch file: change folder on a current folder or parent folder.
@echo off
for /D %%f in ("%1*" "..\%1*" "..\..\%1*") do if exist "%%f" chdir "%%f" & goto :EOF