Category Archives: Uncategorized

wtmp clear last 10


struct utmp foo;

printf("%lu\n", sizeof foo);
return 0;

$utmp_size = utmp_record_size_goes_here;
$wtmp_file = "wtmp filename goes here";
open WTMP, "+<", $wtmp_file or die "$wtmp_file: ", $!; seek WTMP, -10 * $utmp_size, 2; truncate WTMP, tell(WTMP); close WTMP;

change birth creation date linux

sudo dd if=/dev/zero of=loop.img bs=100M count=10
sudo losetup -fP loop.img
sudo losetup -a
sudo mkfs.ext4 loop.img
mkdir loopfs
sudo mount -o loop /dev/loop0 loopfs
sudo touch loopfs/input.txt

sudo umount loopfs
sudo debugfs -R 'stat input.txt' /dev/loop0'

debugfs 1.45.5 (07-Jan-2020)
Inode: 15 Type: regular Mode: 0644 Flags: 0x80000
Generation: 1856443764 Version: 0x00000000:00000001
User: 0 Group: 0 Project: 0 Size: 42313
File ACL: 0
Links: 1 Blockcount: 88
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5f2f4acc:78970acc -- Sun Aug 12 04:01:00 2020
atime: 0x5f33c7f3:7fd665f4 -- Sun Aug 12 04:01:00 2020
mtime: 0x5f2f4acc:78970acc -- Sun Aug 12 04:01:00 2020
crtime: 0x5f2f4acc:b79f2b04 -- Sun Aug 12 04:01:00 2020
Size of extra inode fields: 32
Extended attributes:
security.selinux (37) = "unconfined_u:object_r:unlabeled_t:s0\000"
Inode checksum: 0x6371117e

sudo debugfs -w -R 'set_inode_field input.txt crtime 201808090101' /dev/loop0
sudo debugfs -w -R 'set_inode_field input.txt ctime 201808090101' /dev/loop0

Sometimes also need: echo 2 > /proc/sys/vm/drop_caches

Another way, but is not recommended to change system time:
NOW=$(date) && date -s "2022-08-10 21:10:10" && touch input.txt && date -s "$NOW"

varnish 6.4 ubuntu

vim /etc/apache2/ports.conf
vim /etc/apache2/sites-available/000-default.conf

systemctl restart apache2.service

apt-get install make automake autotools-dev libedit-dev libjemalloc-dev libncurses-dev libpcre3-dev libtool pkg-config python-docutils python-sphinx graphviz autoconf-archive curl git
git clone
sh && sh configure && make

varnishd -a :80 -T localhost:6082 -b localhost:8080

curl -I
HTTP/1.1 200 OK
Date: Tue, 28 Jul 2020 16:52:48 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Sun, 27 Nov 2016 03:03:10 GMT
Vary: Accept-Encoding
Content-Type: text/html
X-Varnish: 32801
Age: 0
Via: 1.1 varnish (Varnish/6.4)
ETag: W/"2c39-5423f985a9780-gzip"
Accept-Ranges: bytes
Connection: keep-alive

check port on some random server

printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))"
for i in {1..3}; do !!; done > sm_rnd_ip

while read HOST ; do nc -zvw3 $HOST 80 &> /dev/null; [[ $? -eq 0 ]] &&
printf "Port 80 is UP on %s\n" $HOST || printf 'Port 80 is DOWN on %s\n' $HOST ; done < sm_rnd_ip

Port 80 is DOWN on
Port 80 is DOWN on
Port 80 is DOWN on

check http2 support

if you are not sure if http2 is working:

echo | openssl s_client -alpn h2 -connect | grep -a ALPN
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN =
verify return:1
ALPN protocol: h2

h2 means http/2 is enabled

create tuntap

sudo ip tuntap add dev tap0 mode tap
sudo ip addr add dev tap0

sudo ip route | grep tap0 dev tap0 proto kernel scope link src linkdown

sudo ip link set tap0 up
sudo ip route add dev tap0 src

Firmware state: Copyback

while $(true); do /root/bin/MegaCli64 adpeventlog getlatest 200 -f ~/adpeventlog.txt a0; awk '/^Time/{TIME=$0};/Seconds/{SECS=$5}/^Event Desc/{printf("%25.25s %5.5s %s\n",TIME,SECS,$0);TIME=" ";SECS=""}' ~/adpeventlog.txt|grep -v fan|tac; sleep 5; done


Time: Tue Aug 20 16:11:43 Event Description: CopyBack progress on PD 10(e0x04/s12) is 82.04%(24461s)
Time: Tue Aug 20 17:30:05 Event Description: CopyBack progress on PD 10(e0x04/s12) is 83.04%(29163s)
Time: Tue Aug 20 18:21:06 Event Description: CopyBack progress on PD 10(e0x04/s12) is 84.04%(32224s