Notes - Caddy Server

Installation

How to install Caddy to MacBook?

Install Homebrew

Homebrew: The Missing Package Manager for macOS (or Linux)

// Install the Howebrew from Mac terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Caddyserver

homebrew install caddy

To start caddy new and restart at login:

祷读经文 - (2020 - 2021 年度)

2020年8月31日开始新一轮读经。这里是每周的祷读经文汇总,方便大家复习参考。经文按照时间先后次序排列。最近一周的祷读经文在上面,以前的经文放在下面。

Notes - Go Programming Language

Tips

Regular expression is not a const

There are boolean, rune, integer, floating-point, complex, and string constants. Rune, integer, floating-point, and complex constants are collectively called numeric constants.

Website Security With ReCAPTCHA

reCAPTCHA is a free google service that protects your website from spam and abuse. reCAPTCHA uses an advanced risk analysis engine and adaptive challenges to keep automated software from engaging in abusive activities on your site. It does this while letting your valid users pass through with ease.

Notes - Linux

Linux Notes

Common Commands

How to show file permission?

ls /var/www -al

How to add a user?

sudo adduser new_username
// or
sudo useradd new_username

How to remove a user?

sudo userdel username
// remove user's home folder
sudo rm -r /home/username

How to change other user’s password?

// set / change password for user postgres
sudo passwd postgres

How to add a user to sudo group?

adduser username sudo
// or
usermod -aG sudo username

How to execute commands as other user?

su // as root
su - postgres // login as postgres
su postgres // switch to postgres

// preserve the entire environment (HOME, SHELL, USER, and LOGNAME) of the calling user
su -p postgres 

How to change file permission?

See https://help.ubuntu.com/community/FilePermissions

Notes - Excel

Tips

  • To insert current date: Ctrl+;
  • To insert current time: Ctrl+Shift+;
  • To add today’s date in such a way that it updates when you recalculate or reopen your spreadsheet: =Today()

Usage

XLOOKUP

Customer send asset list asking for status.

Tips - Label Printer

Models

What’s the difference between GK420d and GK420t?

GK420d = direct thermal (no printer ribbon facility), requires labels to be made from a direct thermal material in order to create print.

Deploying Static Website to Netlify

Netlify is a web developer platform that multiplies productivity.

Netlify provides continuous deployment services, global CDN, atomic deploys, instant cache invalidation, one-click SSL, a browser-based interface, and many other features for managing our Hugo website.

Python Study Notes

1. Intro

Python Crash Course 2E Study Notes

Interpreter

C:\Users\Andrew>python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Tools

Run Code

python hello.py

2. Variable and Simple Data Types

Naming and Variables

  • Start with string or underscore
  • Can use string, underscore, and number thereafter

String

# String literals in python are surrounded by either single quotation marks, 
# or double quotation marks.
"Hello"
'World'

String Methods

s="hello, World"
s.upper()
s.lower()
s.title()

f String

first_name = "ada"
last_name = "lovelace"
full_name = f"{first_name} {last_name}"
message = f"Hello, {full_name.title()}!"
print(message)

Tabs and Newlines

>>> Print("Hello, Eric's wife!")
Hello, Eric's wife!
>>> print("\tHello,\n\tWorld!")
    Hello,
    World!

Stripping Space

>> s=" Andrew "
>> s.rstrip()
' Andrew'
>> s.lstrip()
'Andrew '
>> s.strip()
'Andrew'

Number

Interger

1+2
3-1
4*5
7/8 # 0.875
9**3 # 729
(8+9)*3 # 51

Float

  • Python defaults to a float in any operation that uses a float, even if the output is a whole number.
  • you can group digits using underscores to make large numbers more readable
0.1*2 # 0.2
0.1+0.1 # 0.2

# arbitrary number of decimal may places in your result
3*0.1 # 0.30000000000000004
0.1+0.2 # 0.30000000000000004

# Divide any two integer get float
4/2 # 2.0
# Mix integer and float: get float
3+1.0 # 4.0

# Multiple assignment
x, y, z = 0, 0, 0

Constants

  • No built-in constant types
  • Convention: Use all capital letters
MAX_CONNECTS = 20

Comments

Use # to comment code. Anything after # are ignored.