Wednesday, 24 June 2020

How to enable mandarin or Chinese characters or GBK supported in Ubuntu Sublime?

p/s: copied from https://github.com/seanliang/Codecs33/tree/linux-x64

Description (中文说明见README.zh_CN.md)

Due to the limitation of embedded Python with Sublime Text 3, ConvertToUTF8 might not work properly. You can install this plugin to solve the problem.



Installation
Using Package Control to find, install and upgrade Codecs33 is the recommended method to install this plug-in.
Otherwise, you can download this repository as a zip file from one of the branchs (osx, linux-x64, linux-x32) which matchs your platform. Unzip the archive and rename the new folder to Codecs33, then move this folder to Packages folder of Sublime Text (You can find the Packages folder by clicking "Preferences > Browse Packages" menu entry in Sublime Text).

Tuesday, 23 June 2020

Wednesday, 17 June 2020

How to use 7z to zip and unzip with a password?

From http://www.dotnetperls.com:
7z a secure.7z * -pSECRET
 
Where:
7z        : name and path of 7-Zip executable
a         : add to archive
secure.7z : name of destination archive
*         : add all files from current directory to destination archive
-pSECRET  : specify the password "SECRET"
 
To open :
7z x secure.7z
 
Then provide the SECRET password
Note: If the password contains spaces or special characters, then enclose it with single quotes
7z a secure.7z * -p"pa$$word @|"

How to use github for source code maintainance?


For own repository maintainance, you can do the following steps:-
1. git clone the github_code_as_root
2. cd root
3. run or modify something in the code
4. cd root
5. git add .
6. git commit "changes have been done"
7. git push
(all code in the master branch of github will be updated)


For collaborated project with others, everything is the same, except:
1.git clone the github_code_as_root
2.cd root
3. git checkout -b ninja_branch
4. git status
5. (modify something, blak blak blak)
6. git add .
7. git commit -m "fix more errors in using scores versus score"
8. git push -u origin ninja_branch
(go to github website and pull a request for merging, add someone to review)

How to remove and create folder at the same time in python?

import os
opath = 'output/images'
if os.path.exists(opath):
    shutil.rmtree(opath)  # delete output folder
os.makedirs(opath)  # make new output folder