Skip to content

Instantly share code, notes, and snippets.

@xyuanmu
xyuanmu / getLoc.py
Created October 7, 2023 14:25
Python 通过 Windows API 获取当前设备的经纬度以及精度
import subprocess as sp
import re
accuracy = 3 #Starting desired accuracy is fine and builds at x1.5 per loop
def getLoc():
pshellcomm = ['powershell']
pshellcomm.append('add-type -assemblyname system.device; '\
'$loc = new-object system.device.location.geocoordinatewatcher;'\
'$loc.start(); '\
@xyuanmu
xyuanmu / qqMusicSign.py
Last active August 30, 2024 04:44
Python版QQ音乐sign加密
#encoding = utf-8
import re
import base64
from hashlib import md5
headMap = [21, 4, 9, 26, 16, 20, 27, 30]
middleMap = [212, 45, 80, 68, 195, 163, 163, 203, 157, 220, 254, 91, 204, 79, 104, 6]
tailMap = [18, 11, 3, 2, 1, 7, 6, 25]
def sign(data):
// ==UserScript==
// @name 百度网盘一键批量修改后缀-替换文件及文件夹名
// @namespace dupanBatchRename
// @version 0.1.4
// @description 感谢wealding,修改自【百度网盘一键批量修改后缀&批量替换文件名】;增加了批量修改文件夹名的功能;百度网盘一键批量修改后缀,默认修改为MP4;批量替换文件名【说明:批量改后缀强制改所有后缀,批量替换文件名可以替换一些垃圾版权信息】
// @author ding(AT)gong.si - Modified By Moka
// @match *://pan.baidu.com/disk/home*
// @match *://yun.baidu.com/disk/home*
// @icon https://pan.baidu.com/m-static/base/static/images/favicon.ico
// @run-at document-end
@xyuanmu
xyuanmu / odd-even.bat
Last active March 31, 2021 07:35
批处理奇偶运行不同代码
@echo off
setlocal enabledelayedexpansion
set n=0
:run
set /a n+=1
set /a x=!n! %% 2
if "!x!"=="1" (
@xyuanmu
xyuanmu / copy.js
Last active December 6, 2020 08:07
Copy text to Clipboard
function copy(text){
const input = document.createElement('input');
input.setAttribute('readonly', 'readonly');
input.setAttribute('value', text);
input.style = "position:absolute;opacity:0";
document.body.appendChild(input);
input.select();
if (document.execCommand('copy')) {
console.log('复制成功');
}
@xyuanmu
xyuanmu / decompress_qq_pinyin_qpys.bat
Last active December 6, 2023 13:16
解压QQ输入法皮肤,网上获得的方法,皮肤命名为 qq.qpys 然后放入相同目录,运行后生成 zip 文件可用压缩软件打开
@echo off
:do
if exist "%~f1" (
"D:\Program Files\Python3\python.exe" "%~n0.py" "%~f1"
) else (
"D:\Program Files\Python3\python.exe" "%~n0.py"
pause
call :do
)
@xyuanmu
xyuanmu / youku_kux2mp4.bat
Last active August 18, 2022 14:35
利用优酷自带的ffmpeg转码kux加密文件为mp4,将此批处理放入kux所在目录双击运行即可。
@echo off & title 批量转码优酷KUX为MP4 & cd /d %~dp0
setlocal enabledelayedexpansion
rem 优酷客户端 ffmpeg.exe 所在目录,若路径不对,请自行修改
set ffmpeg="C:\Program Files (x86)\YouKu\YoukuClient\nplayer\ffmpeg.exe"
if not exist %ffmpeg% (
echo.请修改优酷客户端 ffmpeg.exe 所在目录!
)
if exist *.kux (
@xyuanmu
xyuanmu / js_netease_encid.html
Created September 10, 2017 01:28
JavaScript 版计算网易云音乐加密ID
<script>
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
@echo off & cd /d %~dp0 & title 酷狗关联M4A格式
reg add "HKCR\kugou8.M4A" /d "M4A文件" /f >NUL 2>NUL
reg add "HKCR\kugou8.M4A\DefaultIcon" /d "%~dp0KuGou.exe,1" /f >NUL 2>NUL
reg add "HKCR\kugou8.M4A\Shell\Open" /d "使用 酷狗音乐播放器 播放(&O)" /f >NUL 2>NUL
reg add "HKCR\kugou8.M4A\Shell\Open\Command" /d "\"%~dp0KuGou.exe\" /Open \"%%1"\" /f >NUL 2>NUL
reg add "HKCR\kugou8.M4A\Shell\PlayList" /d "添加到“酷狗音乐”播放列表(&P)" /f >NUL 2>NUL
reg add "HKCR\kugou8.M4A\Shell\PlayList\Command" /d "\"%~dp0KuGou.exe\" /List \"%%1"\" /f >NUL 2>NUL
reg add "HKCR\.m4a" /d "kugou8.M4A" /f >NUL 2>NUL
reg add "HKCR\.m4a" /v "Content Type" /d "audio/m4a" /f >NUL 2>NUL
@xyuanmu
xyuanmu / Picasa3取消关联.bat
Created May 17, 2017 12:55
用于关联 Picasa3 的图片查看器 PicasaPhotoViewer,将此批处理放于 PicasaPhotoViewer.exe 所在目录双击即可。
@echo off
echo.
echo.本工具将自动卸载 PicasaPhotoViewer ...
reg delete "HKLM\SOFTWARE\Classes\PicasaPhotoViewer" /F >NUL 2>NUL
reg delete "HKLM\SOFTWARE\RegisteredApplications" /V "Picasa3" /F >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Picasa3" /F >NUL 2>NUL
echo.
echo.卸载完成, 3秒后自动退出...
choice /t 3 /d y /n >NUL