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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ANSI to HTML</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| background-color: #f9f9f9; |
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
| function hash(str) | |
| h = 5381; | |
| for c in str:gmatch"." do | |
| h = ((h << 5) + h) + string.byte(c) | |
| end | |
| return h | |
| end |
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
| 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 |
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
| 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 |
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 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 |
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 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) |