Skip to content

Instantly share code, notes, and snippets.

View flxxyz's full-sized avatar
🙏
睡门

一个不知名の睡觉高手 flxxyz

🙏
睡门
View GitHub Profile
@flxxyz
flxxyz / ConfigHotReload.go
Last active June 7, 2022 02:10
golang 热加载配置文件
// golang 热加载配置文件
// golang config hot reload
package main
import (
"encoding/json"
"io/ioutil"
"log"
"os"
@flxxyz
flxxyz / enum.ts
Created May 10, 2020 08:17
一些ts的奇怪用法
//枚举的使用
enum OSName {
windows,
darwin,
linux,
centos,
fedora,
debian,
ubuntu,
suse,
@flxxyz
flxxyz / ffmpeg.md
Last active June 7, 2020 07:15
一些ffmpeg命令
@flxxyz
flxxyz / BuildSpigotMCServer.go
Last active September 1, 2021 02:30
我的世界(Minecraft)水桶服编译工具
package main
import (
"bufio"
"bytes"
"flag"
"github.com/gogs/chardet"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/encoding/korean"
"golang.org/x/text/encoding/simplifiedchinese"
@flxxyz
flxxyz / convert_path.rs
Created August 21, 2020 10:56
rust 不同系统转换目录路径
pub fn convert_path(path_str: &str) -> String {
if cfg!(target_os = "windows") {
String::from(path_str.replace("\\", "/"))
} else {
String::from(path_str)
}
}
fn main() {
println!("hello world!");
@flxxyz
flxxyz / CheckIPvNSupport.go
Last active June 30, 2023 06:26
IPv4, IPv6 network support check(检查IPv4, IPv6网络支持)
package main
import (
"log"
"os/exec"
"runtime"
"strconv"
"time"
)
@flxxyz
flxxyz / l4d2_start_server.sh
Last active March 30, 2021 10:42
L4D2服务器启动脚本
#!/bin/sh
#+ip 指定监听的IP
#-port 指定端口,个性建服
#-condebug 记录熊孩子的破坏经过
MAP="+map 指定地图名"
CONF="$HOME/server.cfg"
L4D2_DIR="$HOME/.steam/steamapps/common/Left 4 Dead 2 Dedicated Server"
START_PARAMS="-console -game left4dead2 -secure +ip 0.0.0.0 -port 27017 -nomaster -condebug"
@flxxyz
flxxyz / package.json
Last active April 21, 2022 06:00
OSS and VOD 上传文件
{
"type": "module",
"dependencies": {
"@alicloud/openapi-client": "^0.3.3",
"@alicloud/tea-typescript": "^1.7.1",
"@alicloud/vod20170321": "^2.0.1",
"ali-oss": "^6.15.0"
}
}
@flxxyz
flxxyz / js_data_format.js
Created August 20, 2021 07:25
JS Date format (yyyy-MM-dd hh:mm:ss)
/**
* -
* @param {string} fmt -
* @returns {string} -
*/
Date.prototype.format = function (fmt) {
const dateObject = {
"y+": this.getFullYear(),
"M+": this.getMonth() + 1, // 月份
"d+": this.getDate(), // 日
Promise.resolve()
.then(() => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(1);
}, 3000);
});
})
.then((res) => {
console.log(res); // 这里就是 1