This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
convert_to_alac() { | |
flac="$1" | |
aiff="${flac%.*}.aiff" | |
alac="${flac%.*}.m4a" | |
flac -s -d --force-aiff-format -o "$aiff" "$flac" | |
afconvert -f m4af -d alac "$aiff" "$alac" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// change minute time with milisecond to seconds | |
// e.g. 02:04:33,229 | |
function toSeconds(input) { | |
let a = input.split(','); | |
let x = a[0].split(':').reverse().reduce((prev, curr, i) => prev + curr*Math.pow(60, i), 0); | |
let y = a[1] / 1000 | |
return x + y; | |
} | |
function SrtToJson(srt) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################ | |
# +------------------------------------------------------+ # | |
# | Notes | # | |
# +------------------------------------------------------+ # | |
############################################################ | |
# If you want to use special characters in this document, such as accented letters, you MUST save the file as UTF-8, not ANSI. | |
# If you receive an error when Essentials loads, ensure that: | |
# - No tabs are present: YAML only allows spaces | |
# - Indents are correct: YAML hierarchy is based entirely on indentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[20:02:12] [Server thread/INFO]: Starting minecraft server version 1.15.2 | |
[20:02:12] [Server thread/INFO]: Loading properties | |
[20:02:13] [Server thread/INFO]: This server is running Tuinity version git-Tuinity-"ab11927" (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) | |
[20:02:14] [Server thread/INFO]: Using 4 threads for Netty based IO | |
[20:02:14] [Server thread/INFO]: Server Ping Player Sample Count: 12 | |
[20:02:14] [Server thread/INFO]: Debug logging is disabled | |
[20:02:14] [Server thread/INFO]: Default game type: SURVIVAL | |
[20:02:14] [Server thread/INFO]: Generating keypair | |
[20:02:14] [Server thread/INFO]: Starting Minecraft server on *:10122 | |
[20:02:14] [Server thread/INFO]: Using default channel type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [{id: 2, date: "2019/1/28"}, {id: 3, date: "2019/1/1"}, {id: 1, date: "2019/7/19"}]; | |
array.sort(function(a,b){ | |
return new Date(b.date) - new Date(a.date); | |
}); | |
// Output | |
// [{id: 1, date: "2019/7/19"}, {id: 2, date: "2019/1/28"}, {id: 3, date: "2019/1/1"}]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 原自 https://gist.github.com/simplelife7/5954021 评论区 | |
* 由于使用了 TypeScript 才有的类型注释,这些代码不能直接复制到 JS 中运行。 | |
*/ | |
/** | |
* | |
* @param {string} id 元素的 id(不包含 # 号) | |
* @param {boolean} full 选择是否要求元素全体在可视范围内。 | |
* 当 full 参数为 true 时,只有当该元素所有部分都在可视范围内,才会返回 true。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const randomInt = (min, max) => Math.floor(Math.random() * (max - min) + min); |