Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
bumaociyuan / 拼图.bat
Last active Jan 18, 2021
需要 https://www.imagemagick.org/script/binary-releases.php#windows 把拼图.bat 放到 C:\Users\zx\AppData\Roaming\Microsoft\Windows\SendTo\ 里面就可以用右键 发送到 拼图.bat 调用脚本
View 拼图.bat
@echo off
title Concat images vertically
echo Begin
set datetimef=%date:~0,2%-%date:~3,2%_%time:~0,2%-%time:~3,2%-%time:~6,2%
echo %datetimef%
setlocal enabledelayedexpansion
set argCount=0
@bumaociyuan
bumaociyuan / jxaClickAppSubMenuItem.applescript
Last active Dec 2, 2020 — forked from RobTrew/jxaClickAppSubMenuItem.applescript
Yosemite JXA Javascript Function for clicking application sub-menu items
View jxaClickAppSubMenuItem.applescript
// Click an OS X app sub-menu item
// 2nd argument is an array of arbitrary length (exact menu item labels, giving full path)
// e.g. menuItemClick("InqScribe", ['View', 'Aspect Ratio', 'Use Media Ratio'])
// Note that the menu path (spelling & sequence) must be exactly as in the app
// See menuItemTestClick() below for a slower version which reports any errors
// For OS X 10.10 Yosemite JXA JavaScript for Automation
@bumaociyuan
bumaociyuan / cd.applescript
Created Mar 7, 2016
go2shell for iterm2.9
View cd.applescript
tell application "Finder"
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
set command to "clear; cd " & pathList
end tell
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
@bumaociyuan
bumaociyuan / ImagePositionButton.swift
Created Jul 4, 2016
Custom UIButton Title Position
View ImagePositionButton.swift
//
// ImagePositionButton.swift
//
//
// Created by zx on 7/4/16.
// Copyright © 2016 zx. All rights reserved.
//
import UIKit
@bumaociyuan
bumaociyuan / common.cy
Last active Sep 30, 2018 — forked from susnmos/common.cy
A script for cycript
View common.cy
(function(exports) {
// 打印按钮的action及其target
zxactionWithTargets = function actionWithTargets(button) {
var allTargets = [button allTargets].allObjects();
if (!allTargets) {
return "is not a uicontrol"
}
var allShow = [];
for (var i = 0; i < allTargets.length; i++) {
var target = allTargets[i];
@bumaociyuan
bumaociyuan / UIImage+gif.swift
Created May 4, 2018
Get first frame of gif
View UIImage+gif.swift
extension UIImage {
// first frame of gif
class func firstFrame(gif url: URL) -> UIImage? {
guard let data = try? Data(contentsOf: url) as CFData else {
return nil
}
guard let source = CGImageSourceCreateWithData(data, nil) else {
return nil
}
guard let cgimage = CGImageSourceCreateImageAtIndex(source, 0, nil) else {
@bumaociyuan
bumaociyuan / shadow.sh
Created Feb 18, 2016
极路由安装ss
View shadow.sh
#!/bin/sh
#
echo ''
echo '/*教程请参考:极路由Shadowsocks家庭无痛翻墙实践*/'
echo 'https://luolei.org/hiwifi-shadowsocks/'
echo 'by @foru17'
echo ''
echo ''
echo '那一天,'
echo '人类终于回想起了,'
View NSObject+hook.m
@interface NSObject (hook)
+ (void)switchClassFuction:(NSString *)originalSelectorName swizzledSelector:(NSString *)swizzledSelectorName;
+ (void)switchInstanceFuction:(NSString *)originalSelectorName sel2:(NSString *)swizzledSelectorName;
@end
@implementation NSObject (hook)
+ (void)switchClassFuction:(NSString *)originalSelectorName swizzledSelector:(NSString *)swizzledSelectorName {
Class class = object_getClass((id)self);
SEL originalSelector = NSSelectorFromString(originalSelectorName);
@bumaociyuan
bumaociyuan / Podfile
Created Jun 29, 2017
单独配置podfile macro
View Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'demo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
end
post_install do |installer|
installer.pods_project.targets.each do |target|
@bumaociyuan
bumaociyuan / zhihu-fuli.js
Last active Jun 25, 2017
知乎图片浏览
View zhihu-fuli.js
(function() {
var imageUrls = [],
totals = 0,
offset = 0,
qId = location.href.split('/').pop();
$(".App-main").innerHTML = '';
var style = " background: rgba(0,0,0,0.8); display: -webkit-flex; /* Safari */ -webkit-flex-wrap: wrap; /* Safari 6.1+ */ display: flex; flex-wrap: wrap; "
$("body").insertAdjacentHTML('beforeend', '<div id="img-fuli" style="' + style + '"><h1 style="color:#fff;">加载中,请稍后...</h1></div>');
loadImg();