Skip to content

Instantly share code, notes, and snippets.

Avatar

Yasuo Ohno @yasuo_ohno yasuoohno

  • Yokohama/Kanagawa/Japan/Asia
View GitHub Profile
@yasuoohno
yasuoohno / generate-iscsi-initiatorname
Last active April 8, 2021 05:52
Generate iSCSI Initiator Name
View generate-iscsi-initiatorname
#!/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 / simlic.cmd
Created January 8, 2021 04:17
ontap simulator license file to license key list
View simlic.cmd
@sed -n "s/.*\([A-Z]\{18\}AAAAAAAAAA\).*$/\1/p" %1 | sed -z "s/\n/,/g" | sed -e "s/,$//"
@yasuoohno
yasuoohno / launch-ssh-agent.fish
Created April 21, 2020 10:33
fish - launch ssh-agent, if it doesn't exist
View launch-ssh-agent.fish
#
# launch-ssh-agenet
#
function __lsa_get-sshenv
if set -q SSHENV
echo $SSHENV
else
echo $HOME/.ssh/.sshenv
end
end
@yasuoohno
yasuoohno / tuned-disable-thp.bash
Created December 21, 2019 03:59
Tuned - Disable Transparent HugePages
View tuned-disable-thp.bash
{
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 / .vimrc
Last active October 13, 2019 16:13
vimrc
View .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 / remove-usb-hdd.bash
Created March 1, 2019 07:36
Remove USB HDD gracefully on Ubuntu.
View remove-usb-hdd.bash
#!/usr/bin/env bash
/usr/bin/udisksctl power-off -b $1
@yasuoohno
yasuoohno / remove-all-containers.sh
Created February 27, 2019 07:30
remove all docker container
View remove-all-containers.sh
#!/usr/bin/env bash
docker rm `docker ps -a | awk '{print($1)}' | grep -v CONTAINER`
View addpath.sh
#
# 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
}