To find ports status on windows, there is a default Windows GUI - Resource Monitor
or you could use netstat
via command prompt.
Transact-SQL cheat sheet
1 | -- Get current datetime |
Linux Remote Desktop Viewer to Windows error connecting to host
Today When I connect to Windows through Remote Desktop Viewer
got error connecting to host
prompt.
After searching the solution is to remove the server I’m having issue in $home/.freerdp/known_hosts
and reconnecting again.
1 | [sing@study ~]$ vi ~/.freerdp/known_hosts |
HttpClient PostAsync/GetAsync JSON Example
PostAsync
1 | static readonly HttpClient Client = new HttpClient(); |
GetAsync
1 | static readonly HttpClient Client = new HttpClient(); |
Abbreviation in Software Engineering
This sheet is to record abbreviation in my daily work as a software engineer.
Abbreviation | Full name | Explain |
---|---|---|
CDC | Change data capture | Use to sync one db data change to another db |
MPLS | Multi-Protocol Label Switching | Link site to site network like both in same network |
IDC | Internet Data Center | Buildings where we put servers |
REST | REpresentational State Transfer | Architectural style defines a set of constraints on HTTP |
CNAME | Canonical Name | A DNS record to point a/b/c domain to d domain so you don’t have to add A record in a/b/c |
ACL | Access Control List | An ACL specifies which users or system processes are granted access to objects |
Jenkins migration
- Copy existing jenkins folder, exclude
workspace
- Modify jenkins port in
Jenkins.xml
, default8080
- Modify AD Domain and rename an account to yours in
config.xml
Create / Start Jenkins service in cmd with administrator mode:
1
2sc create <jenkins-service-name> <path/to/jenkins.exe>
sc start <jenkins-service-name>View migrated jenkins in your browser with port specify above, default http://localhost:8080
How Redux work ?
If you want to understand how Redux work, createStore(reducer)
is the core function you should know and try to implement yourself. Here is a basic example of Redux, don’t worry I will break it down later :
ReactJS performance tuning tips
- Use
React.PureComponent
, it implementshouldComponentUpdate()
by shallow compare prop and state, it is powerful with Immutable.js. - Use Chrome extension and checked
highlight updates
in dev tool to find any unnecessary updates. - Use React-virtualized for render huge list in small chunk at a time.
Use
Production build
, for example with webpack you need following config:1
2
3
4new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin()
Install ELK on linux
Before Start
Make sure the server has internet access or you will have to download and upload packages manually. If the server doesn’t, I recommend CCProxy to grant temporary internet access.
Install JDK
1 | wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.rpm |
Elasticsearch
Download and install
1
2wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.rpm
rpm -ivh elasticsearch-6.2.3.rpmStart service
1
2
3
4
5
6
7# Auto start elasticsearch when computer start
systemctl daemon-reload
systemctl enable elasticsearch.service
# start service
systemctl start elasticsearch
systemctl status elasticsearchVerify Elastic search is running
1
2
3
4curl http://localhost:9200
# If not working, you could try reboot
reboot -rYou could check log files under
/var/log/elasticsearch/
Reference : https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html
Kibana
Download and install
1
2wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.3-x86_64.rpm
rpm -ivh kibana-6.2.3-x86_64.rpmModify kibana config
1
2
3
4
5vi /etc/kibana/kibana.yml
# Kibana port
server.port: 5601
# Bind to all ip address
server.host: "0.0.0.0"Start service
1
2
3
4systemctl daemon-reload
systemctl enable kibana.service
systemctl start kibana
systemctl status kibanaVerify installation
1
curl localhost:5601
You can check log file under
/var/log/kibana/
Reference : https://www.elastic.co/guide/en/kibana/current/rpm.html
Logstash
Download and install
1
2wget https://artifacts.elastic.co/downloads/logstash/logstash-6.2.3.rpm
rpm -ivh logstash-6.2.3.rpmModify
logstash.yml
to enable auto reload config1
2
3vi /etc/logstash/logstash.yml
config.reload.automatic: true
config.reload.interval: 3sAdd first logstash config
1
2
3
4
5
6
7
8
9
10
11
12cd /etc/logstash/conf.d/
cat > default.conf
input {
beats {
port => 5044
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
}
}Start service
1
2
3
4systemctl daemon-reload
systemctl enable logstash.service
systemctl start logstash
systemctl status logstashVerify installation
1
telnet 127.0.0.1 5044
You could check log file under
/var/log/logstash/
Reference : https://www.elastic.co/guide/en/logstash/current/installing-logstash.html
Grant server internet access by ccproxy in linux
It is painful to install something on server without internet access, you need to download package manually and upload it. CCProxy could help your server use your computer internet temporarily, here is the steps :
- Download CCProxy
- Go through CCProxy setup wizard
- Open
CCProxy > Options
to check your port and your ip address. - Login to your linux server, use your CCProxy as proxy server, then you can
curl
to check if it works.1
2
3
4
5
6
7
8
9
10
11
12
13
14[root@linux ~]# export http_proxy=http://172.16.49.170:808/
[root@linux ~]# export https_proxy=http://172.16.49.170:808/
[root@linux ~]# curl http://www.google.com
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/1.1</code> was not found on this server. <ins>That’s all we know.</ins>