Buy Me a Coffee

[Inkscape] How to Convert Svg to Png with Inkscape

Inkscape is a free and open-source vector graphics editor. Open the graphic software Inkscape Drag the svg file into the software Adjust the width and height Press Shift+Ctrl+E to open the dialog of Export PNG Image Change to Page tab and adjust the Width and Height. Set up the output path with the button Export As Export the file with the button Export

[HTTPS/TLS] How does HTTPs work

Another way to ask this question is what will happen after typing a https url in your web browser? The browser requests secure page (HTTPs) from a web server. The server sends its public key with its SSL certificate, which is digitally signed by a third party, or we call Certificate Authority, or simply CA. Once the browser gets the certificate, it will check the issuer’s digital signature to make sure the certificate is valid. As we know, a digital signature is created by a CA’s private key, and the browser, either Chrome or Firefox, is previously installed with many major CA’s public keys. Thus, digital signature can be verified. Once the certificate’s signature is verified, the digital certificate can be trusted. The browser creates one symmetric key, or a shared secret. It keeps one and gives a copy to the web server. However, the browser does not want to send the shared secret in plain text. Therefore, it uses the web server’s public key to encrypt the secret, and then sends it to the web server. When the web server gets the encrypted symmetric key, it uses its private key to decrypt it. Now the web server gets the browser’s shared key. From now on, all traffic between the client and the web server will be encrypted and decrypted with the same key, a symmetric key.

[Inkscape] How to create SVG file with an existing SVG image

Sometimes we need to extract part of the SVG from the original SVG image. This post will show how to do it with Inkscape. I will take the Storadera logo as an example. Go to Storadera website, we can see the company logo and download the logo Open the logo with web browser and inspect the element. We can see the logo is originally svg file. Open the graphic software Inkscape Drag the downloaded logo into the software Ungroup the logo Delete the text part, only keep the logo Place the logo at (0,0) Record the original width and height in specific unit Press Shift+Ctrl+D to edit the width and height and tick the Checkerboard background option Hold Ctrl and scroll the mouse to zoom up the image if it is too small Adjust the image position with up, down, left, and right arrow key Hold Ctrl and hover the mouse on the double direction arrow to adjust the image size. This will make a margin for the final image, which looks better Repeat the step#11 again for the image Change the color if necessary Save the file as a plain svg format

[Inkscape] How to create SVG file with an existing PNG image

Sometimes we need to extract part of the SVG from a PNG image. This post will show how to do it with Inkscape. I will take the Filebase logo as an example. Remove the white background Open the graphic software Greenfish Icon Editor Drag the .png file into the software Fill the colorful part with the black color Apply the white background to transparent with the color picker setting on the right bottom Save it as a png file with the original resolution Convert the png file to svg file Open the graphic software Inkscape Drag the previous .png file into the software Place the image at (0,0) Record the original width and height in specific unit Go to the Document Properties... in the File menu or press Shift+Ctrl+D, and edit the width and height as recorded previous and tick the Checkerboard background option Save the file as a plain svg format

parse json arguments from command-line flags

[Golang] How to parse the JSON arguments from the Command-line flags

Passing the JSON argument via the Command-line flag seems to be not typical, but we may need it in some cases. This post will show you how to implement it in Golang. The package flag provides an easy way to implement it. Let’s take a look at a simple example of using package flag first: package main import ( "flag" "fmt" ) func main() { var version string // parse the value of the flag setVersion to variable version flag.StringVar(&version, "setVersion", "1.0.0", "") flag.Parse() fmt.Println("version = ", version) } The output is ...

[HackerRank] Simple Explanation: Flatland Space Stations

Introduction Although the problem is categorized as “EASY” in terms of difficulty, I must admit that the solution didn’t immediately come to mind after reading the description. Nevertheless, I managed to find a straightforward and concise approach that is both easy to comprehend and implement. I won’t explain the requirement here, so before reading the below explanation, I highly suggested that making sure we understand this problem’s description. The challenge description can be found https://www.hackerrank.com/challenges/flatland-space-stations/problem ...

[Golang] reflect all

This post is about how to use reflect feature to implement as much as you want to do with Golang. Here are some cases: 1. How to get all the fields’ name of an object? 1type A struct{ 2 Foo string 3 Bar int64 4} 5 6func main() { 7 a := &A{Foo: "afoo"} 8 val := reflect.ValueOf(a).Elem() 9 for i:=0; i<val.NumField();i++{ 10 fmt.Println(val.Type().Field(i).Name) 11 } 12} The output: ...

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !