Skip to content

Instantly share code, notes, and snippets.

View xtetsuji's full-sized avatar

OGATA Tetsuji xtetsuji

View GitHub Profile
@xtetsuji
xtetsuji / output.txt
Created November 8, 2024 15:10
PHP version xtrace
@xtetsuji ➜ /workspaces/codespaces-blank $ php tick_test.php
Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Executing /workspaces/codespaces-blank/tick_test.php on line 9
Hello
Executing /workspaces/codespaces-blank/tick_test.php on line 12
Executing /workspaces/codespaces-blank/tick_test.php on line 13
Executing /workspaces/codespaces-blank/tick_test.php on line 14
Result: 10
Executing /workspaces/codespaces-blank/tick_test.php on line 15
@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 = " |";
@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"'
#!/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 / 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