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 awk -f | |
BEGIN { RS = ""; FS = "\n"; } | |
{ | |
for (i=1; i<=NF; i++) { | |
sum += $i | |
} | |
if (sum > max) { | |
max = sum |
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
// Unix Domain Socket Peer Credentials | |
// | |
// This program demonstrates setting up a HTTP server over a Unix Domain Socket | |
// and subsequently obtaining connecting clients credentials. The credentials | |
// contain the User ID, Group ID, and Process ID of the incoming connection (as | |
// connections are made by some local system user as opposed to a network | |
// connection). | |
// | |
// This has interesting use cases around local process security. For example, | |
// a server listening on a Unix Domain Socket can choose to allow or reject |
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
let print_row row = | |
Array.map print_char row |> ignore; | |
print_newline () | |
let rule n = function | |
| ('_', '_', '_') -> if n land 0b00000001 = 0 then '_' else '*' | |
| ('_', '_', '*') -> if n land 0b00000010 = 0 then '_' else '*' | |
| ('_', '*', '_') -> if n land 0b00000100 = 0 then '_' else '*' | |
| ('_', '*', '*') -> if n land 0b00001000 = 0 then '_' else '*' |