0%

代码

1
2
3
4
5
6
7
- (CGRect)frame {
return CGRectMake(self.frame.origin.x,self.frame.origin.y,self.frame.size.width,self.frame.size.height);
}

- (CGRect)bounds{
return CGRectMake(0,0,self.frame.size.width,self.frame.size.height);
}
阅读全文 »

配置命令

显示/隐藏 隐藏文件

  • 显示:defaults write com.apple.finder AppleShowAllFiles -bool true
  • 隐藏:defaults write com.apple.finder AppleShowAllFiles -bool false

这个没什么好说的= =

开启/关闭 HIDPI

  • 开启:sudo defaults write /Library/Preferences/com.Apple.windowserver DisplayResolutionEnabled -bool true
  • 关闭: sudo defaults delete /Library/Preferences/com.Apple.windowserver DisplayResolutionEnabled
阅读全文 »

准备

复制以下内容到编辑器并另存为patch-edid.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/ruby

require 'base64'

data=`ioreg -l -w0 -d0 -r -c AppleDisplay`

edid_hex=data.match(/IODisplayEDID.*?<([a-z0-9]+)>/i)[1]
vendorid=data.match(/DisplayVendorID.*?([0-9]+)/i)[1].to_i
productid=data.match(/DisplayProductID.*?([0-9]+)/i)[1].to_i

puts "found display: vendorid #{vendorid}, productid #{productid}, EDID:\n#{edid_hex}"

bytes=edid_hex.scan(/../).map{|x|Integer("0x#{x}")}.flatten

puts "Setting color support to RGB 4:4:4 only"
bytes[24] &= ~(0b11000)

puts "Number of extension blocks: #{bytes[126]}"
puts "removing extension block"
bytes = bytes[0..127]
bytes[126] = 0

bytes[127] = (0x100-(bytes[0..126].reduce(:+) % 256)) % 256
puts
puts "Recalculated checksum: 0x%x" % bytes[127]
puts "new EDID:\n#{bytes.map{|b|"%02X"%b}.join}"

Dir.mkdir("DisplayVendorID-%x" % vendorid) rescue nil
f = File.open("DisplayVendorID-%x/DisplayProductID-%x" % [vendorid, productid], 'w')
f.write '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">'
f.write "
<dict>
<key>DisplayProductName</key>
<string>Display with forced RGB mode (EDID override)</string>
<key>IODisplayEDID</key>
<data>#{Base64.encode64(bytes.pack('C*'))}</data>
<key>DisplayVendorID</key>
<integer>#{vendorid}</integer>
<key>DisplayProductID</key>
<integer>#{productid}</integer>
</dict>
</plist>"
f.close
阅读全文 »

需要实现的效果

  1. 普通状态
  2. 点击高亮状态
1
2
3
4
5
#import <UIKit/UIKit.h>

@interface OButton : UIButton

@end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#import "OButton.h"

@implementation OButton

- (id)initWithCoder:(NSCoder *)aDecoder {
if (self == [super initWithCoder:aDecoder]) {
self.layer.cornerRadius = 5.; //按钮圆角
if (self.isEnabled) {
self.backgroundColor = [UIColor blackColor]; //普通状态为黑色
}else {
self.backgroundColor = [UIColor lightGrayColor]; //禁用状态为灰色
}
}
return self;
}

//重写Enable状态改变的方法
- (void)setEnabled:(BOOL)enabled {
[super setEnabled:enabled];
if (enabled) {
self.backgroundColor = [UIColor blackColor];
}else {
self.backgroundColor = [UIColor lightGrayColor];
}
}

//重写点击高亮状态改变的方法
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
if (highlighted) {
self.backgroundColor = [UIColor redColor];
}else {
self.backgroundColor = [UIColor blackColor];
}
}

@end
阅读全文 »

普通APP在MacOS上要用pkg包安装的都是耍流氓,个人觉得= =
安装pkg的APP之后要怎么卸载呢,可以用到pkgutil这一命令

pkgutil

执行命令pkgutil --help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Usage: pkgutil [OPTIONS] [COMMANDS] ...

Options:
--help Show this usage guide
--verbose, -v Show contextual information and format for easy reading
--force, -f Perform all operations without asking for confirmation
--volume PATH Perform all operations on the specified volume
--edit-pkg PKGID Adjust properties of package PKGID using --learn PATH
--only-files List only files (not directories) in --files listing
--only-dirs List only directories (not files) in --files listing
--regexp Try all PKGID arguments as regular expressions

Receipt Database Commands:
--pkgs, --packages List all currently installed package IDs on --volume
--pkgs-plist List all package IDs on --volume in plist format
--pkgs=REGEXP List package IDs on --volume that match REGEXP
--groups List all GROUPIDs on --volume
--groups-plist List all GROUPIDs on --volume in plist format
--group-pkgs GROUPID List all PKGIDs in GROUPID
--files PKGID List files installed by the specified package
--lsbom PKGID List files in the same format as 'lsbom -s'
--pkg-groups PKGID List all GROUPIDs that PKGID is a member of
--export-plist PKGID Print all info about PKGID in plist format
--verify PKGID Verify file permissions of the specified package
--repair PKGID Repair file permissions of the specified package
--pkg-info PKGID Show metadata about PKGID
--pkg-info-plist PKGID Show metadata about PKGID in plist format
--file-info PATH Show metadata known about PATH
--file-info-plist PATH Show metadata known about PATH in plist format
--forget PKGID Discard receipt data for the specified package
--learn PATH Update --edit-pkg PKGID with actual metadata from PATH

File Commands:
--expand PKG DIR Expand the flat package PKG to DIR
--flatten DIR PKG Flatten the files at DIR as PKG
--bom PATH Extract any Bom files from the pkg at PATH into /tmp
--payload-files PATH List the paths archived within the (m)pkg at PATH
阅读全文 »

准备工作

  1. 8G或以上U盘||移动硬盘一个
  2. 原版Mac OS镜像一个

制作

  1. 打开Mac OS下的磁盘工具,把制作盘抹掉为Mac OS扩展(日志式)

  2. 打开终端运行以下命令:

    1
    sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolumes --applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction
阅读全文 »

刚装好的Win8.1,从XP系统远程过去提示”远程计算机需要网络级别身份验证”,网上搜索了下,几乎所有都是修改注册表的方法,其实不用修改注册表也可以完美解决

  1. 按组合键Win+X再按下R键,打开gpedit.msc
  2. 依次找到计算机配置->管理模板->Windows组件->远程桌面服务->远程桌面会话主机->安全
  3. 要求使用网络级别的身份验证对远程连接的用户进行身份验证禁用
  4. 远程正常

弄了一下GitHub Pages的域名绑定,总算弄好了。

A记录绑定顶级域名

  1. 先执行命令dig yourname.github.io +nostats +nocomments +nocmd找到github.map.fastly.net.所对应的IP地址
  2. 进入域名解析管理,添加一条A记录解析
  3. 主机记录为@
  4. 记录值为得到的IP地址
  5. 保存静候生效

解析生效之后访问顶级域名成功,但是访问www的二级域名却不能访问了,因此要再做一个CNAME解析

阅读全文 »

Centos 7与老版本有大差别,所以旧的配置VPN方法可能不适用,采用新的方法来配置VPN.

准备

添加epel源

命令行执行 yum install epel-release

命令行执行 yum makecache

安装组件

运行命令 yum install ppp iptables pptpd 安装组件

运行命令 /etc/pptpd.conf 找到localip,去掉下面字段前面的#,然后保存退出

1
2
localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245
阅读全文 »