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
import transmissionrpc | |
import argparse | |
def main(tc): | |
# get session stats | |
stats = tc.session_stats() | |
def printttt(s): | |
print(f"总活动时间: {s['secondsActive'] / 86400:.2f} 天") | |
print(f"总上传量: {s['uploadedBytes'] / 1024 / 1024 / 1024:.2f} GB") |
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
# Port of HTTP(S) proxy server on the local end | |
port: 7890 | |
# Port of SOCKS5 proxy server on the local end | |
socks-port: 7891 | |
# Transparent proxy server port for Linux and macOS (Redirect TCP and TProxy UDP) | |
# redir-port: 7892 | |
# Transparent proxy server port for Linux (TProxy TCP and TProxy UDP) |
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
#!/bin/bash | |
DEST="/Applications/Clash for Windows.app/Contents/Resources/static/files/darwin/x64/clash-darwin" | |
VERSION=v1.12.0 | |
ARCH= | |
if [[ $(uname -m) == 'arm64' ]]; then | |
ARCH=arm64 | |
else | |
ARCH=amd64 |
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
///////////////////////////////////////////////////// | |
import Foundation | |
func associatedObject<ValueType: AnyObject>( | |
base: AnyObject, | |
key: UnsafePointer<UInt8>, | |
initialiser: () -> ValueType) | |
-> ValueType { | |
if let associated = objc_getAssociatedObject(base, key) | |
as? ValueType { return associated } | |
let associated = initialiser() |
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
#!/bin/bash | |
check_cmd() { | |
if ! command -v $1 > /dev/null | |
then | |
echo "<$1> could not be found" | |
if ! command -v brew > /dev/null | |
then | |
echo "<brew> could not be found" | |
echo "Please install Homebrew first" |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
// This is for dmoe, you can use a generice type to limit your observer to an UIViewController for common usage. | |
typealias NotifiableExecuteBlock = (Notification) -> Void | |
protocol Notifiable { | |
var name: Notification.Name { get } | |
func observe(by observer: Any, withSelector selector: Selector, object: Any?) | |
func observe(with object: Any?, using block: @escaping NotifiableExecuteBlock) |
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
extension KeyedEncodingContainer { | |
public mutating func encode<T>(_ value: T, forKey key: KeyedEncodingContainer<K>.Key) throws where T : NSCoding { | |
let data = try NSKeyedArchiver.archivedData(withRootObject: value, requiringSecureCoding: false) | |
try encode(data, forKey: key) | |
} | |
} | |
extension KeyedDecodingContainer { | |
public func decode<T>(_ type: T.Type, forKey key: KeyedDecodingContainer<K>.Key) throws -> T? where T : NSCoding { |
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
svn propset svn:ignore -F .svnignore . |
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
defaults write com.google.Chrome URLAllowlist -array-add -string "openinfolx3://*" | |
defaults write com.microsoft.Edge URLAllowlist -array-add -string "openinfolx3://*" |
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
:PSW - [0:0] | |
:PSW_OUTPUT - [0:0] | |
-A PREROUTING -p tcp -j PSW | |
-A OUTPUT -p tcp -j PSW_OUTPUT | |
-A PSW -m set --match-set laniplist dst -j RETURN | |
-A PSW -m set --match-set vpsiplist dst -j RETURN | |
-A PSW -m set --match-set whitelist dst -j RETURN | |
-A PSW -m mark --mark 0xff -j RETURN | |
-A PSW -d 11.1.1.1/32 -p tcp -m comment --comment "\'默认\'" -j REDIRECT --to-ports 1041 | |
-A PSW -p tcp -m comment --comment "\'默认\'" -m set --match-set shuntlist dst -j REDIRECT --to-ports 1041 |
NewerOlder