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
#!/bin/sh | |
PORT=22 | |
HOST="${BASH_ARGV[0]}" | |
echo -e Pinging $HOST on port $PORT over TCP | |
if nc -z -v -w5 $HOST $PORT >/dev/null 2>&1; | |
then | |
echo "OK" |
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
def getOpenTTDServerInfoCached(serverName: String): Option[String] = { | |
val cacheKey = OpenTTDServerInfo(serverName) | |
reachabilityCache.get(cacheKey) match { | |
case Some(expired) if expired.time.plusMinutes(1).isBefore(now) => reachabilityCache.update(cacheKey, getOpenTTDServerInfo(cacheKey)) | |
case None => reachabilityCache.put(cacheKey, getOpenTTDServerInfo(cacheKey)) | |
case Some(actual) => | |
} | |
reachabilityCache.get(cacheKey) match { | |
case Some(info) => info.status | |
case None => None |
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
List pendingVisits = new LinkedList<>(); | |
Long pendingVisitsRefreshTime = 0L; | |
public List getPendingVisits() throws QmaticClientException { | |
Long currentTime = new Date().getTime(); | |
if (!this.pendingVisits.isEmpty() && (currentTime - pendingVisitsRefreshTime <= 10000)) | |
return this.pendingVisits; | |
this.pendingVisits.clear(); | |
List<VisitInfo> pendingVisitsForCurrentWS = new ArrayList<>(); |
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
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package com.mycompany.taskmanager.servlet; | |
import com.mycompany.taskmanager.ejb.RelationFacadeLocal; | |
import com.mycompany.taskmanager.ejb.Task; | |
import com.mycompany.taskmanager.ejb.TaskFacadeLocal; | |
import com.mycompany.taskmanager.ejb.Time; |
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
#!/bin/zsh | |
# completion | |
autoload -U compinit | |
compinit | |
zstyle ':completion:*' menu select | |
setopt MENU_COMPLETE | |
# correction |
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
" Open URL in browser | |
function! Browser () | |
let line = getline (".") | |
let line = matchstr (line, "http[^ ]*") | |
exec "!chromium ".line | |
endfunction |