Skip to content

Instantly share code, notes, and snippets.

@log2c
log2c / TextViewDrawableSize.java
Created September 23, 2020 12:05 — forked from hrules6872/TextViewDrawableSize.java
TextViewDrawableSize - CompoundDrawable size
public class TextViewDrawableSize extends TextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
}
public TextViewDrawableSize(Context context, AttributeSet attrs) {
@log2c
log2c / README.md
Created March 21, 2021 14:25
Clash on Linux.

Clash-Linux

在这里记录下自己在LINUX下折腾Clash的基本过程和踩过得坑。本人并没有正规学过LINUX,以下内容为本人全部是在网络上面搜集的教程和TG各大佬的指导,然后整合,反复折腾出来的,亲测可用,如果有写的不对的地方,大佬别笑。。。

坦白说Clash是我用过的旁路由科学上网插件中最好用的一款(仅限本人),从Windows下的Clash for Windows到Koolshare Lede的KoolClash再到Openwrt的OpenClash,我都有深入使用过,下面是这三款软件的介绍和我的使用感受

Clash for Windows

Clash for Windows最大的特点就是简单易用,传说中的即插即用。可惜只支持Windows设备,多设备想同时享受代理的话似乎比较麻烦,这是我没接触软路由前使用的软件。但由于手头的设备比较多,所以产生了玩软路由的念头,于是有了使用下面两款软件的机会

KoolClash

KoolClash是苏大开发的一款基于Koolshare Lede系统下的一款Clash内核的科学上网插件。在刚接触软路由的时候,受油管各大UP主的影响,本人使用的就是物理机装LEDE做主路由的方案,所以KoolClash也成了我科学上网的首选。但是在我使用LEDE作为单路由的时候,KoolClash才刚刚更新支持Fake-ip,加上本人知识有限,所有在配置方面遇到诸多问题,一直不能完美的运行。所有才有了后面的主路由加旁路网关的方案。

OpenClash

@log2c
log2c / mixin.js
Last active April 7, 2023 12:00
一些关于clash及surge 的脚本
module.exports.parse = ({ content, name, url }, { yaml, axios, notify }) => {
const remove_names = new Set();
const allowList = [80, 8080, 443, 27833, 22]; // 待保留端口的节点
const fallbackProxy = ["DIRECT", "REJECT"]; // proxies为空时自动追加__"自动选择"
if (Array.isArray(content.proxies)) {
content.proxies = content.proxies
.filter((proxy => {
if (allowList.indexOf(proxy.port) === -1) {
remove_names.add(proxy.name);
@log2c
log2c / IONAssetHandler.m
Created November 16, 2021 01:37
ionic-webview远端网页注入cordova.js,实现https调用native功能. 替换该文件,远端待打开的 URL https://xxx.com => ionic://xxx.com
#import "IONAssetHandler.h"
#import <MobileCoreServices/MobileCoreServices.h>
#import "CDVWKWebViewEngine.h"
@implementation IONAssetHandler
-(void)setAssetPath:(NSString *)assetPath {
self.basePath = assetPath;
}
@log2c
log2c / gradle.properties
Last active November 24, 2021 07:33
Gradle国内替换源加速(放在用户目录的.gradle目录下)二选一,代理 or 阿里云镜像
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

macOS 睡眠机制

在 Google 上检索 macOS hibernate,比较可惜的是未能找到 Apple 官方的文档。不过,在 Stack Exchange 上我找到了这篇回答

按照这篇回答的说法,macOS 默认的睡眠,会关闭屏幕,但会维持用于内存(RAM)的供电。这样一来,一旦打开盖子,macOS 就能立即恢复。若是电池电量低于某个预设阈值,则会将内存中的数据转储到硬盘,而后彻底断电。

这样一来,macOS 睡眠时掉电就解释得通了。

原作者还提供了一个 Apple 官方的链接,但无法打开。根据链接内容,看起来是 pmset 这个命令的 man 内容。于是在终端中执行 man pmset 查看相关信息。

@log2c
log2c / config.md
Created May 19, 2022 01:37
WinSCP配置默认Windows Terminal

配置页->Integration->Applications

wt.exe ssh.exe !U@!@ -p !#  -t "cd !/ \; /bin/bash"
@log2c
log2c / gradle.properties
Last active June 8, 2022 05:06
Gradle配置文件说明
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
@log2c
log2c / Force-RGB-Color-on-M1-Mac.md
Created August 22, 2022 08:34 — forked from GetVladimir/Force-RGB-Color-on-M1-Mac.md
Force RGB Color on M1 Mac

Force RGB Color on M1 Mac

How to Force RGB Color Output instead of YPbPr on your M1 Apple Silicon Mac for an External Monitor.

This step-by-step video tutorial will guide you through the procedure of forcing RGB color output on your M1 Mac.

Force RGB Color on M1 Mac

Here is the direct link to the video tutorial: https://www.youtube.com/watch?v=Z1EqH3fd0V4

The video also has Closed Captions (Subtitles) that you can enable, to make it easier to follow if needed.