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
# Install tmux on Centos release 6.5 | |
# install deps | |
yum install gcc kernel-devel make ncurses-devel | |
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
tar -xvzf libevent-2.0.21-stable.tar.gz | |
cd libevent-2.0.21-stable | |
./configure --prefix=/usr/local |
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
// example function where arguments 2 and 3 are optional | |
function example( err, optionalA, optionalB, callback ) { | |
// retrieve arguments as array | |
var args = []; | |
for (var i = 0; i < arguments.length; i++) { | |
args.push(arguments[i]); | |
} | |
// first argument is the error object |
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 | |
# mov2giv in out width | |
# mov2gif video_file_in.mov gif_file_out.gif 300 | |
tmp_dir=/tmp/frames_$(date +%s) | |
mkdir $tmp_dir | |
if [ -z "$3" ] | |
then | |
size=600 |
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
function evalute() { | |
window.confirm = function(){ return true; }; | |
var selects = document.querySelectorAll('#tdList td input[type="radio"][dj="01"]'); | |
for (var i = 0; i < selects.length; i++) { | |
selects[i].click(); | |
} | |
document.getElementById('yjjy').value = 'ok'; | |
document.getElementById('SUB').click(); | |
} |
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
function loadScript(url, callback) { | |
// Adding the script tag to the head as suggested before | |
var head = document.getElementsByTagName('head')[0]; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
// Then bind the event to the callback function. | |
// There are several events for cross browser compatibility. | |
script.onreadystatechange = callback; |
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
function addLoadEvent(func) { | |
var oldonload = window.onload; | |
if (typeof window.onload != 'function') { | |
window.onload = func; | |
} else { | |
window.onload = function() { | |
if (oldonload) { | |
oldonload(); | |
} | |
func(); |
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
$.fn.disableSelection = function() { | |
return this.attr('unselectable', 'on') | |
.css({ | |
'-moz-user-select': '-moz-none', | |
'-moz-user-select': 'none', | |
'-o-user-select': 'none', | |
'-khtml-user-select': 'none', | |
'-webkit-user-select': 'none', | |
'-ms-user-select': 'none', |
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
/* disable text selection at double clicking */ | |
$.fn.disableSelection = function() { | |
return this.attr('unselectable', 'on') | |
.css({ | |
'-moz-user-select': '-moz-none', | |
'-moz-user-select': 'none', | |
'-o-user-select': 'none', | |
'-khtml-user-select': 'none', | |
'-webkit-user-select': 'none', |
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
# export all images to current directory | |
for i in $(sudo docker images | sed -n "2,\$p" | awk '{print $1":"$2}'); do | |
sudo docker save $i > $(echo -n $i | tr '/' '_').tar | |
done | |
# import all images from current directory | |
for i in $(ls *.tar); do sudo docker load < $i; done |
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
is_mounted () { | |
if [ $# -eq 1 ]; then | |
if [ ! -b "$1" ]; then | |
echo "error: invalid device:$1" | |
return 1 | |
elif df | awk '{print $1}' | grep "$1" &>/dev/null; then | |
return 0 | |
else | |
return 1 | |
fi |
OlderNewer