简单测试一下图床

不要误解,并没有使用 Imgur 或者七牛,只是新建了个 img 文件夹

Just like Cheng Zhao said, quote:

“其实网上的大部分的教程都非高手写成,而是新手在学习过程中的总结。有大量原创入门教程的知名博客,并不意味着博主是一个绝世高手,而是说明他是一个孜孜不倦的学习者。”

I am writing this as a study note for myself and if it could help you in any way, I am glad.

This note will be structured similar to the Lynda online course Swift Programming Language First Look with Simon Allardice.

Introduction

Swift is a new language. I am not going to say more about its history or differences between Swift and other languages. Please Google. Or hey Siri.

Using Xcode

As a swiftly (ha…) updating language, Swift changes a lot (I guess) since its publication. You should always use the updated Xcode for programming. (Please ignore my naive advice if you are coding for production.)

Core Syntax

The structure of Swift

Go and find out yourself.

Writing Swift in playgrounds

Try it, please.

Declaring variables

1
var myVariable = 1

Creating constants

1
let myVariable = "this lable"

Printing values

1
print myVarialbe

Writing if statements

1
2
3
4
5
if score > 50 {
some codes
} else {
some other codes
}

Using the switch statement

1
2
3
4
5
6
7
8
9
10
let vegetable = "apple"

switch vegetable {
case "apple":
let comment = "Good."
case "pine":
let comment = "OK."
default:
let comment = "whats that?"
}

Creating loops in Swift

1
2
3
for score in scores {
some codes
}

Defining functions

1
2
3
func funcName (name : String) {
some codes
}

Creating and using arrays

1
var list = ["a","b"]

Using dictionaries

1
var member : [String : String] = ["Wang":"Shanghai", "Xia":"Guangzhou"]

Understanding tuples

1
(Int, Int)

Creating optional variables

1
2
3
(Int, Int)?
(Int?,Int?)
# Please note that they are different.

Defining and using enumerations

1
2
3
4
5
6
enum CompassPoint {
case North
case South
case East
case West
}

Writing closures

1
2
3
{
some lines of code
}

Creating classes and instantiating objects

1
2
3
4
5
6
7
8
9
10
11
class videoMode {
var resolution = Resolution()
var interlaced = false
var frameRate = 0.0
var name: String?
}

struct Resolution {
var width = 0
var height = 0
}

Conclusion

Thats it. Please correct me if any.

Me again, writing about this basic how to install MacDown, a simple tool for markdown.

I will not go through which is better for Mou and MacDown, you could choose Mou as well. OK.

First, install Homebrew

1
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Second, install Homebrew Cask

1
$ brew install caskroom/cask/brew-cask

Last but not least, install MacDown

1
$ brew cask install macdown

The UI of Macdown is beautiful and I hope you enjoy it as I did.

简单折腾了下,稍作记录,理论上类似的办法也适用于其他视频网站。鉴于是断人财路的手法,因此请低调使用。务必支持正版,如果是网站重度用户,建议购买会员。

方案一

此前一直使用的是:妈妈再也不用担心我的macbook发烫了计划2.0Beta
只需优雅地在《我的收藏》里放一个书签,然后打开 Youku 具体播放页面,Command + 数字就可以跳过广告把视频正文内容直接唤出。小缺点是,每次必须动手,而且手必须要快,因为如果广告已经载入,就停不下来。

稍微麻烦但一劳永逸的方案二

改 Hosts

1
$ sudo nano /etc/hosts/

复制粘贴以下内容并保存退出:
127.0.0.1 atm.youku.com
127.0.0.1 fvid.atm.youku.com
127.0.0.1 html.atm.youku.com
127.0.0.1 valb.atm.youku.com
127.0.0.1 valf.atm.youku.com
127.0.0.1 valo.atm.youku.com
127.0.0.1 valp.atm.youku.com
127.0.0.1 lstat.youku.com
127.0.0.1 speed.lstat.youku.com
127.0.0.1 urchin.lstat.youku.com
127.0.0.1 stat.youku.com
127.0.0.1 static.lstat.youku.com
127.0.0.1 valc.atm.youku.com
127.0.0.1 vid.atm.youku.com
127.0.0.1 walp.atm.youku.com

