Talk is cheap. Show me the code.
RHEL Subscription
Register a new system and attach a subscription to it. Then execute the following commands to obtain the registration and subscription data using newly registered system UUID:
subscription-manager register --consumerid=UUID subscription-manager subscribe --autoEdit
/etc/yum.repos.d/redhat.repo to enable or disable additional repositories.
Non-root Process Listening on Priviledged Ports
Allow a user application to bind to a port below
1024 using POSIX File Capabilities:
setcap cap_net_bind_service=+eip /path/to/the/executable
Disabling CPU Cores
Disable all CPU cores except the first one which does not honor
online attribute:
for i in /sys/devices/system/cpu/cpu*/online; do echo 0 > $i; done
There Are Too Many Ways To Do It
Benchmark of Perl text replacing subroutines as taken from There are too many ways to do it presentation:
My own results (the table is split for better readability):
Rate delpoint8 elim_last pack01 count_and_replace sexeger
delpoint8 9237/s -- -58% -73% -82% -86%
elim_last 22232/s 141% -- -36% -58% -67%
pack01 34855/s 277% 57% -- -34% -49%
count_and_replace 52466/s 468% 136% 51% -- -23%
sexeger 68259/s 639% 207% 96% 30% --
two_parts 72359/s 683% 225% 108% 38% 6%
delpoint2 80775/s 774% 263% 132% 54% 18%
via_split 90009/s 874% 305% 158% 72% 32%
delpoint1 101626/s 1000% 357% 192% 94% 49%
rindex01 145985/s 1480% 557% 319% 178% 114%
look_ahead 163399/s 1669% 635% 369% 211% 139%
Rate two_parts delpoint2 via_split delpoint1 rindex01 look_ahead
delpoint8 9237/s -87% -89% -90% -91% -94% -94%
elim_last 22232/s -69% -72% -75% -78% -85% -86%
pack01 34855/s -52% -57% -61% -66% -76% -79%
count_and_replace 52466/s -27% -35% -42% -48% -64% -68%
sexeger 68259/s -6% -15% -24% -33% -53% -58%
two_parts 72359/s -- -10% -20% -29% -50% -56%
delpoint2 80775/s 12% -- -10% -21% -45% -51%
via_split 90009/s 24% 11% -- -11% -38% -45%
delpoint1 101626/s 40% 26% 13% -- -30% -38%
rindex01 145985/s 102% 81% 62% 44% -- -11%
look_ahead 163399/s 126% 102% 82% 61% 12% --
SSH Agent Forwarding for "sudo su"
Exporting of
SSH_AUTH_SOCK environment variable when using sudo su enables forwarding of user's SSH agent connection to root environment
(umask 0440; echo 'Defaults env_keep += "SSH_AUTH_SOCK"' > /etc/sudoers.d/ssh-auth-sock)Example of using
/etc/sudoers.d/ssh-auth-sock on host machine. The example assumes that the user copied already their public SSH key to the destination machines under root user:
$ ssh -A user@host [user@host]$ sudo su [root@host]# ssh remote [root@remote]#
dos2unix & unix2dos
Convert file with Windows line endings to UNIX and vice versa, all in Perl:
perl -i -pe 's/\r//g' dos2unix perl -i -pe 's/\n/\r\n/g' unix2dos
Subscribe to:
Posts (Atom)