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
#!/usr/bin/env python | |
from __future__ import annotations | |
import os | |
from pathlib import Path | |
from segment_anything import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor | |
import cv2 | |
import numpy as np | |
import torch | |
from tqdm import tqdm |
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
let step: Float = 50; | |
// extra slider initialization. the IBAction func below points to the UISlider we are using. | |
@IBAction func onStrengthChange(sender: UISlider) { | |
let roundedValue = round(sender.value/step) * step | |
sender.value = roundedValue | |
} |
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
shell判断文件,目录是否存在或者具有权限 | |
#!/bin/sh | |
Path="/var/log/httpd/" | |
File="/var/log/httpd/access.log" | |
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限 | |
if [ ! -x "$Path"]; then | |
mkdir "$Path" | |
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
# Returns dictionary mapping lowercase model strings (e.g. 'macbookpro11,3') | |
# to a general category (e.g. "MacBook Pro (15-inch)"). | |
# Exact model names can be modified. | |
# @author Richard Hofman | |
# | |
def model_to_type_dict(): | |
type_to_model = {'Macbook Pro (Retina, 13-inch)': ['MacBookPro10,2', 'MacBookPro11,1', 'MacbookPro12,1'], | |
'MacBook Pro (13-inch)': ['MacBookPro9,2', 'MacBookPro8,1', 'MacBookPro7,1', 'MacBookPro5,5'], | |
'MacBook Pro (Retina, 15-inch)': ['MacbookPro11,4', 'MacbookPro11,5', 'MacBookPro11,2', 'MacBookPro11,3', 'MacBookPro10,1'], | |
'MacBook Pro (15-inch)': ['MacBookPro9,1', 'MacBookPro8,2', 'MacBookPro6,2', 'MacBookPro5,3', 'MacBookPro5,1', 'MacBookPro4,1', 'MacBookPro3,1', 'MacBookPro2,2', 'MacBookPro1,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
// @discardableResult to be added | |
// @noescape needs to move to type annotation | |
// needs to add _ for item | |
public func with<T>(item: T, @noescape update: (inout T) throws -> Void) rethrows -> T { | |
var this = item; try update(&this); return this | |
} |
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
# 规则配置仅供参考,适用于Surge iOS 1.2.3 (563) 及其后续版本; | |
# 包含 Proxy Group、URL Rewrite 特性; | |
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计; | |
# 屏蔽 Hao123、百度联盟广告以及部分运营商网页漂浮广告; | |
# Surge 新手使用指南 http://bit.ly/1q5eTlF | |
[General] | |
# warning, notify, info, verbose | |
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0/96 | |
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12 | |
loglevel = notify |
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
[General] | |
loglevel = warning | |
bypass-system = true | |
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.lan | |
bypass-tun = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12 | |
dns-server = 114.114.114.114,114.114.115.115 | |
[Proxy] | |
PROXY = custom,服务器地址,服务器端口,加密方式,密码,模块地址,tcp-fast-open=true |
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 UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
UIButton.appearanceProxyIn(ViewController).backgroundColor = UIColor.redColor() | |
UIButton.appearanceProxyIn(ViewController).tintColor = UIColor.yellowColor() |
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
// | |
// RBResizer.swift | |
// Locker | |
// | |
// Created by Hampton Catlin on 6/20/14. | |
// Copyright (c) 2014 rarebit. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ShellScript.h | |
// | |
// Created by Koki Ibukuro on 6/18/14. | |
// Copyright (c) 2014 Koki Ibukuro. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
typedef void (^ShellScriptMessageCallback)(NSString* msg); |
NewerOlder