View gist:26a942d34fb5576a68c111b05ac3fabe
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 hash(str) | |
h = 5381; | |
for c in str:gmatch"." do | |
h = ((h << 5) + h) + string.byte(c) | |
end | |
return h | |
end |
View gist:59b94918931de5473b1c353345bfd6c4
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
parallel --jobs 2 curl -O -s http://example.com/?page{}.html ::: {1..10} | |
# source: https://stackoverflow.com/questions/8634109/parallel-download-using-curl-command-line-utility |
View gist:19fa9cd307b3d293ffc2e8660937392f
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 curl_client_error() { | |
if [ "$2" == "4" ]; then | |
echo $1: Error resolving proxy | |
elif [ "$2" == "6" ]; then | |
echo $1: Error resolving host | |
elif [ "$2" == "7" ]; then | |
echo $1: Error connecting to host | |
elif [ "$2" == "28" ]; then | |
echo $1: Server response timed out. | |
fi |
View rotateArray.py
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
def rotateSquare(a, start, length): | |
lastIndex = start + length - 1 | |
for i in range(length-1): | |
temp = a[start][start + i] | |
a[start][start + i] = a[lastIndex - i][start] | |
a[lastIndex - i][start] = a[lastIndex][lastIndex - i] | |
a[lastIndex][lastIndex - i] = a[start + i][lastIndex] | |
a[start + i][lastIndex] = temp |
View gist:b2fd24c10652b8ec3cb5a0faa5c38e46
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
import hazelcast, logging | |
config = hazelcast.ClientConfig() | |
# Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701' | |
config.network_config.addresses.append('localhost5701') | |
# basic logging setup to see client logs | |
logging.basicConfig() | |
logging.getLogger().setLevel(logging.INFO) |