Skip to content

Instantly share code, notes, and snippets.

@vdm
vdm / gist:5f299aa4c926e16e6379922b6fdf65db
Created January 2, 2025 12:56
x-amz-checksum-crc64nvme
$ curl -XPUT -H "x-amz-copy-source: /bucket/a" -H "x-amz-checksum-algorithm: CRC64NVME" --aws-sigv4 aws:amz:us-east-1:s3 --user AKIA...:...+ https://bucket.s3.amazonaws.com/key
<?xml version="1.0" encoding="UTF-8"?>
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2024-12-29T19:43:21.000Z</LastModified><ETag>"590046f3c30d87cfc3bca4b2f376d08b"</ETag><ChecksumCRC64NVME>ZJWXR44J9Qk=</ChecksumCRC64NVME></CopyObjectResult>
$ curl -H "x-amz-checksum-mode: ENABLED" --head --aws-sigv4 aws:amz:us-east-1:s3 --user AKIA...:...+ https://bucket.s3.amazonaws.com/key
HTTP/1.1 200 OK
x-amz-id-2: 3LMcx6/LPR5MJGz0L7WUZ0g8dJ6aPrPewidxDdi/ed2smPCYbXc3gczebpfNs5INMOjvHCsvL10=
x-amz-request-id: 0EDJAYS0Y4MHZVN9
Date: Sun, 29 Dec 2024 19:58:36 GMT
Last-Modified: Sun, 29 Dec 2024 19:43:21 GMT
@vdm
vdm / tcpdump-x.awk
Created December 10, 2024 17:49
tcpdump -x single column
# $ tshark -e udp.payload
# $ tcpdump -x | awk -f tcpdump-x.awk
END {
if (header != "") { print header " " hex }
}
/^[^\t]/ {
if (header != "") { print header " " hex }
header = $0
@vdm
vdm / gist:94966cea0479fbb09004f506386dcd01
Created June 28, 2024 16:06
Show process cmdlines tree without [kthreadd] kernel threads
ps f -N --ppid 2
@vdm
vdm / gist:673530a219fe92536010afd121954f90
Last active June 28, 2024 16:09
Show config across .d directories without comment or blank lines
tail -n+1 $(find /etc/logrotate* -type f) | grep -vE '^(#|$)'
tail -n+1 $(find /etc/rsyslog* -type f) | perl -ne 'print if !/^(\s*#|$)'
sudo bash -c 'tail -n+1 $(find /{etc,var/spool}/cron* -type f)' | grep -vE '^(#|$)'
@vdm
vdm / gist:ea3cada07dbb2be68b33c364d0fe6fca
Last active November 23, 2023 11:55
Import key from agent to EC2
$ aws --version
aws-cli/2.11.21
$ aws ec2 import-key-pair --public-key-material "$(ssh-add -L)" --key-name $USER
Invalid base64:
$ aws --cli-binary-format raw-in-base64-out ec2 import-key-pair --public-key-material "$(ssh-add -L)" --key-name $USER
@vdm
vdm / gist:0953fa9de17fcef171409e067010c615
Created November 20, 2023 18:05
terminal-width ruler
$ echo $COLUMNS
80
$ eval printf '=%.0s' {1..$COLUMNS}; echo
================================================================================
$ eval printf -- '-%.0s' {1..$COLUMNS}; echo
--------------------------------------------------------------------------------
@vdm
vdm / README.md
Created July 19, 2023 14:01
Serial console resizing

Unlike ssh, serial consoles like virsh console don’t receive SIGWINCH and so instead of resizing they stay stuck at 80x24, making line wrapping, tab completion, curses and reading in a pager difficult.

So get the terminal size from the outside bash shell, and set the same values manually within the serial console:

host$ echo $LINES $COLUMNS
182 92
host$ sudo virsh console guest
guest$ stty rows 182 cols 92

Keybase proof

I hereby claim:

  • I am vdm on github.
  • I am vdm (https://keybase.io/vdm) on keybase.
  • I have a public key ASAyFJiVNTfbX-LeffIhDPGxqB5x6m7bl4r-b84QBMyOYwo

To claim this, I am signing this object:

@vdm
vdm / ixgbevf-upgrade.sh
Last active November 28, 2019 21:35
ixgbevf 2.16.1 upgrade for AWS EC2 SR-IOV "Enhanced Networking" on Ubuntu 14.04 (Trusty) LTS
ssh [email protected] "bash -s -x" -- <ixgbevf-upgrade.sh
@vdm
vdm / gist:fef7ad831e0395e581e9
Created May 27, 2014 16:34
postgresql93-9.3.4 setproject: No such process
# pkgin in postgresql93-9.3.4
[...]
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
updating database: 100%
marking postgresql93-9.3.4 as non auto-removable
# /usr/sbin/svcadm enable svc:/pkgsrc/postgresql:default
# svcs -xv
svc:/pkgsrc/postgresql:default (PostgreSQL RDBMS)