This file contains 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
// 全屏播放时,按↓(箭头下)彻底隐藏视频信息栏,以方便截图。再次按↑恢复。 | |
// 按←,→ 后退/前进5秒。按空格播放/暂停。 | |
window.addEventListener("keydown", e => { | |
if (document.activeElement && document.activeElement.tagName == "INPUT") { | |
return; | |
} | |
let v = document.querySelector("video"); | |
let a = document.querySelector(".video-js .vjs-dock-text"), | |
b = document.querySelector(".video-js .vjs-control-bar"); |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
package fuck.you.java; | |
import java.util.*; | |
public class Strtr { | |
/* | |
from php strtr | |
*/ | |
static public String strtr(String str, Map<String, String> replace_arr) { | |
int maxlen = 0; int minlen = 1024*128; |
This file contains 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
#!/bin/bash | |
if [[ $# < 1 ]] | |
then | |
printf "Usage: transcode_append_utf8_bom <FILE>\n" | |
exit 1 | |
fi | |
UTF8_BOM=$(echo "0xef0xbb0xbf" | xxd -r) | |
FILEHEAD=$(head --bytes=3 $1) |
This file contains 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
#!/bin/bash | |
if [[ $# < 1 ]] | |
then | |
printf "Usage: transcode_gbk <FILE>\n" | |
exit 1 | |
fi | |
FILE="$1" |
This file contains 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
// npm -g install iconv | |
var Iconv = require('iconv').Iconv; | |
var fs=require("fs"); | |
// convert string from GBK to UTF-8 | |
var iconv = new Iconv('GBK', 'UTF-8'); | |
var filename = "file"; | |
var content_buffer = fs.readFileSync(filename); | |
var content_buffer_utf8 = iconv.convert(content_buffer); |
This file contains 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
#!/bin/sh | |
if [ $# -lt 2 ] | |
then | |
echo "Usage: change_openvpn_port <CONF_FILE> <PORT>" | |
exit 1 | |
fi | |
sed -ire "s/^port[ \t]*[0-9]*/port $2/i" $1 | |
sed -ire "s/^remote[ \t]*\([a-zA-Z0-9\.]*\)[ \t]*[0-9]*/remote \1 $2 /i" $1 |