Skip to content

Instantly share code, notes, and snippets.

@gxfxyz
gxfxyz / rclone.rb
Created Nov 17, 2019
Homebrew Rclone formula with cmount tag (v1.50.1)
View rclone.rb
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
Karabiner-Elements config: CapsLock / Control / Tab
View karabiner_capslock_control_tab.json
{
"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
Karabiner-Elements config: switch input source | 输入法切换
View karabiner_switch_input_source.json
{
"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 Dec 3, 2018
Basic Dahua RPC wrapper
View dahua_rpc.py
#!/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 Nov 16, 2018
Sublime Text 3 commands to turn on/off/toggle trim_trailing_white_space_on_save
View command_trim_trailing_space.py
#!/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 Nov 16, 2018
Sublime Text 3 commands to turn on/off/toggle Flake8Lint E501 (line to long) check
View command_e501.py
#!/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 Nov 16, 2018
Sublime Text 3 command to clear Flake8Lint marks
View command_clear_flake8_lint.py
#!/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 Nov 16, 2018
Check if a bluetooth device is connected or not on macOS
View check_bluetooth_connection.py
#!/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 Nov 15, 2018
Sublime Text 3 Pipenv virtualenv helper
View pipenv_virtualenv.py
#!/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 Jan 11, 2019
Unblock CHN - Surge 配置文件 & ruleset - https://github.com/gxfxyz/unblockchn
View unblockchn.surge.conf
[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