golang update in centos

wget https://raw.githubusercontent.com/udhos/update-golang/master/update-golang.sh chmod 755 ./update-golang.sh which go sudo RELEASE=1.16.6 DESTINATION=/usr/lib ./update-golang.sh sudo alternatives --install /usr/bin/go go /usr/lib/go/bin/go 5 sudo alternatives --config go

January 6, 2022 · 1 min · Harshvardhan Malpani

basic cwp with jenkins and nodejs

hostname srv1.example.com yum -y install wget yum -y update reboot cd /usr/local/src wget http://centos-webpanel.com/cwp-el7-latest sh cwp-el7-latest -r no --phpfpm 7.3 --softaculous no reboot sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key sudo yum upgrade sudo yum install epel-release java-11-openjdk-devel sudo yum install jenkins sudo systemctl daemon-reload curl -sL https://rpm.nodesource.com/setup_12.x | bash - sudo yum install nodejs npm -y sudo npm install pm2@latest -g

December 28, 2021 · 1 min · Harshvardhan Malpani

Ways to block user via .htaccess

#Order deny,allow #Deny from all #Allow from 3.92.40.40 #Allow from 4.30.3.0/4 #Allow from 4.30.3.18 #Allow from 4.30.3.15 #Allow from 104.9.55.44 RewriteCond %{REMOTE_ADDR} !^(4\.30\.3\.[0-9]*)$ RewriteCond %{HTTP:X-Forwarded-For} !^(4\.30\.3\.[0-9]*)$ RewriteCond %{REMOTE_ADDR} !^(104\.9\.55\.44)$ RewriteCond %{HTTP:X-Forwarded-For} !^(104\.9\.55\.44)$ RewriteRule ^(.*) - [F]

December 9, 2021 · 1 min · Harshvardhan Malpani

S3 notes – how to make all s3 images public

aws configure --profile myproject // to test if it works or not aws s3 ls --profile myproject aws s3 cp \ --exclude "*" \ --include "*.jpeg" \ --content-type="image/jpeg" \ --metadata-directive="REPLACE" \ --recursive \ --acl public-read \ s3://myproject/ \ s3://myproject/ \ --dryrun --profile myproject aws s3 cp \ --exclude "*" \ --include "*.jpg" \ --content-type="image/jpeg" \ --metadata-directive="REPLACE" \ --recursive \ --acl public-read \ s3://myproject/ \ s3://myproject/ \ --dryrun --profile myproject aws s3 cp \ --exclude "*" \ --include "*.jpeg" \ --content-type="image/jpeg" \ --metadata-directive="REPLACE" \ --recursive \ --acl public-read \ s3://myproject/ \ s3://myproject/ \ --dryrun --profile myproject // not needed aws s3 sync . s3://my-bucket/path --acl public-read Dont forget to remove dryrun flag once you are sure.

October 7, 2021 · 1 min · Harshvardhan Malpani

JS Notes Object.is vs === Triple EqualTo

Source: Linkedin

September 29, 2021 · 1 min · Harshvardhan Malpani

How to fix Magento2 apis not working? fix coupon apis and other PUT OPTIONS APIs

The issue is actually related to your server’s configuration. By default all types of requests are not allowed. Please add the following to your .htaccess file <Limit GET POST OPTIONS PUT DELETE PROPFIND> Order allow,deny Allow from all Require all granted </Limit>

September 26, 2021 · 1 min · Harshvardhan Malpani

CSS Flashy button with glaze effect

.flashybtn { display: block; text-align: center!important; text-decoration: none!important; font-weight: 800!important; font-size: 1.5em; text-transform: uppercase!important; color: #fff!important; padding: 1em 0.1em 1em 0.1em!important; background-size: 200% auto!important; box-shadow: 0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)!important; background-image: linear-gradient(to right,#ff473d 0%,#ff379d 50%,#f13790 100%)!important; animation: gradient 1.5s ease infinite!important; width: 100%; position: relative; //change to fixed to make it sticky bottom: 0; left:0; z-index: 9999; } .flashybtn:before { content: ""; display: inline-block; position: absolute; background: rgb(255,255,255); width: 30px; height: 2em; left: 0; bottom: 0; filter: blur(1.5em); animation: 2s glaze infinite; } @keyframes glaze{ from{ transform: translateX(0) skewX(-15deg); opacity:1; } to { transform: translateX(100vw) skewX(-15deg); opacity:1; } } I am FLASHY

September 25, 2021 · 1 min · Harshvardhan Malpani

How to put a site in maintenance? [Apache web server]

ErrorDocument 403 /index.html DirectoryIndex index.html <Files ~ "index\.html"> Order Allow,Deny Allow from all </Files> Deny from all Content of your .htaccess file If you want to whitelist any IP, use this ErrorDocument 403 /index.html DirectoryIndex index.html <Files ~ "index\.html"> Order Allow,Deny Allow from all </Files> Order Allow,Deny Allow from xx.xxx.xx.xx Deny from all Here is a sample htaccess for a wordpress website with 1 IP whitelisted 4.129.45.44 and all others are banned. So you only will be able to load the website while everyone else will see contents of index.html with HTTP Status code 403 ...

September 8, 2021 · 1 min · Harshvardhan Malpani

How to generate a patch with edited files? How to zip latest committed changes only

zip archive.zip $(git diff-tree --no-commit-id --name-only -r latest-commit-id) Reference: https://stackoverflow.com/a/42971972/2229148 sometimes you need all the files that were updated so you can patch an external app which doesnt uses same git project or many other scenarios in which we need a zip or tar of those files. Use the above command to do so There is a smarter way also, if you want all the changes from last 5 commits, use the command like this: ...

September 6, 2021 · 1 min · Harshvardhan Malpani

Basic Authentication in nginx for any domain, server or location block

sudo yum install httpd-tools sudo htpasswd -c /etc/nginx/conf.d/vhosts/.htpasswd USERNAME Enter Password: xxxxx sudo chmod 644 /etc/nginx/conf.d/vhosts/.htpasswd Update the domain.conf file like /etc/nginx/conf.d/vhosts/myrestricteddomain.com.ssl.conf Ideally, use it in server config 1 2 3 4 5 server { satisfy all; auth_basic "Restricted Area"; auth_basic_user_file /etc/nginx/conf.d/vhosts/.htpasswd; location / { Save and restart nginx

August 3, 2021 · 1 min · Harshvardhan Malpani