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
# @see https://www.snbforums.com/threads/add-swap-to-usb-drive-on-asus-router.46911/ | |
# Run the command `df` to see where your USB drive is mounted. | |
# Should be something like /tmp/mnt/volume-label | |
# Of course use your volume label in the following commands. | |
#-------------------------------------------- | |
# Create a swap file | |
#-------------------------------------------- | |
dd if=/dev/zero of=/tmp/mnt/volume-label/myswap.swp bs=1k count=524288 | |
mkswap /tmp/mnt/volume-label/myswap.swp |
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
# configure proxy for git while on corporate network | |
# From https://gist.github.com/garystafford/8196920 | |
function proxy_on(){ | |
# assumes $USERDOMAIN, $USERNAME, $USERDNSDOMAIN | |
# are existing Windows system-level environment variables | |
# assumes $PASSWORD, $PROXY_SERVER, $PROXY_PORT | |
# are existing Windows current user-level environment variables (your user) | |
local GENERAL_PROXY="socks5://127.0.0.1:1081" |
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
/** | |
* 解析文档字符串 | |
* | |
* @param {string} html | |
* @returns {DocumentFragment} | |
*/ | |
function parseHTML(html) { | |
const parser = new DOMParser(); | |
const context = parser.parseFromString(html, "text/html"); | |
const children = context.body.children; |
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
/** | |
* @param {Array} list | |
* @return {Array} | |
*/ | |
function shuffle(list) { | |
var len = list.length; | |
var randomIndex, buffer; | |
while (len) { | |
randomIndex = Math.floor(Math.random() * len); | |
buffer = list[--len]; |
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
/** | |
* @param {Object} [option] | |
* @param {HTMLElement} [option.element] | |
* @param {String} [option.axis = "y"] --- "x" || "y" || "xy" | |
* @param {Number} [option.pageX = 0] | |
* @param {Number} [option.pageY = 0] | |
* @param {Number} [option.acceleration = 0.15] | |
* @param {Function} [option.endedCallback] | |
* @constructor | |
*/ |