2019年4月29日星期一

QT High DPI


PyQt5 and high resolution monitors

High DPI Displays

PyQt 5 and 4k screen

from PyQt5 import QtWidgets, QtCore, QtGui

QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)

QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)

2019年4月20日星期六

设置pypi镜像

修改镜像源在不同操作系统中,修改文件的位置是不同的,
在linux默认的路径是:$HOME/.pip/pip.conf
在windows默认的路径是:%HOME%\pip\pip.ini

默认路径下并不存在配置文件,需要新建,然后在配置文件中写入:
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/

阿里云 速度最快 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

也可以直接使用用-i指令指定镜像源下载,不过这样每次下载库都要加上镜像网址,如下。

pip install -i http://mirrors.aliyun.com/pypi/simple/ pyqt5
pip install -i http://mirrors.aliyun.com/pypi/simple/ pyqt5-tools
pip install -i http://mirrors.aliyun.com/pypi/simple/ qscintilla

pyqt5 与 opencv

《Qt 学习之路 2》目录

用QLabel显示opencv的图片

PyQt5入门以及与OpenCV的简单集成
ps.上面链接里,gridlayout的使用有问题。

pyqt 用opencv在Qlabel上显示图片的一些问题

python3+pyqt5+opencv3简单使用

PyQt 5 开发之旅之 OpenCV 的 GUI 特性

step-by-step-guide-to-building-a-gui

PyQt5番外篇

image-histograms-histograms-equalization-and-histograms-comparison

http://monkeycoding.com/?p=550

opencv打开文件名包含中文的图片竟然会出错:
https://github.com/opencv/opencv/issues/4292
opencv-src-empty-in-function-cvtcolor-error

临时方案

Linux 常用命令


  1.  tar
  2. find
  3. grep

2019年4月18日星期四

Python中在Windows系统中支持中文输入的键盘模拟程序

1、 https://github.com/boppreh/keyboard

      keyboard.write(text, delay=0, restore_state_after=True, exact=None)

2、 https://github.com/pywinauto

       send_keys文档

     pywinauto.keyboard.send_keys( keys,
                                                         pause=0.05,
                                                         with_spaces=False,
                                                         with_tabs=False,
                                                         with_newlines=False,
                                                         turn_off_numlock=True):

3、https://github.com/NyanKiyoshi/SendKeys

       SendKeys("coucou, je support désormais l'unicode :D ♥{ENTER}", pause=.05, with_spaces=True)


4、最简单的C语言例子


2019年4月10日星期三

bash source的作用

what-does-source-do

anaconda安装

https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
ps:清华大学已经关闭anaconda的镜像。

Ananconda更改为国内源

Installing conda packages
conda install package-name=2.3.4

manage-environments

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

定制bash提示符

https://billie66.github.io/TLCL/book/chap14.html

Easy Bash PS1 Generator

osx 更改网卡地址


sudo ifconfig en5  ether  00188b21XXXX


how-to-spoof-your-mac-address-in-mac-os-x

Where is the MAC address of my Thunderbolt to Ethernet adapter?

spoof ethernet MAC address of the wired ethernet interface coming with MacBookPro

Tech 101: Spoofing a MAC Address in macOS High Sierra

brew install fzf

(py36) ~ 15:15$ brew install fzf

==> Downloading https://homebrew.bintray.com/bottles/fzf-0.18.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0f/0f77b9b22f32f76493cdac585106b01502c6583908e0b7b6ea70ab023b5c1c2e?__gda__=exp=1554881332~hmac=45fe35b7742c6b540c73e248922e38076cc493c4d9ef74152801f9ad41f1
######################################################################## 100.0%
==> Pouring fzf-0.18.0.mojave.bottle.tar.gz
==> Caveats
To install useful keybindings and fuzzy completion:
  /usr/local/opt/fzf/install

To use fzf in Vim, add the following line to your .vimrc:
  set rtp+=/usr/local/opt/fzf
==> Summary
🍺  /usr/local/Cellar/fzf/0.18.0: 17 files, 3.6MB
(py36) ~ 15:17$ less .bash_profile
(py36) ~ 15:18$ less .bashrc
(py36) ~ 15:18$ /usr/local/opt/fzf/install
Downloading bin/fzf ...
  - Already exists
  - Checking fzf executable ... 0.18.0
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) y

Generate /Users/lyq/.fzf.bash ... OK
Generate /Users/lyq/.fzf.zsh ... OK

Do you want to update your shell configuration files? ([y]/n) y

Update /Users/lyq/.bashrc:
  - [ -f ~/.fzf.bash ] && source ~/.fzf.bash
    + Added

Update /Users/lyq/.zshrc:
  - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
    + Added

Finished. Restart your shell or reload config file.
   source ~/.bashrc  # bash
   source ~/.zshrc   # zsh

Use uninstall script to remove fzf.

For more information, see: https://github.com/junegunn/fzf


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

(pygis) MacBook-Pro:~ lyq$ brew install fzf
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
mosquitto

==> Downloading https://homebrew.bintray.com/bottles/fzf-0.18.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0f/0f77b9b22f32f76493cdac585106b01502c6583908e0b7b6ea70ab023b5c1c2e?__gda__=exp=1560870550~hmac=97ad307d3d6162b368bb7b2e3149ce2
######################################################################## 100.0%
==> Pouring fzf-0.18.0.mojave.bottle.tar.gz
==> Caveats
To install useful keybindings and fuzzy completion:
  /usr/local/opt/fzf/install

To use fzf in Vim, add the following line to your .vimrc:
  set rtp+=/usr/local/opt/fzf
==> Summary
🍺  /usr/local/Cellar/fzf/0.18.0: 17 files, 3.6MB
==> `brew cleanup` has not been run in 30 days, running now...
(pygis) MacBook-Pro:~ lyq$ /usr/local/opt/fzf/install 
Downloading bin/fzf ...
  - Already exists
  - Checking fzf executable ... 0.18.0
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) y

Generate /Users/lyq/.fzf.bash ... OK
Generate /Users/lyq/.fzf.zsh ... OK

Do you want to update your shell configuration files? ([y]/n) y

Update /Users/lyq/.bashrc:
  - [ -f ~/.fzf.bash ] && source ~/.fzf.bash
    + Added

Update /Users/lyq/.zshrc:
  - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
    + Added

Finished. Restart your shell or reload config file.
   source ~/.bashrc  # bash
   source ~/.zshrc   # zsh

Use uninstall script to remove fzf.

For more information, see: https://github.com/junegunn/fzf

-------------------------------------------------------------------
lyq@mbp ~ % brew install  fzf
==> Downloading https://ghcr.io/v2/homebrew/core/fzf/manifests/0.29.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fzf/blobs/sha256:dadc361593396ced96c13d3695019a302d124e6cfe8ab6ffe65ba7877025a706
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:dadc361593396ced96c13d3695019a302d124e6cfe8ab6ffe65ba7877025a706?se=2022-02-10T11%3A20%3A00Z&sig=XV5qDWMVAN0nOXIfjnfF4X
######################################################################## 100.0%
==> Pouring fzf--0.29.0.catalina.bottle.tar.gz
==> Caveats
To install useful keybindings and fuzzy completion:
  /usr/local/opt/fzf/install

To use fzf in Vim, add the following line to your .vimrc:
  set rtp+=/usr/local/opt/fzf
==> Summary
🍺  /usr/local/Cellar/fzf/0.29.0: 17 files, 2.6MB
==> Running `brew cleanup fzf`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).