Skip to content

Instantly share code, notes, and snippets.

View 599316527's full-sized avatar

Kyle He 599316527

View GitHub Profile
我本想享受生活,结果发现活下来都很困难。
你的计划,就像零食,吃到肚子里之后就是个屁。
我已经不是那个花五十块钱,也要考虑很久的小孩了,现在五块钱都要深思熟虑。
今天天气很好,在房间里宅久了,准备去客厅散散心。
春节你要小心了,毕竟过年,都是要杀猪的。
经过多年的打拼,虽然没有什么收获,但你有债呀!
人为什么叫人类,因为人活着就是累。
说错话不要紧,你还会继续说错的。
你倒下了,能顶替你的人千千万
你获得了很多金钱,但同时也失去了很多东西,比如烦恼。
@599316527
599316527 / upload.php
Created January 3, 2018 04:39
PHP Single File Upload
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="." method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@599316527
599316527 / download-iqiyi-videos.js
Last active April 22, 2023 13:14
下载爱奇艺视频
const fse = require('fs-extra');
const uuid = require('uuid/v4');
const {spawnSync} = require('child_process');
const puppeteer = require('puppeteer');
// 从视频列表页读取视频URL(在 console 中执行)
function getLinks() {
let links = document.querySelectorAll('.qy-mod-link-wrap > a');
return Array.from(links).map(link => link.href);
}
<?php
/**
* GET请求
* @param String $url 请求的网址
* @return String 返回的内容
*/
function cURL($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@599316527
599316527 / smart-file-size-filter.js
Created October 30, 2015 15:08
Smart File Size Filter for VueJS
var Vue = require('vue');
var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var STEP = 1024;
function format(value, power) {
return (value / Math.pow(STEP, power)).toFixed(2) + UNITS[power];
}
Vue.filter('smart-file-size', {
@599316527
599316527 / dwc3_otg.c.patch
Last active February 8, 2021 07:52
[KERNEL] Z3TC (SGP611) USB OTG (host mode) + simultaneous charging!
--- a/drivers/usb/dwc3/dwc3_otg.c 2021-02-08 15:44:20.000000000 +0800
+++ b/drivers/usb/dwc3/dwc3_otg.c 2021-02-08 15:45:03.000000000 +0800
@@ -33,6 +33,18 @@
static int max_chgr_retry_count = MAX_INVALID_CHRGR_RETRY;
module_param(max_chgr_retry_count, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(max_chgr_retry_count, "Max invalid charger retry count");
+
+//Module param for aca enabling
+static bool aca_enable = 0;
+module_param(aca_enable, bool, S_IRUGO | S_IWUSR);
@599316527
599316527 / directive-delay-execute.js
Last active August 29, 2020 19:42
Vue.js directive: delay execute
var Vue = require('vue');
Vue.directive('delay-execute', {
acceptStatement: true,
bind: function () {
this._delayRunTimeout = parseInt(this.arg, 10) || 1000;
},
update: function (handle) {
this.reset();
this._delayRunTimer = setTimeout(handle, this._delayRunTimeout);
@599316527
599316527 / ddns-start
Last active October 18, 2019 08:32
asuswrt-merlin custom ddns script for dnspod
#!/bin/sh
# This file should be placed in /jffs/scripts/ folder.
# 后台申请token
# https://support.dnspod.cn/Kb/showarticle/tsid/227/
login_token='xxxxxxx,yyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
# 先调 Domain.List 和 Record.List 接口取得 id
# https://www.dnspod.cn/docs/domains.html#domain-list
# https://www.dnspod.cn/docs/records.html#record-list
@599316527
599316527 / prepareFfmpegInputVideoLists.js
Created September 20, 2019 03:54
米家摄像头 分钟 视频合并
const path = require('path');
const fs = require('fs');
const cameraVideoDir = '/mnt/d/Oolong/xiaomi/xiaomi_camera_videos/04cf8cc737da';
let videoDateHourMinutes = fs.readdirSync(cameraVideoDir).filter(function (name) {
return /^\d{10}$/.test(name);
}).reduce(function (ret, name) {
let date = name.substring(0, 8);
if (!ret[date]) ret[date] = [];
@599316527
599316527 / sum-of-n-numbers.js
Last active August 15, 2019 09:44
N数之和 通解
function threeSum(nums, target) {
return uniq(findN(nums.sort(sortor), target, 3));
};
function fourSum(nums, target) {
return uniq(findN(nums.sort(sortor), target, 4));
};