Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / align_column.rb
Last active April 7, 2019 13:01
align_columns.rb
#!/bin/sh
exec ruby -x "$0" "$@"
#!ruby
# coding: utf-8
#
# align_column.rb
# Copyright (c) 2019 Koichi OKADA. All rights reserved.
# This script is destributed under the MIT license.
#
@kou1okada
kou1okada / vmps.sh
Last active January 11, 2022 11:52
vmps.sh - Report virtual memory status of a process.
#!/usr/bin/env bash
#
# vmps.sh - Report virtual memory status of a process.
# Copyright (c) 2019 Koichi OKADA. All right reserved.
# This script distributed under the MIT license.
#
function vmps () # <pid> [<delay>]
# Report virtual memory status of a process.
# Args:
@kou1okada
kou1okada / sorted_diff.sh
Last active March 6, 2019 03:58
sorted_diff.sh - Show differences for sorted inputs.
#!/usr/bin/env bash
#
# sorted_diff.sh - Show differences for sorted inputs.
# Copyright (c) 2019 Koichi OKADA. All right reserved.
# This script distributed under the MIT license.
#
# Note:
# This script is wastefull.
# Use the `join` command included in the coreutils.
@kou1okada
kou1okada / run_once.bash
Last active January 11, 2022 11:52
run_once.bash - run command only once
#!/usr/bin/env bash
#
# run_once.bash - run command only once
# Copyright (c) 2019 Koichi OKADA. All right reserved.
# This script distributed under the MIT license.
#
function run_once () # [<command> [<args> ...]]
# Run [<command> [<args> ...]] only once.
# Return:
@kou1okada
kou1okada / fixtimestamp.sh
Last active January 11, 2022 11:52
fixtimestamp.sh - fix timestamp
#!/usr/bin/env bash
#
# fixtimestamp.sh - fix timestamp
# Copyright (c) 2019 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
if (( $# <= 0 )); then
cat <<-EOD
Usage: ${0##*/} [OPTIONS] <shifted_time> <correct_time> [<files> ...]
@kou1okada
kou1okada / README.md
Last active January 22, 2019 07:20
haveibeenpwned.sh - Check pwnage of password.
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
ttystate - Determine tty state

ttystate - Determine tty state

Example

$ ./ttystate.bash 0
tty
$ ./ttystate.bash 0 <ttystate.bash
redirect
$ echo | ./ttystate.bash 0
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
hgrep - grep wrapper for saving header

hgrep

This script is the grep wrapper for saving header.

Usage

hgrep [OPTIONS ...] [FILES ...]
Options:
  See help or manpage of grep commnand.
@kou1okada
kou1okada / lapdu.sh
Created November 27, 2018 09:37
lapdu - Lap for du.
#!/usr/bin/env bash
#
# Lap for du.
# Copyright (c) 2018 Koichi OKADA. All rights reserved.
# This script is destributed under the MIT license.
#
source hhs.bash 0.2.0
function init_lapdu ()
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
git-preserving-mtimt: Git client hooks for preserving mtime.

git-preserving-mtimt: Git client hooks for preserving mtime.

git preserving-mtime saves timestamps for each file into the commit message as below format:


```timestamp
2018-11-19 13:05:04.193545100 +0900	'README.md'
...
```