Skip to content

Instantly share code, notes, and snippets.

@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'
...
```
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
sort.sh - sort wrapper for saving original order of lines which have the same key values.

sort.sh

This script is the sort wrapper for saving original order of lines which have the same key values.

Usage

sort.sh [OPTIONS ...] [FILES ...]
Options:
  See help or manpage of sort commnand.
@kou1okada
kou1okada / Makefile
Last active November 1, 2018 07:06
maginfo - An example of Windows Magnification API
.PHONY: all clean
TARGETS=maginfo
LIBS=`cygpath -S`/Magnification.dll
all: $(TARGETS)
maginfo: maginfo.cpp
$(CXX) -o $@ $< $(LIBS)