This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Description | |
-- Get filename or extension of POSIX path | |
set p to "/Applications/Safari.app" | |
set pFile to POSIX file p | |
tell application "Finder" to set theFullFileName to name of file pFile | |
-- Get filename "Safari.app" with extension | |
tell application "Finder" to set theFileExtension to name extension of file pFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Description: | |
-- POSIX path uses the slash "/" as the separator. POSIX path looks like Unix style path | |
-- AppleScript path uses the colon ":" as the separator | |
-- Read More: http://www.satimage.fr/software/en/smile/external_codes/file_paths.html | |
-- To translate a UNIX path (file or directory, valid or not) into an AppleScript file reference. | |
set p to "/usr/local/bin/" | |
set a to POSIX file p | |
-- file "Macintosh HD:usr:local:bin:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 简化版 get、post | |
// 利用PHP的curl模拟GET功能 | |
function geturl($url) | |
{ | |
$ch = curl_init(); //初始化curl | |
curl_setopt($ch, CURLOPT_URL, $url); //指定请求链接 | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# macOS 终端执行: | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="https://www.google.com/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 方法一:Python 2.x: | |
import urllib2 | |
contents = urllib2.urlopen("http://example.com/foo/bar").read() | |
# 方法二:Python 3.x: | |
import urllib.request | |
contents = urllib.request.urlopen("http://example.com/foo/bar").read() | |
# 方法三:需要安装requests | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Google Chrome" | |
set weburl to the URL of the active tab of the front window | |
end tell | |
set appurl to "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --app=" & weburl | |
do shell script appurl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable tap to click (Trackpad) for this user and for the login screen | |
# For Laptop's Trackpad | |
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true | |
# For Magic Trackpad | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2019-03-24 | |
// Switch Search Engine | |
var o_baidu = { | |
url_id: ".baidu.", | |
url_q: "wd=", | |
url_s: "https://www.baidu.com/s?wd=", | |
}; | |
var o_google = { | |
url_id: ".google.", | |
url_q: "q=", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 判断闰年平年 | |
cal_days_in_year() { | |
year=$1 | |
if (( !(year % 4) && ( year % 100 || !(year % 400) ) )) | |
then | |
echo 366 | |
else | |
echo 365 | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a n. 字母A;第一流的;学业成绩达最高标准的评价符号 abbr. [物]安(ampere) | |
abandon n. 放任;狂热 vt. 遗弃;放弃 | |
abbreviation n. 缩写;缩写词 | |
ability n. 能力,能耐;才能 | |
able adj. 能;[经管] 有能力的;能干的 n. (Able)人名;(伊朗)阿布勒;(英)埃布尔 | |
abnormal adj. 反常的,不规则的;变态的 | |
aboard prep. 在…上 adv. 在飞机上;[船] 在船上;在火车上 | |
abolish vt. 废除,废止;取消,革除 | |
abortion n. 流产,堕胎,小产;流产的胎儿;(计划等)失败,夭折 | |
about prep. 关于;大约 n. 大致;粗枝大叶;不拘小节的人 adj. 在附近的;四处走动的;在起作用的 adv. 大约;周围;到处 n. (About)人名;(法)阿布 |