markdown 从repo克隆一个文件

https://www.quora.com/How-can-I-pull-one-file-from-a-Git-repository-instead-of-the-entire-project

clone-file-repo.md
```
git fetch <remote>
git checkout FETCH_HEAD -- <file>
```
FETCH_HEAD is just a ref and it points to the tip, meaning the latest commit on the particular file only.

markdown 单元测试

单元测试单元测试lib

utest.md
Always write unit test cases in a file which starts with test_something.py

To run a test write on terminal 

python -m unittest test_something.py

in class test_something.py define a class and inherit from unittest.TestCase class ClassName(object):
	"""docstring for ClassName"""
	def __init__(self, arg):
		super(ClassName, self).__init__()
		self.arg = arg
		

write the main function in the file 

if '__name__' = '__main__':
		unittest.main()

and then run 

python test_something.py

both will give some result like:

Ran 1 test in 0.000s

write all function names like test_something otherwise that test function will not run


setUp()
and 
tearDown() methods run before and after of each test if defined


to run something before every test case
and to run something after every test case run:

setUpClass
and tearDownClass classmethod


from unittest.mock import patch 

use patch as derocator or context manager


markdown Ubuntu笔记

Ubuntu_commands.md
To check if a service is installed :
 sudo service <service_name> status

 What runs on port number 

sudo netstat ls -nptl| grep '9200'


If you want to remove Openjdk along with dependencies and it’s configuration files, execute the following command on terminal:

$ sudo apt-get purge --auto-remove openjdk*



to recursively install all packages in a file aditi.txt

pip install -r aditi.txt


mongo db path structure


python 
flask
mongo path

pytransition

search process id

ps -ax | grep py


create env from virtualenv(pip install of python2.7) from python3.6

virtualenv -p /usr/bin/python3.6 caas_env

Issues related to address binding:

Check what is running on port number and kill:

sudo netstat -plten | grep 5000

kill -9 <process_id>

quite tig : q

fg  : foreground

cntrl z will send the 

For checking any shell command inside out

https://explainshell.com/

- Kill a service at port 8000
  + sudo fuser -k -n tcp 8000




markdown UMS集成初始核对表

UMS集成初始核对表

todo.md

- [ ] Check for the implementation of user perm in Django
- [ ] Check for the implementation of user perm in Flask
- [ ] Brainstorm on UMS implementation.
- [ ] See the integration of FAAS in HQ.
- [ ] ms_integration file contains all the wrappers
- [ ] HQ user staging data dump into UMS staging
- [ ] Prod user data dumo into UMS prod 
- [ ] Mapping of users table in HQ with that in UMS

markdown CSS黑客攻击

css-hacks.md
- My favorite CSS hack: https://dev.to/gajus/my-favorite-css-hack-32g3
  - Different depth of nodes will use different colour allowing you to see the size of each element on the page, their margin and their padding. Now you can easily identify inconsistencies.

markdown DivScreen.md

DivScreen.md
[![Image from Gyazo](https://i.gyazo.com/ccc4d911b4d068a8dacf64f3a37826c2.gif)](https://gyazo.com/ccc4d911b4d068a8dacf64f3a37826c2)

http://glslsandbox.com/e#57175

面を分割する。タイルレイアウトや模様を描くときに使用。

拡大して1以下に丸める

```
st *= 2. + sin(u_time);  // Scale up the space by 1-3
st = fract(st); // Wrap arround 1.0
```

関数化

```
vec2 tile(vec2 _st, float _zoom){
  _st *= _zoom;
  return fract(_st);
}
```

## fract(x)
引数の小数点以下(`x-floor(x)`)を返す

https://thebookofshaders.com/glossary/?search=fract

正の数だけ見れば `fract(x) = mod(x,1.0)` と言える

[![Image from Gyazo](https://i.gyazo.com/f64f3997a22fbf2cada1ba6b1597e88b.png)](https://gyazo.com/f64f3997a22fbf2cada1ba6b1597e88b)


cf. https://thebookofshaders.com/09/?lan=jp

markdown WordPress的构筑メモ

.md
# セキュリティ対策  
## .htaccess  
- wp-config.phpへのアクセス制限  
- wp-login.php階層下にベーシック認証  
- .htaccess/.htpasswdへのアクセス制限  
- .htaccess/.htpasswdのパミッションを変更 600 / 644  
- wp-comments-post.phpへのアクセスを制限する  

## function.php  
-  XML-RPCを無効にする  
-  WordPressのバージョン情報を非表示にする  

## プラグイン
- Akismet Anti-Spam  
  ・・・アンチスパム  
  APIキー:7d531b7b26e8

## /wp-content/uploads/.htaccess
- uploadsディレクトリでのphpの実行を制限する  

<br><br>  

# SSLへの対応
## WP管理画面  
- 設定からhttps://”に書き換え

## .htaccess  
- httpへのアクセスをhttpsへリダイレクト  

## プラグイン  
- Login rebuilder  
 ・・・管理画面URL変更  

- Acunetix WP Security  
 ・・・基本的なセキュリティ対策(プラグインの更新日に注意)

<br><br>

# 最適化
## プラグイン  
- EWWW Image Optimizer  
 ・・・画像サイズ(容量)を最適化  

- WP Multibyte Patch  
 ・・・マルチバイト文字の取り扱いに関する不具合の修正と強化  

<br><br>

# サイト拡張  
## プラグイン  
- Custom Post Type UI  
 ・・・カスタム投稿タイプ管理

- Advanced Custom Fields  
 ・・・カスタムフィールド管理

- Contact Form 7  
 ・・・メールフォームを作成する

- WP Total Hacks  
 ・・・管理画面カスタマイズ:管理画面ロゴ、GAアクセス数からユーザー除外(更新日注意)

- TinyMce Advanced  
 ・・・投稿画面エディター拡張  

- Duplicate Post  
 ・・・過去記事複製  

- WP-PageNavi  
 ・・・ページャー  

- Classic Editor  
 ・・・Gutenbergエディタを無効に  

- WP-DBManager  
 ・・・バックアップ  

<br><br>

# 参考リンク  
- [WordPressのセキュリティ対策!自分でできる対策方法まとめ](https://cybersecurity-jp.com/security-measures/22048)

markdown Vue JS

vue
keycloak
https://www.freecodecamp.org/news/vert-x-vuejs-oauth2-in-5-steps-c04ee78475b7/

markdown Linux的命令

readme.md
1. **获取PID进程的内存信息** pmap -x ${pid} | sed 's/\[//;s/\]//' | grep rw | awk '{total[$7]+=$2}END{for(v in total){print total[v],v}}' | sort -n 
2. **查看进程内存** cat /proc/${pid}/status
3. **系统内存信息** cat /proc/meminfo

markdown AERandomChar.md

AERandomChar.md
[![Image from Gyazo](https://i.gyazo.com/922ca999f36656df4619bc449c54cde9.gif)](https://gyazo.com/922ca999f36656df4619bc449c54cde9)

```
sum = "";
for (var i=1; i <= 10; i++) {
	chCode = Math.round(random(97,122));
	sum += String.fromCharCode(chCode);
}
```

10進数ASCII code¥に対応  
https://www.w3schools.com/charsets/ref_html_ascii.asp