分类 【乱七八糟】 下的文章

Windows上修改iTunes的默认备份、下载固件路径

备份的默认目录为系统安装盘的
C:Documents and SettingsUSERNAMEApplication DataApple ComputerMobileSyncBackup,随着时间的累计,无疑会给C盘造成很大的压力。

修改iTunes的默认固件下载路径:

mklink /d "C:\Users\tan9le\AppData\Roaming\Apple Computer\iTunes" e:\Apple\iTunes
为 C:\Users\tan9le\AppData\Roaming\Apple Computer\iTunes <<===>> e:\Apple\iTunes 创建的符号链接

修改iTunes的默认备份路径:

mklink /d "C:\Users\tan9le\AppData\Roaming\Apple Computer\MobileSync" e:\Apple\MobileSync
为 C:\Users\tan9le\AppData\Roaming\Apple Computer\MobileSync <<===>> e:\Apple\MobileSync 创建的符号链接

利用Python建立socket连接后发送假邮件

其实和telnet是一样的,用Python写只是为了方便反复测试

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

__author__ = 'tan9le'
from socket import *
#import ssl

smtp_server = "这里填写smtp服务器地址"
port  = 25
mailfrom = "需要伪装的发信者"
mailto = "真实的接受者"
Subject = "测试假邮件"
msgto = 'To: ' + mailto
msgfrom = 'From: ' + mailfrom
msgsubject = 'Subject: ' + Subject
msgcontent = '假邮件内容'
msgtype='Content-Type: text/plain;charset=UTF-8'

endmsg = '.'



clientSocket = socket(AF_INET, SOCK_STREAM)
#ssl_clientSocket = ssl.wrap_socket(clientSocket)
ssl_clientSocket = clientSocket
ssl_clientSocket.connect((smtp_server, port))
recv = ssl_clientSocket.recv(1024)
print
print recv

if recv[:3] != '220':
    print '220 reply not received from server.'

def sendMessage(message,code=None):
    ssl_clientSocket.send(message + '\r\n')
    if code:
        response = ssl_clientSocket.recv(1024)
        index = len(code)
        print response
        if response[:index] != code:
            print code + 'reply not received from server.'

#握手
sendMessage('HELO Python','250')


#请求认证
sendMessage('AUTH LOGIN','334')

#Base64编码后的用户名
sendMessage('用户全名Base64编码后填入','334')


#Base64编码后的密码
sendMessage('用户密码Base64编码后填入','235')


# 设置发信人
sendMessage('MAIL From: '+mailfrom,'250')

#设置收信人
sendMessage('RCPT To: '+mailto,'250')

#设置邮件内容
sendMessage('DATA','354')


# Send message data.
sendMessage(msgto)
sendMessage(msgfrom)
sendMessage(msgsubject)
sendMessage(msgtype)
sendMessage(msgcontent)


# 设置消息结束
sendMessage(endmsg)


#退出
sendMessage('QUIT','221')

MAC版QQ无法正常使用截图/截屏的解决方案

不提Mac自带的截图软件巴拉巴拉的,已经习惯了从Windows平台就一直使用的快捷键Command+Ctrl+A,不知道从什么时候开始,按下后已经完全没了反应,QQ的偏好设置中的截屏相关设置也无法打开,Google之后得到以下解决方案:

1.在Finder里找到QQ.app的安装路径,比如:/Applications/QQ.app
2.右击,QQ.app,选择显示包内容

3.依次打开QQ.app内路径:Contents/Library/LoginItems
4.双击运行ScreenCapture.app

解决ORA-21561: OID generation failed

在Mac上用Navicat连接Oracle的时候总是提示:ORA-21561: OID generation failed
现象以及搜索结果

Connection Via 10.2.0.3 SQL*Net Fails With Error ORA-21561: OID Generation Failed [ID 559981.1]
Cause
Incorrect /etc/hosts mapping for the client machine or no mapping at all.
Solution
Check the client's /.../hosts file and verify that the local node is correctly identified with a mapping for both the short and fully qualified name of the host.

解决过程
在终端上输入:

hostname

比如得到了tan9le_demo这样的机器名,那么接着就需要编辑/etc/hosts文件,添加:

127.0.0.1 tan9le_demo

保存并推出,再次打开客户端,恢复正常。

Mac OS X下卸载pkg安装的Python

一:删除Python框架:

sudo rm -rf /Library/Frameworks/Python.framework/Versions/x.x

二:删除Python程序:

sudo rm -rf "/Applications/Python x.x"

三:还原/usr/local/bin目录下的Python连接:
确保/usr/bin/python还是系统自带的python(一般不会改),如果被动了,则需要将

/System/Library/Frameworks/Python.framework/Versions/Current/bin/python

做一个软链接至/usr/bin/python

四:删除安装包所定义的环境变量:

vi ~/.bash_profile

删除

PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

五:brew安装python

brew update && brew upgrade --all -y &&  brew prune && brew install python3
sudo brew link python3