Skip to content

Instantly share code, notes, and snippets.

View xtetsuji's full-sized avatar

OGATA Tetsuji xtetsuji

View GitHub Profile
@xtetsuji
xtetsuji / mov2mp4.sh
Last active July 8, 2024 06:17
For GitHub movie screenshot explaination, convet from .mov to .mp4 by avconvert command on macOS built-in
#!/bin/bash
set -eu
PRESET="PresetAppleM4V1080pHD"
function usage {
# local error_code=${1:-0}
cat <<EOF
Usage:
mov2mp4.sh input.mov
@xtetsuji
xtetsuji / feature-bundle.pl
Created June 16, 2024 04:22
Perl feature bundle list from %feature::feature_bundle on curren command perl
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say postderef);
use Data::Dumper;
my $table_col_separator = " | ";
my $table_first_row_separator = "| ";
my $table_last_row_separator = " |";
#!/bin/bash
# https://docs.docker.com/engine/install/ubuntu/
set -eu
# root でなかったら終了
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." 1>&2
exit 1
fi
@xtetsuji
xtetsuji / chrome-bookmark.pl
Created February 27, 2015 09:48
Google Chrome bookmark dumper for Mac OS X environment.
#!/usr/bin/env perl
# 2015/02/27 OGATA Tetsuji (@xtetsuji)
# MIT License
use strict;
use warnings;
use Encode;
use JSON::PP;
@xtetsuji
xtetsuji / table-sort-pref.pl
Created January 31, 2024 14:35
Japanese prefecture name sort on some Japanese character sets.
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
use utf8;
binmode STDOUT, ':utf8';
use Encode;
# 都道府県の漢字表記を北海道から沖縄県まで
my @prefs = (
@xtetsuji
xtetsuji / README.md
Last active January 4, 2024 13:55
Postfix mailq viewer. queue_ids -> [From, To, Date, Subject]

mailq-list.pl - Postfix mailq viewer.

DESCRIPTION

mailq-list.pl is Postfix mailq viewer.

Normal Postfix mailq command shows only envelope information. If you want to know header information, you run postcat command every each time.

maiq-list.pl supports that you can show all queues' header information.

@xtetsuji
xtetsuji / one-liner.txt
Last active December 9, 2023 14:03
1209 powered by 2023
perl -MMath::BigInt -E 'say Math::BigInt->new("1209")->bpow("2023")->to_base(10) =~ s/(?<=\d)(?=(?:\d\d\d)+(?!\d))/,/gr =~ s/((?:\d\d\d,){10})/$1\n/gr'|
@xtetsuji
xtetsuji / gh-noreply-address
Last active November 22, 2023 19:13
show my GitHub noreply address by gh-cli
#!/bin/bash
set -eu
gh api /user | jq -r '"\(.id)+\(.login)@users.noreply.github.com"'
@xtetsuji
xtetsuji / majide.js
Created June 21, 2023 02:45
MajiDe time-based event driven interface by Japanese named class and its methods.
class MajiDe {
/**
* MajiDe オブジェクトを作成する
* @param {Function} func - コールバック
*/
constructor(func) {
if ( !func || typeof func !== "function" ) {
throw new Error("第一引数は関数にして下さい");
}
this.func = func;
@xtetsuji
xtetsuji / defaultgw
Last active December 17, 2022 04:33
print default gateway. and open browser if argument has `-w`
#!/bin/bash
set -eu
browser=open
default_gw=$( route -n get 0.0.0.0 | grep gateway | sed -e 's/.*: //' )
if [ "_${1:-}" = "_-w" ] ; then
"$browser" "http://$default_gw/"
fi