清空 Flash 缓存 (Safari 开发选项,清空缓存)

选择 “在允许新站点在此计算机上保存信息之前询问我”,然后找到
/Users/yourName/Library/Preferences/Macromedia/Flash Player/#SharedObjects/randomCode/static.youku.com 文件夹,新建一个任意文件(e.g. txt 文本文件)重命名为 static.youku.com (注意后缀是 .com 而不是 .txt),将它放在这个目录下

重启 Safari

打开 Youku 测试,应该已经跳过了广告。
如果,我是说如果(不可能)出现“45秒”所谓黑屏警告,请在视频上右键进“设置”(注意不是“全局设置”),把 static.youku.com 本地缓存设为 100 KB

嗯就是这样。

To Do:
排版有点问题

这个文件作者说他会删掉因此自己备份SSEncrypt.module

以下是 Surge 配置文件模板,等 iOS 版上架了测试

[General]
loglevel = notify

[Proxy]
Proxy = custom, 1.2.3.4, 443, rc4-md5, password, http://surge.run/SSEncrypt.module

[Rule]
DOMAIN-KEYWORD,google,Proxy,tcp-force
DOMAIN-KEYWORD,facebook,Proxy,tcp-force
DOMAIN-KEYWORD,youtube,Proxy,tcp-force
DOMAIN-KEYWORD,twitter,Proxy,tcp-force
DOMAIN-KEYWORD,instagram,Proxy,tcp-force
DOMAIN-KEYWORD,gmail,Proxy,tcp-force
DOMAIN-KEYWORD,blogspot,Proxy

# Remove these lines below if you don't have trouble accessing Apple resources
DOMAIN-SUFFIX,ls.apple.com,DIRECT
DOMAIN-SUFFIX,apple.com,Proxy
DOMAIN-SUFFIX,mzstatic.com,Proxy
DOMAIN-SUFFIX,itunes.com,Proxy
DOMAIN-SUFFIX,icloud.com,Proxy

