Skip to content

Instantly share code, notes, and snippets.

View Guang1234567's full-sized avatar
🌴
On vacation

GuangGuang Guang1234567

🌴
On vacation
View GitHub Profile
@Guang1234567
Guang1234567 / init.gradle.kts
Created June 2, 2024 09:01 — forked from AlexV525/init.gradle.kts
Mirroring Gradle repositories
// Thanks to: https://gist.github.com/bennyhuo/af7c43cc4831661193605e124f539942
val urlMappings = mapOf(
"https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
)
fun RepositoryHandler.mirroring() {
all {
@Guang1234567
Guang1234567 / init.gradle.kts
Created June 2, 2024 09:00 — forked from bennyhuo/init.gradle.kts
How to config mirrors for repositories in Gradle without changing the source code of your project?
fun RepositoryHandler.enableMirror() {
all {
if (this is MavenArtifactRepository) {
val originalUrl = this.url.toString().removeSuffix("/")
urlMappings[originalUrl]?.let {
logger.lifecycle("Repository[$url] is mirrored to $it")
this.setUrl(it)
}
}
}
@Guang1234567
Guang1234567 / current_activity.sh
Last active March 11, 2024 15:55 — forked from 109021017/current_activity.sh
A shell script log the current android top activity
oldActvity=""
displayName=""
currentActivity=$(adb shell dumpsys window | grep -E 'mCurrentFocus')
while true; do
if [[ $oldActvity != $currentActivity && $currentActivity != *"=null"* ]]; then
displayName=${currentActivity##* }
displayName=${displayName%%\}*}
echo $displayName
oldActvity=$currentActivity
@Guang1234567
Guang1234567 / Homebrew Zsh on Mac
Created September 3, 2023 20:35 — forked from ngocphamm/Homebrew Zsh on Mac
Notes on using Homebrew Zsh as default login shell
1. Install Zsh with Homebrew
brew install zsh
2. Add "/usr/local/bin/zsh" to "/etc/shells" file
sudo vim /etc/shells
3. Change to default login shell
chsh -s /usr/local/bin/zsh $USER
4. Make sure new version of Zsh is in active
@Guang1234567
Guang1234567 / CFW_allow_lan_Guide.md
Created July 6, 2023 19:34 — forked from kinfables/CFW_allow_lan_Guide.md
Setup Allow LAN Environment with CFW

利用 Clash for Windows 部署局域网代理环境

Clash for Windows 是基于 Clash Core 开发的 Windows 平台代理工具,支持 Shadowsocks(R) / V2Ray / Trojan / Socks5 / HTTP(S) 等代理协议,支持策略组及规则分流。

下载地址: Github Releases

第一次使用?查看 快速上手

在配置好 Clash for Windows(下文略称为 CFW )后,我们可以考虑开启 Allow LAN (局域网代理共享),以便处于同一局域网内的其他设备接入到本机代理环境中。这不仅可以节省在多台设备中重复部署代理软件的时间,同时也可以通过 CFW 内置的 Connections 对局域网内设备的网络情况实时地管理与监控。

@Guang1234567
Guang1234567 / README.md
Created July 27, 2022 03:52 — forked from subfuzion/README.md
vim/neovim configuration

I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.

It's currently synchronized with my .vimrc config except for a block of neovim-specific terminal key mappings.

This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.

These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,

@Guang1234567
Guang1234567 / trap.swift
Created August 25, 2021 04:06 — forked from sharplet/trap.swift
Simple signal handling in Swift
import Darwin
enum Signal: Int32 {
case HUP = 1
case INT = 2
case QUIT = 3
case ABRT = 6
case KILL = 9
case ALRM = 14
case TERM = 15
@Guang1234567
Guang1234567 / trace.swift
Created August 20, 2021 04:56 — forked from harlanhaskins/trace.swift
Pure Swift stack trace
struct StackFrame {
let symbol: String
let file: String
let address: UInt64
let symbolAddress: UInt64
var demangledSymbol: String {
return _stdlib_demangleName(symbol)
}
}
@Guang1234567
Guang1234567 / build.gradle
Created April 20, 2021 09:09 — forked from nkraev/build.gradle
Variant-aware gradle configuration for replacing manifest placeholders and resources
android.applicationVariants.all { variant ->
String propsName = "../local/${variant.baseName}.properties"
Properties props = new Properties()
props.load(new FileInputStream(file(propsName)))
println "Building \"${variant.baseName}\" tag..."
props.stringPropertyNames().forEach {
variant.resValue("string", it, props[it])
}
@Guang1234567
Guang1234567 / gh-check
Created October 14, 2020 02:37 — forked from lilydjwg/gh-check
gh-check: speed test to known GitHub IPs
#!/usr/bin/python3
import asyncio
import time
import socket
import argparse
import aiohttp
class MyConnector(aiohttp.TCPConnector):