Install
brew install p7zip |
Extract
7z x file.7z |
Compress
7z a file.7z mydirectory |
cloud engineer
by Ulysses
Install
brew install p7zip |
brew install p7zip
Extract
7z x file.7z |
7z x file.7z
Compress
7z a file.7z mydirectory |
7z a file.7z mydirectory
by Ulysses
If you have a file with @ sign at end, this is how to remove extended attributes on the Mac OS.
Example.
ls -l -rwxr-xr-x@ 4 username staff 128 Mar 24 10:51 sample.txt |
ls -l -rwxr-xr-x@ 4 username staff 128 Mar 24 10:51 sample.txt
Remove extended attributes.
xattr -c sample.txt |
xattr -c sample.txt
Result
ls -l -rwxr-xr-x 4 username staff 128 Mar 24 10:51 sample.txt |
ls -l -rwxr-xr-x 4 username staff 128 Mar 24 10:51 sample.txt
by Ulysses
Here’s the script to backup GCP disks.
#!/bin/bash now=$(date +%s) disks=$(gcloud compute disks list --project project-id --filter="users:instance" --format="value(name)") for disk in $disks do gcloud compute disks snapshot $disk \ --snapshot-names=$disk-$now \ --zone=us-central1-a \ --project=project-id \ --async done |
#!/bin/bash now=$(date +%s) disks=$(gcloud compute disks list --project project-id --filter="users:instance" --format="value(name)") for disk in $disks do gcloud compute disks snapshot $disk \ --snapshot-names=$disk-$now \ --zone=us-central1-a \ --project=project-id \ --async done
by Ulysses
How to do search and replace in Vim.
Search for “foo” and replace it with “bar” in the current line. Use :s
:s/foo/bar/g |
:s/foo/bar/g
Search for “foo” and replace it with “bar” in the entire document. Use :%s
:%s/foo/bar/g |
:%s/foo/bar/g
You can also pipe instead of forward slash. Useful if your search contains a /.
:%s|foo/|bar|g |
:%s|foo/|bar|g
by Ulysses
In Redhat 8, every time you the Network Manager get’s restarted it overwrites /etc/resolv.conf. To prevent that from hapenning, create a new file called /etc/NetworkManager/conf.d/90-dns-none.conf and add the following lines. Restart Network Manager. Your /etc/resolv.conf should be unchanged.
[main] dns=none |
[main] dns=none
Restart Network Manager
$ systemctl reload NetworkManager |
$ systemctl reload NetworkManager
by Ulysses
Here’s how to get your project quotas in GCP.
gcloud compute project-info describe --project your-project-id |
gcloud compute project-info describe --project your-project-id
by Ulysses
Here’s how to get Regional Quotas for your project in GCP.
gcloud compute regions describe us-central1 --project your-project-id |
gcloud compute regions describe us-central1 --project your-project-id
by Ulysses
Here’s how to check if port is listening on a Windows Server.
Log in to the destination server.
netstat -ano | find "443" | find "LISTEN" tasklist /fi "PID eq "443" |
netstat -ano | find "443" | find "LISTEN" tasklist /fi "PID eq "443"