Web

Add Contact Form in Hugo Site

Create a lambda function to send the contact message Setup SES and verify sender email address Create an IAM role for lambda with policy details below { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "ses:SendEmail", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "*" } ] } Create the lambda function const aws = require("aws-sdk"); const ses = new aws.SES({ region: "ap-southeast-2" }); exports.handler = async function (event) { console.

Enable Raw Html in Hugo

Enable support of raw html Hugo disables html element rendering by default, we need to enable it. Enable for an entire site Add below in the config file [markup.goldmark.renderer] unsafe= true Enable for a single page Create layout/shortcodes/unsafe.html with the following content: {{ .Inner }} In the markdown page, use it like this, {{< unsafe >}} <ul> <li>First item</li> <li>Second item <li>Third item</li> </ul> {{< /unsafe >}} above will be rendered like this, First item Second item Third item Reference How To Escape Shortcode In Hugo Template Configure Markup Create Your Own Shortcodes Enable unsafe=true for a single page

How to Create Site With Hugo

Install hugo on Centos7 Add epel repo The Hugo package can be found at https://copr.fedorainfracloud.org/coprs/daftaupe/hugo/, take the correct version, and place it in /etc/yum.repos.d/hugo.repo vim /etc/yum.repos.d/hugo.repo # add content below the file [copr:copr.fedorainfracloud.org:daftaupe:hugo] name=Copr repo for hugo owned by daftaupe baseurl=https://download.copr.fedorainfracloud.org/results/daftaupe/hugo/epel-7-$basearch/ type=rpm-md skip_if_unavailable=True gpgcheck=1 gpgkey=https://download.copr.fedorainfracloud.org/results/daftaupe/hugo/pubkey.gpg repo_gpgcheck=0 enabled=1 enabled_metadata=1 Install yum -y install hugo hugo version Quick start # Create a new site hugo new site mysite # Add a Theme cd mysite git init git submodule add https://github.

How to Deactivate a Atlassian User

There are two different set of APIs for managing atlassian users, so there will be different ways to deactivate a user. Deactivate a user from Admin portal Go to https://admin.atlassian.com/o/{org_id}/members Go to Directory -> Managed accounts Click the user Click Deactivate account button Deactivate a user with User Management API curl --request POST \ --url 'https://api.atlassian.com/users/{account_id}/manage/lifecycle/disable' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ Deactivate a user with User Provisioning API if a user was provisioned by User Provisioning API, the previous step will not work, it has to be deactivated with User Provisioning API, for example, we need to deactivate a user test@example.

How to Find the Size of LocalStorage

Sometimes, an error occurred (Failed to execute ‘setItem’ on ‘Storage’: Setting the value of ‘xxxxx’ exceeded the quota Vue) when adding data to local storage due to storage being full, but not sure which one uses more and how much it is, Found below code which is very helpful. one line version var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).