Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import concurrent.futures
import copy
import os
from typing import (
Any,
Callable,
)
#!/usr/local/bin/perl5
#
# Time-stamp: <1999-07-04 19:15:55 hirose31>
#
# flock() を使わなくても壊れないカウンタ
# つっても排他制御してるんだけどね。
#
BEGIN: { $|++; }
<details>
<summary>押してみそ?</summary>
な?
```pl
use strict;
```
どう?
</details>
# https://twitter.com/hirose31/status/1519559294546747392?s=20&t=23VtFa6D63RSB3Go2boDYw
sub mysql_clientversion {
require DBD::mysql;
no warnings qw(redefine);
local *DBD::mysql::db::_login = sub { 1 };
my $dbh = DBI->connect('dbi:mysql:');
return $dbh->{mysql_clientversion};
}
$ make
make all-am
make[1]: Entering directory `/home/hirose31/repos/ftrace-0.93'
gcc -fPIC -shared -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 -o libftrace.so libftrace_so-libftrace.o libftrace_so-prototype.o -ldwarf -lpthread -ldl -lelf
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libdwarf.a(dwarf_die_deliv.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libdwarf.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libftrace.so] Error 1
make[1]: Leaving directory `/home/hirose31/repos/ftrace-0.93'
make: *** [all] Error 2
bzcat
bzcmp
bzexe
bzip2
chacl
chgrp
chmod
chown
dmesg
egrep
@hirose31
hirose31 / gist:1668178
Last active June 7, 2021 07:46
/proc/PID/statからプロセスの起動時刻を知る
use POSIX qw(strftime sysconf _SC_CLK_TCK);
use File::Slurp;
use Time::Piece;
use Time::HiRes qw(time);
my $TIME_OF_BOOT = time_of_boot();
my $CLOCK_TICK = sysconf(_SC_CLK_TCK);
MAIN: {
my $pid = shift or die "missing PID";
global screenWidth
global screenHeight
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution | tail -n 1") to set {screenWidth, screenHeight} to {word 2 as number, word 4 as number}
-- display dialog "screen: " & screenWidth & "x" & screenHeight
if screenWidth = 1200 then
-- display dialog "monitor U2410"
tell application "System Events"
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010_000;
use Data::Dumper;
# https://perldoc.jp/docs/perl/5.26.1/perlvar.pod
# <FH>, readline, readdir, each が単独で while テストで テストされた場合の、次の値や入力レコードを入れるデフォルトの場所。 while テスト以外ではこれは起こりません。
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010_000;
use Data::Dumper;
use JSON;
say $^V;