Skip to content

Instantly share code, notes, and snippets.

View yyq's full-sized avatar
💭
too busy

Yanqing yyq

💭
too busy
  • 01.AI
  • Hangzhou, China
View GitHub Profile
@yyq
yyq / closeWindow.au3
Created July 2, 2018 08:32
autoit3 script to close some window
Dim $i = 1
While $i < 10000
Local $s = WinWait( "DevPartner Performance and Coverage Analysis Session Control" , "", 0 )
If $s = 0 Then
MsgBox ( 0 , "" , " " )
Else
WinActivate($s)
ControlClick($s, "", "[CLASS:Button; INSTANCE:2]")
;MsgBox ( 0 , "" , " the handle number is " & $s & " the show times "& $i)
EndIf
@yyq
yyq / restart_bluetooth.sh
Created January 15, 2018 08:29 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@yyq
yyq / translate-baidu-api.py
Last active December 4, 2019 07:50
百度翻译api示例代码
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""readme
this script is python 3 only
please config your own appid and secretKey, refer link: http://api.fanyi.baidu.com/api/trans/product/index
usage command: python translate-baidu-api.py word.txt
@yyq
yyq / opt1_template.j2
Created June 1, 2017 07:31 — forked from halberom/opt1_template.j2
ansible - example of template if else
{% if filepath == /var/opt/tomcat_1 %}
{% set tomcat_value == tomcat_1_value %}
{% else %}
{% set tomcat_value == tomcat_2_value %}
{% endif %}
<Server port={{ tomcat_value }} shutdown="SHUTDOWN">
@yyq
yyq / Install.bash
Created May 26, 2017 01:34 — forked from blachniet/Install.bash
Install pip packages in an offline environment
# 1. On a internet-connected device, download the package and its dependencies to a directory
mkdir pip-es-curator
pip install --ignore-installed -d ./pip-es-curator elasticsearch-curator
# 2. Move the directory containing the packages to the offline device
# 3. On the offline device, install the package from the transferred directory
pip install --no-index --find-links ./pip-es-curator elasticsearch-curator
@yyq
yyq / .vimrc.bundles
Last active August 7, 2017 11:32
my vimrc.bundles file
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
" Define bundles via Github repos
Bundle 'christoomey/vim-run-interactive'
Bundle 'Valloric/YouCompleteMe'
Bundle 'croaky/vim-colors-github'
Bundle 'danro/rename.vim'
Bundle 'majutsushi/tagbar'
@yyq
yyq / .vimrc
Last active July 4, 2018 08:41
my vimrc file
" Use Vim settings, rather then Vi settings. This setting must be as early as
" possible, as it has side effects.
set nocompatible
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Highlight current line高亮光标的位置,横着的,竖着的
au WinLeave * set nocursorline nocursorcolumn
@yyq
yyq / vimtutor 1.7
Created January 19, 2017 13:20
vimtutor 1.7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
2. To start Vim from the shell prompt type: vim FILENAME <ENTER>
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes.
@yyq
yyq / gist:b6cda26da8a31b54f68a4bd129caeed4
Last active June 9, 2018 00:17 — forked from Bouke/gist:11261620
Multiple Python installations on OS X #python

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@yyq
yyq / beautiful_idiomatic_python.md
Created November 9, 2016 08:13 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: