Archive of

Windows 10 小狼毫(RIME)安装五笔拼音输入法

  1. https://rime.im/ 下载安装
  2. 右键点击“中”字图标,在弹出菜单中点击“输入法设定”
  3. 在弹出窗口中点击“获取更多输入方案”,这时会弹出一个 cmd 窗口让你输入需要添加的方案
  4. 先输入 rime-wubi 回车,wubi就自动装上了
  5. 再输入 rime-pinyin-simp 回车,拼音也装上了。
  6. 回车并随手关掉这个 cmd 窗口,加输入法的工作就完成了。
  7. 回到刚才点击 “获取更多输入方案” 的窗口,勾掉你不需要的那些七七八八的输入法,选中刚刚添加上的“五笔拼音”,然后再点一下 “中”按钮 (不是右下角的“中”图标),选择一个你喜欢的风格。

Mission Accomplished!

Enjoy 你的五笔拼音吧! (By the way,写此Blog时我用的小狼毫版本是 0.14.3 )

CentOS 7 firewall-cmd open a port permanently

    [root@centos7 ~]# firewall-cmd --permanent --add-port=100/tcp
    success
    [root@centos7 ~]# firewall-cmd --reload
    success

From how-to-open-a-port-in-centos-7-with-firewalld

Tips for dotnet user-secrets

  • On the Windows platform, the secrets file are saved at /Users/yourusername/%APPDATA%/Microsoft/UserSecrets/{projectid}/secrets.json;
  • On Linux/Mac platform, the secrets file are saved at ~/.microsfot/usersecrets/{projectid}/secrets.json.

Believe it or not, .NET Core console application doesn't support user secrets in its default configuration. You can use dotnet command set or list your secrets, but actually, you cannot get its value through the IConfiguration object. What's a shame!

Finally, you may want to import secrets from one project to another project. I just wrote a small single-file script to save myself. Certainly, you can also use it if you like.

The tool has been published on Github, here it is.

SSH Config Tips: RemoteFoward and LocalForward

Suppose you have a local laptop without a public IP named A (192.168.1.7) and a remote server that has a public IP name named B (172.16.0.77) and another remote server C (172.16.0.78) which is in the same LAN with B. You can connect to B directly by ssh, and you cannot connect to C directly because C doesn't have an external IP address.

  1. You want to map port 5001 on A to the same port on B to make you local service temporarily public), you should add this line in laptop A's .ssh/config file:

     RemoteForward 5001 localhost:5001 #here localhost refers to A
    
  2. You want to map port 3306 on Host B (Remote machine) to the 3306 port on Host A (your laptop), you should add this line in laptop A's .ssh/config file:

     LocalForward 3306 localhost:3306  # here localhost refers to B
    
  3. You want to map port 22 on machine C to the 8045 port on A, add this line:

     LocalFoward 8045 172.16.0.78:22
    

Finally, the following code shows the final configuration in your ~/.ssh/config file

            Host B
		HostName b.somedomain.com
		Port 22
		RemoteForward 5001 localhost:5001
		LocalForward 3306 localhost:3306
		LocalForward 8045 172.16.0.78:22

Thus, after you get connected with Host B through this config file,

  • You can tell your friends or colleague to visit your local website by visiting http://b.somedomain.com:5001.
  • You can get connected to Host C directly by running ssh -p 8045 username@localhost command.
  • You can also directly visit the locally deployed MySQL service on Host B by connecting your local laptop's 3306 port.

Methods for receiving JSON data in an Asp.NET core Controller

  1. [HttpPost] 
    public  IActionResult Fill([FromBody] dynamic data)
    {
         string amount = data.amount.GetString();
    }
    
  2.  [HttpPost] 
     public  IActionResult Fill()
     {
          string dataStr = new StreamReader(Request.Body, Encoding.UTF8).ReadToEnd();
          var data = JObject.Parse(dataStr);
          string amount = data.value.amount;
     }
    
  3. [HttpPost] 
    public  IActionResult Fill([FromBody] YourType data)
    {
        string amount = data.amount;
    }