DOMAIN-SUFFIX,amazonaws.com,Proxy
DOMAIN-SUFFIX,android.com,Proxy
DOMAIN-SUFFIX,angularjs.org,Proxy
DOMAIN-SUFFIX,appspot.com,Proxy
DOMAIN-SUFFIX,akamaihd.net,Proxy
DOMAIN-SUFFIX,amazon.com,Proxy
DOMAIN-SUFFIX,bit.ly,Proxy
DOMAIN-SUFFIX,bitbucket.org,Proxy
DOMAIN-SUFFIX,blog.com,Proxy
DOMAIN-SUFFIX,blogcdn.com,Proxy
DOMAIN-SUFFIX,blogger.com,Proxy
DOMAIN-SUFFIX,blogsmithmedia.com,Proxy
DOMAIN-SUFFIX,box.net,Proxy
DOMAIN-SUFFIX,bloomberg.com,Proxy
DOMAIN-SUFFIX,chromium.org,Proxy
DOMAIN-SUFFIX,cl.ly,Proxy
DOMAIN-SUFFIX,cloudfront.net,Proxy
DOMAIN-SUFFIX,cloudflare.com,Proxy
DOMAIN-SUFFIX,cocoapods.org,Proxy
DOMAIN-SUFFIX,crashlytics.com,Proxy
DOMAIN-SUFFIX,dribbble.com,Proxy
DOMAIN-SUFFIX,dropbox.com,Proxy
DOMAIN-SUFFIX,dropboxstatic.com,Proxy
DOMAIN-SUFFIX,dropboxusercontent.com,Proxy
DOMAIN-SUFFIX,docker.com,Proxy
DOMAIN-SUFFIX,duckduckgo.com,Proxy
DOMAIN-SUFFIX,digicert.com,Proxy
DOMAIN-SUFFIX,dnsimple.com,Proxy
DOMAIN-SUFFIX,edgecastcdn.net,Proxy
DOMAIN-SUFFIX,engadget.com,Proxy
DOMAIN-SUFFIX,eurekavpt.com,Proxy
DOMAIN-SUFFIX,fb.me,Proxy
DOMAIN-SUFFIX,fbcdn.net,Proxy
DOMAIN-SUFFIX,fc2.com,Proxy
DOMAIN-SUFFIX,feedburner.com,Proxy
DOMAIN-SUFFIX,fabric.io,Proxy
DOMAIN-SUFFIX,flickr.com,Proxy
DOMAIN-SUFFIX,fastly.net,Proxy
DOMAIN-SUFFIX,ggpht.com,Proxy
DOMAIN-SUFFIX,github.com,Proxy
DOMAIN-SUFFIX,github.io,Proxy
DOMAIN-SUFFIX,githubusercontent.com,Proxy
DOMAIN-SUFFIX,golang.org,Proxy
DOMAIN-SUFFIX,goo.gl,Proxy
DOMAIN-SUFFIX,gstatic.com,Proxy
DOMAIN-SUFFIX,godaddy.com,Proxy
DOMAIN-SUFFIX,gravatar.com,Proxy
DOMAIN-SUFFIX,imageshack.us,Proxy
DOMAIN-SUFFIX,imgur.com,Proxy
DOMAIN-SUFFIX,jshint.com,Proxy
DOMAIN-SUFFIX,ift.tt,Proxy
DOMAIN-SUFFIX,j.mp,Proxy
DOMAIN-SUFFIX,kat.cr,Proxy
DOMAIN-SUFFIX,linode.com,Proxy
DOMAIN-SUFFIX,linkedin.com,Proxy
DOMAIN-SUFFIX,licdn.com,Proxy
DOMAIN-SUFFIX,lithium.com,Proxy
DOMAIN-SUFFIX,megaupload.com,Proxy
DOMAIN-SUFFIX,mobile01.com,Proxy
DOMAIN-SUFFIX,modmyi.com,Proxy
DOMAIN-SUFFIX,nytimes.com,Proxy
DOMAIN-SUFFIX,name.com,Proxy
DOMAIN-SUFFIX,openvpn.net,Proxy
DOMAIN-SUFFIX,openwrt.org,Proxy
DOMAIN-SUFFIX,ow.ly,Proxy
DOMAIN-SUFFIX,pinboard.in,Proxy
DOMAIN-SUFFIX,ssl-images-amazon.com,Proxy
DOMAIN-SUFFIX,sstatic.net,Proxy
DOMAIN-SUFFIX,stackoverflow.com,Proxy
DOMAIN-SUFFIX,staticflickr.com,Proxy
DOMAIN-SUFFIX,squarespace.com,Proxy
DOMAIN-SUFFIX,symcd.com,Proxy
DOMAIN-SUFFIX,symcb.com,Proxy
DOMAIN-SUFFIX,symauth.com,Proxy
DOMAIN-SUFFIX,ubnt.com,Proxy
DOMAIN-SUFFIX,t.co,Proxy
DOMAIN-SUFFIX,thepiratebay.org,Proxy
DOMAIN-SUFFIX,tumblr.com,Proxy
DOMAIN-SUFFIX,twimg.com,Proxy
DOMAIN-SUFFIX,twitch.tv,Proxy
DOMAIN-SUFFIX,twitter.com,Proxy
DOMAIN-SUFFIX,wikipedia.com,Proxy
DOMAIN-SUFFIX,wikipedia.org,Proxy
DOMAIN-SUFFIX,wikimedia.org,Proxy
DOMAIN-SUFFIX,wordpress.com,Proxy
DOMAIN-SUFFIX,wsj.com,Proxy
DOMAIN-SUFFIX,wsj.net,Proxy
DOMAIN-SUFFIX,wp.com,Proxy
DOMAIN-SUFFIX,vimeo.com,Proxy
DOMAIN-SUFFIX,youtu.be,Proxy
DOMAIN-SUFFIX,ytimg.com,Proxy

// Telegram
IP-CIDR,91.108.56.0/22,Proxy,tcp-force
IP-CIDR,91.108.4.0/22,Proxy,tcp-force
IP-CIDR,109.239.140.0/24,Proxy,tcp-force
IP-CIDR,149.154.160.0/20,Proxy,tcp-force

