Blog

Blog

Enable Chinese in Windows 10

Enable Chinese in Windows 10

Add Preferred Languages

  • Go to Settings => Time & Language

  • Go to Language => Preferred languages

  • Click on Add a language to add Chinese

Add Keyboard (Input Method)

After language added in previous step

  • Go to Language options => Keyboards

  • Select Add a keyboard, then select input method to be added

Change locale (Default non-Unicode language)

After language added in first step

  • Click on Administrative language settings, then Region => Administrative window appears

  • Click on Change system locale..., Region Settings window appears

  • Select Chinese in Current system locale

  • Click on OK button

Turn on Hibernate in Windows 10

Turn on Hibernate in Windows 10

In power menu

  • Goto Control Panel\Hardware and Sound\Power Options\System Settings

  • Click on Change settings that are currently unavailable, this is to enable check box of Hibernate

  • Check Hibernate

  • Click on Save Changes

Minutes before Hibernate

  • Goto Control Panel\Hardware and Sound\Power Options\Edit Plan Settings

  • Click on Change plan settings beside current plan

  • Click on Change advanced power settings, then Power Options window appears

  • Expand Sleep->Hibernate after, change value in Settings

Remote Desktop

  • Goto Settings=>For developers=>Remote Desktop

  • Deselect Change settings so that the PC never hibernates when plugged in

Make keys behave like Windows on MacOS

Make keys behave like Windows on MacOS

I tried, but failed for Control Arrow Keys. Anyway I decided drop this idea, because it is a partial solution, the Control Arrow Keys doesn't work.

Steps

Create a file ~/Library/KeyBindings/DefaultKeyBinding.dict has following contents

{
  "\UF729"  = moveToBeginningOfLine:; // home
  "\UF72B"  = moveToEndOfLine:; // end
  "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift+home
  "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift+end
  "^\UF729" = moveToBeginningOfDocument:; // ctrl+home
  "^\UF72B" = moveToEndOfDocument:; // ctrl+end
  "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl+shift+home
  "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl+shift+end
  "^\UF702" = "moveWordBackward:"; // ctrl+leftarrow
  "^\UF703" = "moveWordForward:"; // ctrl+rightarrow
  "^$\UF702" = "moveWordBackwardAndModifySelection:"; // shift+ctrl+leftarrow
  "^$\UF703" = "moveWordForwardAndModifySelection:"; // shift+ctrl+rightarrow
}

Alternatively, change Line to Paragraph, depending on your prefers.

References

Make Home & End keys behave like Windows on Mac OS X

Mount SMB3 in Linux

Mount SMB3 in Linux

Install package

sudo apt install cifs-utils

Mount from command line

sudo mount -t cifs //192.168.1.100/Movies /mnt/Media vers=3.0,credentials=/etc/smbcredentials,uid=111,gid=1000,pass=PASSWORD

Add into /etc/fstab

  • Create credentials file /etc/smbcredentials
username=user
password=password
domain=domain
  • Update mode
chown root:root /etc/smbcredentials
chmod 600 /etc/smbcredentials
  • Update /etc/fstab
//server/share_name  /mnt/smbshare  cifs  credentials=/etc/smbcredentials,vers=3.0,file_mode=0755,dir_mode=0755 0       0

References

How to Mount Windows Share on Linux using CIFS

Disable Apple mouse swipe action

Disable Apple mouse swipe action

It is very easy for Apple mouse understands wrongly, and take action to back to my previous page. As the result, my few hours working on WordPress disappered.

Change mouse

Then I start using normal mouse, but hard to change between screen using keyboard, my remote control and virtual machine doesn't understand the keys, and holding keyboard actions made wrong password in login screen.

Disable swipe action

Then I found the way to disable swipe action as below

system preferences>trackpad or mouse>more gestures tab>uncheck "swipe between pages".

References

I just accidentally swiped right on my web page...how do I get it back?

Ping fails but nslookup works in MacOS

Ping fails but nslookup works

When performing nslookup, the IP can be returned. But when performing ping, return following error

ping: cannot resolve <hostname>: Unknown host

Causes

Second DNS server issue

The second DNS server isn't resolving the IP address.

Another DHCP server issue

Another DHCP server provide different DNS server.

Fix

killall -HUP mDNSResponder

References

DNS lookup fails but nslookup works

Install OpenVPN client in ubuntu

Install OpenVPN client in ubuntu

Due to PPTP might not available, OpenVPN can be a good choice.

Packages

apt install openvpn

Configuration file

Configuration file should be downloaded from OpenVPN server.

Test

openvpn --config client.ovpn

Enable option

In /etc/default/openvpn, enable following line

AUTOSTART="all"

Copy config file

cp client.ovpn /etc/openvpn/client.conf

Note: the file name should be client.conf

Enable password (Optional)

Change auth-user-pass to auth-user-pass pass in client.conf.

Then create account info in pass file, and change mode

chmod 400 /etc/openvpn/pass

Enable service

systemctl enable openvpn@client.service
systemctl daemon-reload
systemctl start openvpn@client

References

Linux - Autostart OpenVPN in systemd (Ubuntu)

Configure PPTP in Ubuntu

Configure PPTP in Ubuntu

Install packages

apt-get install pptp-linux

Configure password

vi /etc/ppp/chap-secrets

The format should be

pptpuser    PPTP    pptppassword    *

Create route script

Create file /etc/ppp/ip-up.d/route-traffic

#!/bin/bash

route add -net 192.168.1.0/8 dev ppp0

Change mode to executable

chmod +x /etc/ppp/ip-up.d/route-traffic

Create dial up configure

The name of file is defined as connection name, such as /etc/ppp/peers/<CONNECTON>

pty "pptp <HOST> --nolaunchpppd"
name <USER>
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam <CONNECTON>

Open filewall

iptables -A INPUT -i pptp -j ACCEPT
iptables -A OUTPUT -o pptp -j ACCEPT

Connect and disconnect

pon <CONNECTON>
poff <CONNECTION>

Troubleshooting

If didn't configure PPTP Passthrough on your NAT, then PPTP will failed.

PPTP uses a TCP channel on port 1723 for control and the GRE protocol to encapsulate data and create a VPN tunnel. The issue isn’t really PTPP itself but GRE; GRE doesn’t use ports. Since a requirement of NAT is that the connection must use an IP address and port number it doesn’t work with GRE. This is what PTPP passthrough addresses.

References

Set up Linux PPTP Client from the Terminal
Connect to PPTP server via command line on Ubuntu
pptp - 'Administrative Shutdown'. Error code is 0, Cause code is 0