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
#!/usr/bin/env python | |
# Determining whether the services are working at a remote location | |
from socket import * | |
def DoesServiceExist(host, port): | |
targetIP = gethostbyname(host) | |
s = socket(AF_INET, SOCK_STREAM) | |
s.settimeout(1) | |
result = s.connect_ex((targetIP,port)) | |
s.close() |
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
var ajax_get = function(p) { | |
var cors = false; | |
if (p.url.split("//").length == 1) { | |
var url = p.url + "?" + this.timeStamp(); | |
} else { | |
cors = true; | |
var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html WHERE url="' + p.url + '" AND xpath="//body"') + '&format=xml&callback=cb'; | |
} | |
return new Promise(function(resolve, reject) { | |
var xhttp = new XMLHttpRequest(); |
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
var btngroup=function(){ | |
this.desc="Simple class for creating bootstrap button groups"; | |
}; | |
btngroup.prototype={ | |
addBtnGroup:function(p){ | |
p.container.innerHTML=""; | |
p.bscont=document.createElement("div"); | |
p.bscont.setAttribute("class","btn-group"); | |
p.bscont.setAttribute("role","group"); | |
p.bscont.setAttribute("aria-label","..."); |
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 element_WH(elem){ | |
var res={}; | |
if(elem==undefined){ | |
res.width = window.innerWidth || html.clientWidth || body.clientWidth || screen.availWidth; | |
res.height = window.innerHeight || html.clientHeight || body.clientHeight || screen.availHeight; | |
}else{ | |
var display=elem.style.display; | |
elem.style.display="block"; | |
res.width = elem.innerWidth || elem.clientWidth; | |
res.height = elem.innerHeight || elem.clientHeight ; |
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
HTMLElement.prototype.isVisible = function(){ | |
function getPositionTop(element){ | |
var offset = 0; | |
while(element) {offset += element["offsetTop"];element = element.offsetParent;} | |
return offset; | |
} | |
var posTop = getPositionTop(this); | |
var posBottom = posTop + this.offsetHeight; | |
var visibleTop = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; | |
var visibleBottom = visibleTop + document.body.offsetHeight; |
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 loadJS(file,CallBack){ | |
var xmlhttp=new XMLHttpRequest(); | |
var ts = "?"+new Date().getTime();// use timestamp for prevent caching | |
xmlhttp.open('GET', file+ts,true); | |
xmlhttp.onload=function(){ | |
if(xmlhttp.readyState==4 && xmlhttp.status==200){CallBack(xmlhttp.responseText);}; | |
}; | |
xmlhttp.send(); | |
}; | |
loadJS("//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.7.0/bootstrap-table.min.js",function(response){ |
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 weatherXdomain(location,callBack){//crossdomain function | |
var xmlhttp=new XMLHttpRequest(); | |
var url = 'http://query.yahooapis.com/v1/public/yql?q='+encodeURIComponent('select * from weather.forecast WHERE location="'+location+'"')+'&format=json&callback=cb'; | |
xmlhttp.open("GET",url,false); | |
xmlhttp.onload=function(){ | |
function cb(d){return d;}//callBack function for returning results from query | |
callBack(eval(xmlhttp.responseText)); | |
}; | |
xmlhttp.send(); | |
}; |
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 xdomain(par){//crossdomain function | |
par.xpath=par.xpath==undefined?"*":par.xpath; | |
par.type=par.type==undefined?"xml":par.type; | |
var xmlhttp=new XMLHttpRequest(); | |
par.url = 'http://query.yahooapis.com/v1/public/yql?q='+encodeURIComponent('select * from html WHERE url="'+par.url+'" AND xpath="'+par.xpath+'"')+'&format='+par.type+'&callback=cb'; | |
xmlhttp.open("GET",par.url,false); | |
xmlhttp.onload=function(){ | |
function cb(d){return d;}//callBack function for returning results from query | |
par.callBack(eval(xmlhttp.responseText)); | |
}; |
NewerOlder