2020年9月29日星期二

SpatiaLite sql

 SpatiaLite 3.0 SQL functions reference list

ST_GeometryN 

list the tables in a SQLite database file 

 SpatiaLite Cookbook

SpatiaLite database tables management with QGis 2.8 

https://github.com/qgis/QGIS/issues/37790 

SELECT * FROM sqlite_master WHERE type='table';


SELECT id, st_astext(st_centroid(st_geometryn(P.geom,1))) FROM '桥墩位置2020-09-29' as P   WHERE id < 10;


--下面的语句没有执行成功
UPDATE '桥墩位置2020-09-29' SET centroid_geom = st_centroid(st_geometryn(geom,1));

check if port is in use on Linux

check if port is in use on Linux 

sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here

家庭宽带的8080端口不能从外网访问

 家庭宽带的8080端口不能从外网访问

2020年9月27日星期日

Let's Encrypt泛域名SSL证书

 Let's Encrypt泛域名SSL证书

使用acme.sh 手动生成证书(DNS手动模式) 

SSL中间证书的坑

根证书、服务器证书、用户证书的区别

域名.key是秘钥;

a.cer存储的是CA证书,

域名.cer是域名证书,

fullchain.cer是前两者的拼接;

域名.csr是证书签名请求。

----------------------------------------------------

Let’s Encrypt颁发的HTTPS证书一般包括以下几个文件:

cert.key(PEM格式):私钥文件
cert.cer(PEM格式):证书文件
fullchain.cer(PEM格式):包含证书和中间证书

-----------------------------------------------------

PEM
适用于Apache、Nginx、Candy Server等Web服务器
常见的文件后缀为.pem、.crt、.cer、.key
可以存放证书或私钥,或者两者都包含
.key后缀一般只用于证书私钥文件
PFX
适用于IIS等Web服务器
常见的文件后缀为.pfx、.p12
同时包含证书和私钥,且一般有密码保护
JKS
适用于Tomcat、Weblogic、JBoss、Jetty等Web服务器
常见的文件后缀为.jks

2020年9月24日星期四

anaconda condarc socks5代理

 channels:
- defaults
# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True
proxy_servers:
    http: socks5://127.0.0.1:1080
    https: socks5://127.0.0.1:1080
ssl_verify: False

2020年9月10日星期四

miniconda3

2022年1月11日更新
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /home/aka/miniconda3/condabin/conda
no change     /home/aka/miniconda3/bin/conda
no change     /home/aka/miniconda3/bin/conda-env
no change     /home/aka/miniconda3/bin/activate
no change     /home/aka/miniconda3/bin/deactivate
no change     /home/aka/miniconda3/etc/profile.d/conda.sh
no change     /home/aka/miniconda3/etc/fish/conf.d/conda.fish
no change     /home/aka/miniconda3/shell/condabin/Conda.psm1
no change     /home/aka/miniconda3/shell/condabin/conda-hook.ps1
no change     /home/aka/miniconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /home/aka/miniconda3/etc/profile.d/conda.csh
modified      /home/aka/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Miniconda3!

---------------------------------------------------------------------------------

You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:

eval "$(/home/lyq/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)"

To install conda's shell functions for easier access, first activate, then:

conda init

If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Miniconda3!

2020年9月6日星期日

perform-commands-over-ssh-with-python

perform-commands-over-ssh-with-python

>>> import  subprocess
>>> subprocess.Popen("ssh -p {port} {user}@{host} {cmd}".format(port='2223', user='admin', host='192.168.1.1', cmd='nvram get wan0_realip_ip'), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
(b'192.36.222.246\n', b'')
 
 
或者使用
subprocess.check_output(  )

2020年9月3日星期四

openpyxl的复制worksheet

目前只能在同一个workbook中复制,不能在workbook之间复制。

issues171

bash

BASH Programming - Introduction HOW-TO

bash-redirect-stderr-stdout/

for i in $(seq -f "%05g" 10 15)
do
  echo $i
done
 
for i in $(seq -f "%04g" 2 36)
do
    url="http://www.ttt.com/img/$i.jpg"
    echo $url
    wget $url
done
 
 
for i in $(seq 30); do echo "http://www.example.com/page$i.html" ; done | wget -i -