Skip to content

Instantly share code, notes, and snippets.

View iguoli's full-sized avatar
🤣
laugh cry

Guo Li iguoli

🤣
laugh cry
View GitHub Profile
@iguoli
iguoli / git_config.md
Last active September 13, 2017 06:12
git的一些配置命令

保存用户名和邮箱

git config --global user.name ***
git config --global user.email ***

下面命令在使用https方式传输git文件时缓存用户名及密码,避免每次git push都要输出一次

git config --global credential.helper 'cache --timeout=86400'

下面命令在使用https方式传输git文件时通过代理来连接

@iguoli
iguoli / cmd-syntax.md
Last active September 13, 2017 06:18
命令行语法
@iguoli
iguoli / X11_Forwarding.md
Last active September 13, 2017 07:11
X11 Forwarding

编辑ssh服务器端sshd_config文件

sudo vim /etc/ssh/sshd_config
X11Forwarding yes

在ssh客户端使用-X选项开启X11转发

ssh -X oracle@ssh_server

如果出现Warning: untrusted X11 forwarding setup failed: xauth key data not generated,可以使用

@iguoli
iguoli / wine.md
Last active September 16, 2017 13:37
Linux使用WINE运行Windows应用

官网下载WINE并安装

WINE官网

让WINE使用系统中文字体

创建wine-font.reg文件,并添加以下内容

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="wqy-microhei.ttc"
@iguoli
iguoli / python_underscore.md
Last active October 28, 2017 08:26
Python下划线命名

Python中的下划线命名

  • __name__
    双下划线开头双下划线结尾的是一些 Python 的“魔术”对象,如类成员的__init____del____add____getitem__等,以及全局的__file____name__等。Python官方推荐永远不要将这样的命名方式应用于自己的变量或函数,而是按照文档说明来使用。

  • __name
    名称(具体为一个方法名)前双下划线(__)的用法并不是一种惯例,对解释器来说它有特定的意义。Python中的这种用法是为了避免与子类定义的名称冲突。Python文档指出,“__spam”这种形式(至少两个前导下划线,最多一个后续下划线)的任何标识符将会被“_classname__spam”这种形式原文取代,在这里“classname”是去掉前导下划线的当前类名。例如下面的例子:

>>> class A(object): 
... def _internal_use(self): 
... pass 
@iguoli
iguoli / ubuntu_depends.md
Last active October 28, 2017 13:27
Ubuntu下查看某个包的依赖关系

Ubuntu下查看某个包的依赖关系

#查看python3-pip依赖哪些包
apt-cache depends python3-pip

#查看python3-setuptools被哪些包依赖
apt-cache rdepends python3-setuptools
@iguoli
iguoli / python_lambda.md
Last active November 1, 2017 14:27
Python中的列表推导式、lambda表达式和闭包

List Comprehension列表推导式

>>> [(x,y) for x in range(4) if x>1 for y in range(6) if y>3]
[(2, 4), (2, 5), (3, 4), (3, 5)]

以上列表推导式等价于

l = []                                                                                                                  
for x in range(4):
 if(x > 1):
@iguoli
iguoli / update-alternatives.md
Created November 28, 2017 03:29
Linux下用update-alternatives命令来设置系统默认命令

Linux下用update-alternatives命令来设置系统默认命令

update-alternatives --help
update-alternatives --display vi
update-alternatives --config vi
@iguoli
iguoli / python_snippet.md
Last active November 30, 2017 12:33
Python常用功能代码段

从命令行读取多个文件名,支持'*'作为通配符

import sys
from glob import glob

if len(sys.argv) >= 2:
    filelist = []
    for f in sys.argv[1:]:
        filelist.extend(glob(f))
 print(filelist)
@iguoli
iguoli / Win10_Synaptics.md
Last active November 30, 2017 15:26
WIN10, Synaptics, 2FingerTapAction

Win10系统触摸板双指操作设置

  1. 在运行窗口打开regedit
  2. 定位到HKEY_CURRENT_USER\SOFTWARE\Synaptics
  3. 搜索2FingerTapAction
  4. 将其值修改为2
  5. 保存然后重启系统