Skip to content

Instantly share code, notes, and snippets.

@node
Last active December 28, 2016 09:56
Show Gist options
  • Save node/1390819 to your computer and use it in GitHub Desktop.
Save node/1390819 to your computer and use it in GitHub Desktop.
utility
- 下载整站
> wget -r -p -np -k http://xxoo.com
注释: -r 递归, -p 下载网页关联的其他资源,-np 不搜索上层目录, -k 绝对链接转为相对链接
其他参数:
  ◆-b:后台下载,Wget默认的是把文件下载到当前目录。
  ◆-O:将文件下载到指定的目录中。
  ◆-P:保存文件之前先创建指定名称的目录。
  ◆-t:尝试连接次数,当Wget无法与服务器建立连接时,尝试连接多少次。
  ◆-c:断点续传,如果下载中断,那么连接恢复时会从上次断点开始下载。
- 查看版本相关
> uname -a
> lsb_release -a
> ls /proc/*info
/proc/buddyinfo /proc/cpuinfo /proc/meminfo /proc/slabinfo /proc/zoneinfo
> whoami
> whereis xxoo
> which xxoo
> id
> who
> write xxoo
> wall
更多常用命令: http://linux.chinaitlab.com/special/linuxcom/
jo - json output for shell https://github.com/jpmens/jo
jq is a lightweight and flexible command-line JSON processor. https://stedolan.github.io/jq/
@node
Copy link
Author

node commented Apr 13, 2012

linux c/c++ 库 安装与更新 相关

查看软链接的源

ls -l /usr/lib/libstdc++.so.6

查看版本 和 确认

strings /usr/lib/libstdc++.so.6 | grep GLIBC
strings /lib/libc.so.6 | grep GLIBC

rpm -qa |grep glibc

则,可下载新版本的so文件或者安装编译得到,然后替换现有的软链接。

安装软件时可能遇到的错误信息:
[root@centos-181 glibc-2.9]# curl install.meteor.com | /bin/sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5238 0 5238 0 0 4629 0 --:--:-- 0:00:01 --:--:-- 12418
Detected a RedHat system. Downloading install package.

################################################################## 100.0%

Installing /tmp/meteor-install-nAl9594/meteor-0.3.2-1.i386.rpm
error: Failed dependencies:
libc.so.6(GLIBC_2.6) is needed by meteor-0.3.2-1.i386
libc.so.6(GLIBC_2.7) is needed by meteor-0.3.2-1.i386
libc.so.6(GLIBC_2.9) is needed by meteor-0.3.2-1.i386
libstdc++.so.6(GLIBCXX_3.4.9) is needed by meteor-0.3.2-1.i386
Installation failed.

表明当前 libc/GLIBC 版本与软件需求不符。

@node
Copy link
Author

node commented Apr 24, 2012

Python 相关工具安装

easy_install

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
sh setuptools-0.6c11-py2.7.egg
which easy_install

pip

easy_install pip
which pip

install others

easy_install xxoo
pip instal xxoo

@node
Copy link
Author

node commented Apr 25, 2012

通过命令将临时内容分享到外网 http://dpaste.de/about/

API

#!/usr/bin/env python

import urllib
import urllib2
import sys

def paste_code():
    request = urllib2.Request(
        'http://dpaste.de/api/',
        urllib.urlencode([('content', ''.join(sys.stdin.readlines()))]),
    )
    response = urllib2.urlopen(request)
    print response.read()[1:-1]

if __name__ == '__main__':
    paste_code()

Save this script in /usr/local/bin/dpaste and chmod +x ..filepath.

Usage: cat foo.txt | dpaste

@node
Copy link
Author

node commented May 11, 2012

python 命令行直接处理JSON: curl http://xxxxx.com/xxx.json | python -m json.tool

python 调试 : python -m pdb myscript.py

@node
Copy link
Author

node commented Aug 6, 2015

跟有控制台输入的程序交互

!python.exe

import subprocess
halls = subprocess.Popen([r'D:\Workspace\TexturePacker\bin\TexturePacker.exe'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
result = halls.communicate(input=r'agree')[0]
print halls.returncode
print halls.communicate()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment