Skip to content

Instantly share code, notes, and snippets.

View yasuoohno's full-sized avatar

Yasuo Ohno @yasuo_ohno yasuoohno

  • Yokohama/Kanagawa/Japan/Asia
View GitHub Profile
#
# add path if the path is not exist.
#
function addpath() {
if echo ":$PATH:" | fgrep -q -s -v ":$1:" && [ -d "$1" ] ; then
PATH="$1:$PATH"
fi
}
@yasuoohno
yasuoohno / remove-all-containers.sh
Created February 27, 2019 07:30
remove all docker container
#!/usr/bin/env bash
docker rm `docker ps -a | awk '{print($1)}' | grep -v CONTAINER`
@yasuoohno
yasuoohno / remove-usb-hdd.bash
Created March 1, 2019 07:36
Remove USB HDD gracefully on Ubuntu.
#!/usr/bin/env bash
/usr/bin/udisksctl power-off -b $1
@yasuoohno
yasuoohno / .vimrc
Last active October 13, 2019 16:13
vimrc
au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set fenc=utf-8
set showcmd
set number
set cursorline
set smartindent
set showmatch
set ignorecase
@yasuoohno
yasuoohno / tuned-disable-thp.bash
Created December 21, 2019 03:59
Tuned - Disable Transparent HugePages
{
CUSTOM_TUNED="disable-thp"
PROFILE_DIR="/etc/tuned/$CUSTOM_TUNED"
TUNED_CONF="$PROFILE_DIR/tuned.conf"
ACTIVE_PROFILE=`tuned-adm active | cut -d " " -f 4`
sudo mkdir -p "$PROFILE_DIR"
cat <<EOF | sudo tee "$TUNED_CONF"
[main]
include= $ACTIVE_PROFILE
@yasuoohno
yasuoohno / launch-ssh-agent.fish
Created April 21, 2020 10:33
fish - launch ssh-agent, if it doesn't exist
#
# launch-ssh-agenet
#
function __lsa_get-sshenv
if set -q SSHENV
echo $SSHENV
else
echo $HOME/.ssh/.sshenv
end
end
@yasuoohno
yasuoohno / simlic.cmd
Created January 8, 2021 04:17
ontap simulator license file to license key list
@sed -n "s/.*\([A-Z]\{18\}AAAAAAAAAA\).*$/\1/p" %1 | sed -z "s/\n/,/g" | sed -e "s/,$//"
@yasuoohno
yasuoohno / generate-iscsi-initiatorname
Last active April 8, 2021 05:52
Generate iSCSI Initiator Name
#!/usr/bin/env bash
set -eu
INAME=/etc/iscsi/initiatorname.iscsi
InitiatorName=""
if [ -e ${INAME} ]; then
. ${INAME}
if [ "$InitiatorName" != "" ]; then
# nothing to do.
exit 0
@yasuoohno
yasuoohno / msvc.cmd
Created February 25, 2024 06:21
enable msvc compiler
@ECHO OFF
SETLOCAL
SET CURRENT_DIR=%CD%
PUSHD "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build"
CMD /K "CALL VCVARS64.BAT & PROMPT $E[1;35m$CMSVC$F %PROMPT% & CD %CURRENT_DIR%"
POPD
ENDLOCAL
EXIT /B 0
@yasuoohno
yasuoohno / gist:3d9556113fd0dd8130d7aff12e396412
Created March 6, 2024 17:14
uutils-coreutils Windows doskey macros
b2sum=coreutils b2sum $*
b3sum=coreutils b3sum $*
base32=coreutils base32 $*
base64=coreutils base64 $*
basename=coreutils basename $*
basenc=coreutils basenc $*
cat=coreutils cat $*
cksum=coreutils cksum $*
comm=coreutils comm $*
cp=coreutils cp $*