Skip to content

Instantly share code, notes, and snippets.

View g8up's full-sized avatar
💭
Stay Hungry

g8up g8up

💭
Stay Hungry
View GitHub Profile
@g8up
g8up / Hex2Float.js
Last active July 20, 2025 07:08
把一个 8位 HEX 字符串转换为浮点数
/**
* 解码:把一个 8位 HEX 字符串转换为浮点数
*/
function Hex2Float( hexStr ) {
// 确保字符串长度为偶数
if (hexStr.length % 2 !== 0) {
throw new Error("Hex string length must be even");
}
const buffer = new ArrayBuffer(hexStr.length / 2);
const dv = new DataView(buffer);
@g8up
g8up / waitForElement.js
Last active August 28, 2023 11:40
轮询检测页面节点
<!DOCTYPE html>
<html lang="zh-cmn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>死宅程序员</title>
<!-- 配套视频讲解:https://www.bilibili.com/video/BV1b94y1z74s/ -->
</head>
<body>
<script>
@g8up
g8up / forEachAsync.js
Created August 18, 2023 17:40
async run forEach and get results
const forEachAsync = async (arr, handler, isSerial = true) => {
if( isSerial ) {
const result = [];
return arr.reduce((acc, val) => {
return acc.then(()=>handler(val))
.then(ret=>{
result.push(ret);
return ret;
});
@g8up
g8up / douyu-get-peck-v1.5.js
Last active March 8, 2020 10:13
自动点击领取宝箱鱼丸
javascript: void((function() {
/**
* @file 自动点击领取宝箱 v1.5
* @author 死宅程序猿
* @douyu http://douyu.com/duxing
* @remark 苟富贵,勿相忘~
* @desc 在宝箱倒计时剩余1秒时自动点击,每秒点击1000次。 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)。
*/
var peck = document.querySelector('.peck-cdn');
if (!peck) {
@g8up
g8up / Sortor.js
Last active September 25, 2019 18:39
让直播房间页面按访问量降序排列(目前支持斗鱼、熊猫、战旗)
javascript: void ((function () {
/*
* 直播房间排序 V2.1.1
* 功能:让直播房间页面按访问量降序排列(目前支持斗鱼、熊猫、战旗)
* 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)
* 更新时间:2019年9月26日02:38:23,修复斗鱼平台
*/
function Sortor($container, getPeopleNumFn) {
this.$container = $container;
this.rooms = $container.find('li');
/**
* chrome-extension://aimiinbnnkboelefkjlenlgimcabobli/assets/css-editor.html
*/
body {
background: #3c4c55; /* VSCode bg color*/
color: #ddd;
white-space: pre;
font-family: monospace;
}
@g8up
g8up / 斗鱼找福利V2.3.3.js
Last active June 18, 2019 14:09
让斗鱼房间页面按访问量降序排
javascript: void((function () {
/*
* 斗鱼找福利 V2.3.3
* 日期:2017年2月3日
* 用途:让斗鱼房间页面按访问量降序排列
* 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)。
*/
if( window.location.host.indexOf('douyu') < 0 ){
window.location.href = 'https://www.douyu.com/directory/game/LOL';
}
@g8up
g8up / Douyu.welcome-reminding.js
Last active December 31, 2018 09:02
自动语音提醒进入斗鱼房间的观众
javascript: void ((function () {
/**
* 功能:斗鱼自动弹幕语音朗读
* 用法:需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)
* 版本:v2.0.0
* 日期:2017年12月30日 17:28:17
* 更新:2018年12月31日 16:32:25
*/
const speaker = (word, rate = 1) => {
if (word !== '') {
@g8up
g8up / plist2json.py
Created July 21, 2017 05:18
convert plist to json
# @file plist2json.py
# @desc convert plist to json
# @usage >python plist2json.py FILE_NAME
# @test under python v2.7
# @author g8up
# @date 2017.7.21
import sys
import json
from plistlib import readPlist
@g8up
g8up / go_to_file.py
Created June 3, 2017 07:05
SublimeText3 增强:自动填充已选文本到`Ctrl + P`面板
# 增强 Ctrl + P 快捷键功能
# 当选择一个资源路径,并按 Ctrl + P 时,可自动将选择文本填充到面板,
# 你只需回车即可直接跳转到文件
# 配置:
# 1、Preferences -> Key Bindings 添加:
#
# [{
# "keys": ["ctrl+p"],
# "command": "show_goto_overlay_with_selection"
# }]