Skip to content

Instantly share code, notes, and snippets.

@safecat
safecat / 取药.txt
Last active August 6, 2019 04:29
取药
作者:变先生 链接:
https://zhuanlan.zhihu.com/p/29047119
来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 转载自他人公众号,与本人无任何关系,侵删。
早晨,从窗外的亮光看,今天大约又是一个晴天。
到了晴天,人的心情应该会好一些吧。
@safecat
safecat / gist:8108a671c8dc6cdedaa4e90431fe2cef
Created September 27, 2018 02:59
BetterTouchTool判断网易云音乐是否在播放
if application "网易云音乐" is running then
tell application "System Events"
tell process "NeteaseMusic"
if get title of menu item 1 of menu 1 of menu bar item "控制" of menu bar 1 = "播放" then
return "play"
else
return "pause"
end if
end tell
end tell
@safecat
safecat / surge.conf
Last active November 3, 2015 09:51
my surge conf
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0
@safecat
safecat / surge_main.conf
Created November 3, 2015 09:30 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0
@safecat
safecat / memcached-benchmark.php
Created October 26, 2015 03:16
Memcached Benchmark Script
<?php
if(!class_exists('Memcached')){
die('class Memcached not found.');
}
$mc = new Memcached();
$mc->addServer('127.0.0.1', 11211);
if(!$mc){
die('Memcached connection error.');
@safecat
safecat / timeline-design.md
Created October 22, 2015 09:54
Timeline Design

####Timeline Design Redis

# 用户发的Feed
user.$id.feeds = ZSET{
	$timestamp : $feed_id,
	$timestamp : $feed_id,
	...
}
@safecat
safecat / mongoldb-learn-programming.md
Created October 16, 2015 09:41
MongoDB权威指南学习笔记

MongoDB的哲学:能交给客户端驱动程序来做的事情就不要交给服务器来做。这种理念背后的原因是,即便是像MongoDB这样扩展性非常好的数据库,扩展应用层也要比扩展数据库层容易得多。将工作交由客户端来处理,就减轻了数据库扩展的负担。

##文档定义

  • 文档的key不能包含.$,且key区分大小写。
  • 每个文档自带一个_id
  • 文档的键值对是有序的。
  • 最大16MB。

##集合定义

  • 集合名不能含有system.
@safecat
safecat / mysql-learn.md
Last active April 14, 2017 04:02
深入浅出MySQL学习笔记
  • 安装
    • rpm -ivh mysql-server.rpm
    • rpm -ivh mysql-client.rpm
  • 查看
    • netstat -nlp
    • ./mysqld_safe &
  • ANSI/ISO SQL 是公认的关系数据库标准,PostgreSQL是对其实现最好的开源数据库,但因为其开发目的为教学数据库,故更加追求完美实现标准,性能是短板。

##数据类型

  • 小数
@safecat
safecat / .gitignore
Last active August 29, 2015 14:26 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
# for project that already created, execute the command below after changing .gitignore file
# git rm -r --cached .
# git add .
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
@safecat
safecat / NSLayoutFormatOptions.md
Created July 15, 2015 05:51
NSLayoutFormatOptions

#NSLayoutFormatOptions 翻译自:http://iosdevelopmentjournal.com/blog/2013/04/22/alignment-options-in-auto-laytout/

Options 的作用

constraintsWithVisualFormat:options:metrics:views: 函数中, options 参数是一个 bitmask,它指定了VFL中的元素如何对齐。举个例子,"V:[first][second][third]" 这一句VFL只告诉你了三个元素应该纵向堆叠在一起,但是没有说当它们宽度不同时该怎么办。

你可以再增加一些横向的 constraints,但是这些知识无聊的体力劳动。其实你可以传入一个 option,将它们的相对位置告诉排版引擎。

Options参数