Skip to content

Instantly share code, notes, and snippets.

View ashfinal's full-sized avatar

ashfinal ashfinal

View GitHub Profile
@ashfinal
ashfinal / Power Files.js
Last active August 16, 2021 06:23
Slim file manager that allows you to manipulate hidden files
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: folder-open;
const APPTABLE = new UITable()
const FM = FileManager.local()
const OFFSET = 2
const VOLICON = ["🏡", "📕", "📗", "📘", "📙"]
var ACTIONROW
var REGISTER
var TIMER = new Timer()
## '#'开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ##
## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ##
## 添加了@和默认启用的选项都是系统需要调用的,请不要随意改动否则可能无法正常运行
## 文件保存相关 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
# 此项 OS X 无法使用 $HOME 及 ~/ 设置路径 建议使用 /users/用户名/downloads
dir=/Users/ashfinal/Downloads
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
@ashfinal
ashfinal / com.github.aria2.plist
Created June 4, 2017 23:28
aria2 launchagent for macOS
<?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">
<dict>
<key>Label</key>
<string>com.github.aria2</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>

Get global status

import urllib2, json
from pprint import pprint
jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'1',
'method':'aria2.getGlobalStat',
                      'params':['token:token']})
c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
pprint(json.loads(c.read()))
# -*- coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Safari()
driver.get("http://www.bing.com")
assert "Bing" in driver.title
elem = driver.find_element_by_name("q")
import re
import os
import urllib
import requests
from bs4 import BeautifulSoup
from multiprocessing import Pool
initurl = 'http://www.03122.com/xinggan/12374/'
baseurl = os.path.split(initurl)[0]
@ashfinal
ashfinal / catch_fn.lua
Created June 3, 2017 07:53 — forked from zzamboni/catch_fn.lua
How to catch the fn key using Hammerspoon
-- Catch fn-h and convert it to a left arrow key.
function catcher(event)
if event:getFlags()['fn'] and event:getCharacters() == "h" then
print("fn-h!")
return true, {hs.eventtap.event.newKeyEvent({}, "left", true)}
end
return false
end
local tapper=hs.eventtap.new({hs.eventtap.event.types.keyDown}, catcher):start()