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
#!/usr/bin/env ruby | |
# $ netcat $HOST $PORT -w 1 -q 0 </dev/null && do_something | |
require 'socket' | |
require 'timeout' | |
def is_port_open?(ip,port) |
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
# Date Time Server - server side using thread | |
# usage: ruby p068dtserver.rb | |
require "socket" | |
dts = TCPServer.new('localhost', 20000) | |
loop do | |
Thread.start(dts.accept) do |s| | |
print(s, " is accepted\n") | |
s.write(Time.now) |
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
import subprocess | |
run_cmd = lambda c : subprocess.Popen(c.split(), stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=False).stdout.read() | |
run_cmd = lambda c,a : subprocess.Popen(c.split(None,a), stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=False).stdout.read() |
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
#!/opt/local/bin/python | |
from datetime import datetime | |
r1 = [] | |
for a in range(1,10001) : | |
begin = datetime.now() | |
reduce(lambda x,y: x+" " +y,map(lambda x: x.upper(), ["diversity","is","good"])) | |
end = datetime.now() | |
r1.append(end-begin) |
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
giliani:~$ irb | |
>> require 'cgi' | |
=> true | |
>> p CGI.escapeHTML('hello <world> & test " hi " 123 ') | |
"hello <world> & test " hi " 123 " | |
=> nil | |
>> |
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
<html> | |
<script> | |
var scrollCheck = function() { | |
var vscroll = (document.all ? document.scrollTop : window.pageYOffset); | |
console.log(vscroll); |
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
## | |
## All files that are a part of this project, unless explicitly noted otherwise, | |
## are covered by the following license: | |
## | |
## Copyright (c) 2011, The Arizona Board of Regents on behalf of The University | |
## of Arizona | |
## | |
## All rights reserved. | |
## | |
## Developed by: iPlant Collaborative as a collaboration between participants at |
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
## | |
## All files that are a part of this project, unless explicitly noted otherwise, | |
## are covered by the following license: | |
## | |
## Copyright (c) 2011, The Arizona Board of Regents on behalf of The University | |
## of Arizona | |
## | |
## All rights reserved. | |
## | |
## Developed by: iPlant Collaborative as a collaboration between participants at |
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
## | |
## All files that are a part of this project, unless explicitly noted otherwise, | |
## are covered by the following license: | |
## | |
## Copyright (c) 2011, The Arizona Board of Regents on behalf of The University | |
## of Arizona | |
## | |
## All rights reserved. | |
## | |
## Developed by: iPlant Collaborative as a collaboration between participants at |
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 loop (fnc,n,o=0): | |
o = o + 1 | |
fnc() | |
loop(fnc,n,o) if n > o else None | |
def hi(): | |
print "h" | |
loop(hi,10) |