Skip to content

Instantly share code, notes, and snippets.

@shellexy
shellexy / apt-pacman.sh
Last active November 10, 2022 11:00
在 msys2 bash 里用类似 apt 的命令代替直接用记不住参数用法的 pacman
#!/bin/bash
# fix the poorly designed pacman/pacman command
# 可以把本文保存在 /usr/local/bin/apt-pacman 并加上可执行权限
list()(
set -x
pacman -Sl "$@"
)
search()(
@shellexy
shellexy / .inputrc
Last active May 8, 2019 00:44
把这个文件保存为 ~/.inputrc 就能直接上下方向键搜索历史记录了。还能随时 cat ~/.inputrc 一下查看 shell 快捷键备忘
## history search
"\e[A": history-search-backward
"\e[B": history-search-forward
## visible ring
set visible-stats on
## menu complete
"\C-n": menu-complete
## 快捷键备忘
## Ctrl + a : 光标移到行首。
@shellexy
shellexy / gfwlist.privoxy.sh
Created February 27, 2019 07:57
让 privoxy 代理服务器使用 gfwlist 自动分流
#!/bin/bash -x
## 让 privoxy 代理服务器使用 gfwlist 自动分流
## 安装需要的包,gfwlist2privoxy 暂时只支持 py2.7 所以需要修改下::
# sudo apt install -y privoxy python-pip
# pip install --user gfwlist2privoxy
# sed -i 's,^#!/usr/bin/python.*,#!/usr/bin/python2.7,' ~/.local/bin/gfwlist2privoxy
## 修改 privoxy 配置,默认使用 8123 本地端口
grep -q gfwlist.action /etc/privoxy/config || echo 'actionsfile gfwlist.action' | sudo tee -a /etc/privoxy/config
@shellexy
shellexy / fix_telegram_desktop_media_viewer.py
Last active January 26, 2019 06:11
临时修复 telegram desktop 点开图片查看时没法真全屏的问题
#!/usr/bin/python3
'''临时修复 telegram desktop 点开图片查看时没法真全屏的问题
现在 telegram desktop 在 ubuntu unity 下点开消息里的图片,会正常全屏显示图片,
但是在 gnome shell 下会被 gnome 顶栏把“全屏图片”挤下去,让图片底部和左下角文字信息挤到屏幕外看不到,
在 kde 下则图片底部和左下角文字信息会被任务栏遮挡,同样看不全画面。
fc 教授说:“现在 的 行 为 是 tg 创建 了 一个 屏幕 大小 的 窗口 ,
但是 位置 不一定 在 左上角 , 然后 就有 一部分 东西 在 屏幕 外面”
@shellexy
shellexy / winecxfreeze.sh
Created January 4, 2019 11:38
在 linux 下打包 python 程序为 exe
#!/bin/bash -x
##
## 在 linux 下打包 python 程序为 exe
##
## @Note: 如果不希望出现 cmd 窗口的话,可以加参数 --base-name=win32gui
##
## wine pygtk 包可以从 http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/ 下载 pygtk-all-in-one 的 .msi
##
## 安装后可以删掉 $WINEPREFIX/drive_c/Python27/Lib/site-packages/gtk-2.0/runtime 下
## 多余的 locale icons 以及 .a .lib .def man 文件以减少体积
@shellexy
shellexy / 99-enable-camera2-api.sh
Last active January 20, 2019 16:35
让 LineageOS、Piexl Experience 刷机清除 /data 后继续保持开启 Camera2 API 以便使用谷歌相机,可以将这个文件放入 /system/addon.d/99-enable-camera2-api.sh
#!/sbin/sh
#
# ADDOND_VERSION=2
#
# /system/addon.d/99-enable-camera2-api.sh
# During a upgrade, this script enable Camera2 API on /system/build.prop
#
# 执行命令 adb shell su -c setprop persist.camera.HAL3.enabled 1 后
# 虽然 getprop 能获得 1 但是谷歌相机无法启动,所以还是需要之前的脚本。
# 或者 adb shell su 后执行
@shellexy
shellexy / cfddns_self_ip.sh
Last active May 16, 2021 04:45
利用 cloudflare dns 做 ddns
#!/bin/bash
## 利用 cloudflare dns 做 ddns
## 不再用 tp 路由器后,就要在手机或笔电服务器来检测自身公网 ip 了
## curl ifconfig 可以用来获取公网 ip
##
## 使用:
## 可以把本文件保存为 /home/您的用户/cfddns_self_ip.sh
## 然后执行 crontab -e
## 在出来的文件编辑里添加一行
## */5 * * * * bash /home/您的用户/cfddns_self_ip.sh
@shellexy
shellexy / cfddns_self_ip.sh
Created November 18, 2018 03:44
利用 cloudflare dns 做 ddns
#!/bin/bash
## 利用 cloudflare dns 做 ddns
## 不再用 tp 路由器后,就要在手机或笔电服务器来检测自身公网 ip 了
## curl ifconfig 可以用来获取公网 ip
##
## 使用:
## 可以把本文件保存为 /home/您的用户/cfddns_self_ip.sh
## 然后执行 crontab -e
## 在出来的文件编辑里添加一行
## */5 * * * * bash /home/您的用户/cfddns_self_ip.sh
@shellexy
shellexy / ifw-inh-qqtim-services.xml
Created November 14, 2018 03:53
将这个文件放入 /data/system/ifw/ 即可抑制 qq、tim、淘宝、支付宝、美团、高德等国产 app 的多余后台服务 ,同时保持 tim 能收到消息
<rules>
<service block="true" log="false">
<component-filter name="tv.danmaku.bili/tv.danmaku.bili.update.UpdateService" />
<component-filter name="tv.danmaku.bili/com.xiaomi.push.service.XMPushService" />
<component-filter name="tv.danmaku.bili/com.xiaomi.mipush.sdk.PushMessageHandler" />
<component-filter name="tv.danmaku.bili/com.xiaomi.mipush.sdk.MessageHandleService" />
<component-filter name="tv.danmaku.bili/com.evernote.android.job.v14.PlatformAlarmService" />
<component-filter name="com.tencent.mobileqq/com.tencent.mobileqq.qipc.QIPCServiceEx" />
<component-filter name="com.tencent.mobileqq/com.tencent.pluginloader.proxy.DownloadProxyService" />
<component-filter name="com.tencent.mobileqq/com.tencent.proxyinner.plugin.loader.NowQTServiceProxy" />
@shellexy
shellexy / wechat2txt.py
Created November 8, 2018 17:25
导出微信聊天记录为 txt
#!/usr/bin/python2.7
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
'''导出微信聊天记录为 txt
@author: Shellexy Wang <shellexyone@gmail.com>
@license: LGPLv3+
@see:
'''