// LAN
IP-CIDR,192.168.0.0/16,DIRECT
IP-CIDR,10.0.0.0/8,DIRECT
IP-CIDR,172.16.0.0/12,DIRECT
IP-CIDR,127.0.0.0/8,DIRECT

GEOIP,CN,DIRECT
FINAL,Proxy```

有個女的是個殺人犯
她殺了她丈夫
因為她丈夫總是打她
她就想把她丈夫殺了
她呀磨刀,她不斷的磨刀
磨好了刀,她就把她丈夫殺了

可是妳知道嗎?殺人容易毀屍難
她想了許多辦法,都不行
那個女的把她丈夫的屍首剁成
壹塊壹塊的
扔進了泡菜缸裏,就放在自己的床底下
她想這下可好了,那時候她兒子才兩歲
傻傻的還不會說話呢

那個女人的丈夫死了以後,日子過得很平淡
女人跟別人說是她丈夫失蹤了
村裏的人開始不太相信
日子壹長,許多人就相信了
日子再壹長,已經沒有人再
提起失蹤這件事

好多年過去了,連女人自己都不太記得了
可是,有壹天,她男人的妹妹
從很遠的外鄉來她家做客
吃飯的時候,小姑子問她
我哥哥到底哪兒去了?
她說:“已經失蹤很久了,大家都知道”
她說得很心安,因為她以為
再沒有壹個人會知道事實真相
當時,2歲的兒子雖然在場
但壹定是不記事的,何況後來又壹直是個啞巴
可是飯還沒吃完
她的兒子突然開口講話了

他問:媽媽,泡菜缸裏,爸爸的肉可以吃了嗎?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
以上摘抄的电影台词
事情大概是这样
5年前在 GAE 上搭了个 Micolog,晾着都快忘了
今年 8 月 GAE 彻底从 Master/Slave 转投 HRD,博客就黄了
我后知后觉,这个时候连 Migration 的选项都没有了
即使有这个选项…… 就凭我对 Python 的了解 _(:з」∠)_
要把 Python2.5 改 Python2.7,webapp 改 webapp2
Micolog 的作者已放弃维护,Demo 博客同样废了
https://github.com/xuming/micolog
据说 Hexo 可以直接艾特 Github 成员,我就不试了
损失了一个老博客的所有数据,虽然不多,只能成为追忆
魂淡,一定要记得备份啊
但也因此促使我选择 Github 搭建了新的博客
废话太多了我
滚去做题 _(:з」∠)_

就像网上很多文章写的那样,建个 Hexo 的博客简直太方便了。本文前提:

  1. Mac OS X (如果不是,请 alt+w)
  2. Github 账号
  3. 不能依赖本文

安装 Xcode (如果有必要)

新建 Repository

命名用 xxx.github.io (拜托请务必替换掉 xxx)
进 repo 的 settings 点击 Automatic page generator 让 Github 自动替你创建出一个 gh-pages 的页面
喝杯茶,xxx.github.io 这个网址就可以正常访问了,虽然暂时比较丑

安装最新 NodeJS

https://nodejs.org/download/release/latest/

安装 Hexo

https://hexo.io 写的很清楚

1
2
3
4
5
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server

安装 NexT 主题

http://theme-next.iissnan.com/five-minutes-setup.html

1
2
3
$ cd blog
$ git clone https://github.com/iissnan/hexo-theme-next themes/next
$ hexo s

浏览器里可以看到 http://localhost:4000 主题已更换

写作及更新

1
2
3
4
5
6
7
8
$ cd blog
$ hexo n "firstblood"
# 这将在 blog/source/_posts 文件夹下生成 firstblood.md 文件
# 选择你所中意的 Markdown 编辑器(e.g. Mou)开始码字
$ hexo d -g
# 执行之前,确保已经修改了 blog/_config.yml 中的 deploy 段
# 首次执行可能要输入 Github 账号密码
# 请参考 http://hexo.io/docs/deployment.html
0%