Monthly Archives: February 2021

ubuntu gcloud

apt install apt-transport-https ca-certificates gnupg -y
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

apt update
apt install google-cloud-sdk

gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must log in to continue. Would you like to log in (Y/n)?

upgrade/downgrade mongo

systemctl stop mongod.service
apt update
apt install mongodb-org=3.6.8 mongodb-org-mongos=3.6.8 mongodb-org-server=3.6.8 mongodb-org-shell=3.6.8 mongodb-org-tools=3.6.8
systemctl start mongod.service

mongo
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

vi /etc/apt/sources.list.d/mongodb-org-4.0.list
deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse
apt update mongodb*
apt upgrade

wtmp clear last 10

#include
#include

struct utmp foo;

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

Perl:
$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;