Skip to content

Instantly share code, notes, and snippets.

@gxfxyz
gxfxyz / synology_disk_benchmark.sh
Created October 1, 2018 18:16
A simple script to test Synology NAS disk speed with hdparm, dd and fio
#!/usr/bin/env bash
# =======================================================================================
#
# A simple script to test Synology NAS disk speed with hdparm, dd and fio.
#
# How to use:
#
# 1. Save synology_disk_benchmark.sh and xfio.conf to your Synology NAS
# 2. Make it executable: chmod +x synology_disk_benchmark.sh
@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
@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 / 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 / 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 / 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_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 / 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 / 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 / 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": {