REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47
AppleScript is a rather peculiar scripting language to learn.
| ########################################################### | |
| # How to NEVER use lambdas. An inneficient and yet educa- # | |
| # tonal [sic] guide to the proper misuse of the lambda # | |
| # construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] # | |
| # original by (and apologies to): e000 (13/6/11) # | |
| # now in Python 3 courtesy of: khuxkm (17/9/20) # | |
| ########################################################### | |
| ## Part 1. Basic LAMBDA Introduction ## | |
| # If you're reading this, you've probably already read e000's |
| * Shows a message while asserting like: | |
| ok: [host] => { | |
| "msg": "disk usage 4.2B of total 20.0GB (21.0%) (should be within limit 90.0%)" | |
| } | |
| * Note this only looks at first mount point on current node | |
| * Fails if disk is near-full | |
| * Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time | |
| * Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size |
| /*<?php | |
| //*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
| //\u000A\u002F\u002A | |
| class PhpJava { | |
| static function main() { | |
| echo(//\u000A\u002A\u002F | |
| "Hello World!"); | |
| }} | |
| //\u000A\u002F\u002A | |
| PhpJava::main(); |
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
| {# style 1 - long form #} | |
| {% if filepath == '/var/opt/tomcat_1' %} | |
| {% set tomcat_value = tomcat_1_value %} | |
| {% else %} | |
| {% set tomcat_value = tomcat_2_value %} | |
| {% endif %} | |
| {# style 2 - short form #} | |
| {% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %} |
| // ==UserScript== | |
| // @name 百度网盘aria2导出工具 | |
| // @author acgotaku311 | |
| // @description 一个方便吧百度网盘的Aria2rpc导出的脚本。 | |
| // @encoding utf-8 | |
| // @include http://*n.baidu.com/s/* | |
| // @include http://*n.baidu.com/disk/home* | |
| // @include http://*n.baidu.com/share/link* | |
| // @include https://*n.baidu.com/s/* | |
| // @include https://*n.baidu.com/disk/home* |
| :: 启动后需要保留窗口, 关闭窗口则结束进程 | |
| aria2c --conf-path=aria2.conf -D |
People
:bowtie: |
😄 :smile: |
😆 :laughing: |
|---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
| #Web検索 | |
| open "https://www.google.co.jp/search?hl=ja&qscrl=1&q=$@" | |
| open "http://www.google.com/search?q=$(cat | ruby -e 'require "cgi"; print CGI.escape($<.read.chomp)')" | |
| # news検索 | |
| open "https://google.co.jp/search?hl=ja&gl=jp&tbm=nws&q=$@" | |