Skip to content

Instantly share code, notes, and snippets.

@gxfxyz
gxfxyz / rclone.rb
Created November 17, 2019 23:17
Homebrew Rclone formula with cmount tag (v1.50.1)
class Rclone < Formula
desc "Rsync for cloud storage"
homepage "https://rclone.org/"
url "https://github.com/ncw/rclone/archive/v1.50.1.tar.gz"
sha256 "aba9aadd3d20f8684a0150482011a8f9aa36feaf31d987660912378e7892553a"
head "https://github.com/ncw/rclone.git"
bottle do
cellar :any_skip_relocation
sha256 "1bc9d7c6382f1c06980065d4e66f951ebec0b1b961946ce594fa40976e2421fc" => :catalina
@gxfxyz
gxfxyz / karabiner_capslock_control_tab.json
Created May 19, 2019 15:49
Karabiner-Elements config: CapsLock / Control / Tab
{
"title": "CapsLock / Control / Tab",
"rules": [
{
"description": "Tap CapsLock (⇪) → Escape (⎋); Hold CapsLock (⇪) → Control (⌃)",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
@gxfxyz
gxfxyz / karabiner_switch_input_source.json
Created May 19, 2019 05:22
Karabiner-Elements config: switch input source | 输入法切换
{
"title": "Switch input source | 输入法切换",
"rules": [
{
"description": "Tap Command_L (⌘) → Switch input source to English | 短按左 Command (⌘) → 切换到英文输入法",
"manipulators": [
{
"conditions": [
{
"input_sources": [
@gxfxyz
gxfxyz / dahua_rpc.py
Created December 3, 2018 01:20
Basic Dahua RPC wrapper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Basic Dahua RPC wrapper.
Example:
from dahua_rpc import DahuaRpc
dahua = DahuaRpc(host="192.168.1.10", username="admin", password="password")
@gxfxyz
gxfxyz / command_trim_trailing_space.py
Created November 16, 2018 10:51
Sublime Text 3 commands to turn on/off/toggle trim_trailing_white_space_on_save
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sublime Text 3 commands to turn on/off/toggle trim_trailing_white_space_on_save.
Only temporarily affect current file (view).
How to use:
Save to your "/Sublime Text 3/Packages/User" directory.
@gxfxyz
gxfxyz / command_e501.py
Created November 16, 2018 10:39
Sublime Text 3 commands to turn on/off/toggle Flake8Lint E501 (line to long) check
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sublime Text 3 commands to turn on/off/toggle Flake8Lint E501 (line to long) check.
IF current file (view) is in a project:
Change will be saved to the project settings (in .sublime-project file).
Else:
Change will only temporarily affect current file (view).
@gxfxyz
gxfxyz / command_clear_flake8_lint.py
Created November 16, 2018 10:26
Sublime Text 3 command to clear Flake8Lint marks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sublime Text 3 command to clear Flake8Lint marks.
How to use:
Save to your "/Sublime Text 3/Packages/User" directory.
"""
@gxfxyz
gxfxyz / check_bluetooth_connection.py
Created November 16, 2018 10:04
Check if a bluetooth device is connected or not on macOS
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Check if a bluetooth device is connected or not on macOS.
Command-line usage:
$ python check_bluetooth_connection.py bluetooth_device_name
Library usage:
@gxfxyz
gxfxyz / pipenv_virtualenv.py
Created November 15, 2018 22:19
Sublime Text 3 Pipenv virtualenv helper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sublime Text 3 Pipenv virtualenv helper.
1. Automatically find and set Pipenv virtualenv for each opened Python file.
- It uses `pipenv --venv` command to find the virtualenv.
- It will add a 'virtualenv' setting, which is the full path to the virtualenv,
@gxfxyz
gxfxyz / unblockchn.surge.conf
Last active August 19, 2022 10:20
Unblock CHN - Surge 配置文件 & ruleset - https://github.com/gxfxyz/unblockchn
[General]
loglevel = notify
bypass-system = true
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
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
ipv6 = true
[Proxy]
SS = custom, 服务器地址, 端口, 加密方式, 密码, https://raw.githubusercontent.com/ConnersHua/SSEncrypt/master/SSEncrypt.module