Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| # Author : tintinweb@oststrom.com <github.com/tintinweb> | |
| ''' | |
| A simple TCP three-way handshake example | |
| #> python scapy_tcp_handshake.py | |
| DEBUG:__main__:init: ('oststrom.com', 80) | |
| DEBUG:__main__:start | |
| DEBUG:__main__:SND: SYN |
| brew install ffmpeg \ | |
| --with-dcadec \ | |
| --with-faac \ | |
| --with-fdk-aac \ | |
| --with-ffplay \ | |
| --with-fontconfig \ | |
| --with-freetype \ | |
| --with-frei0r \ | |
| --with-libass \ | |
| --with-libbluray \ |
| /** | |
| * Solves the n-Queen puzzle in O(n!) | |
| * Let p[r] be the column of the queen on the rth row (must be exactly 1 queen per row) | |
| * There also must be exactly 1 queen per column and hence p must be a permuation of (0 until n) | |
| * There must be n distinct (col + diag) and n distinct (col - diag) for each queen (else bishop attacks) | |
| * @return returns a Iterator of solutions | |
| * Each solution is an array p of length n such that p[i] is the column of the queen on the ith row | |
| */ | |
| def nQueens(n: Int): Iterator[Seq[Int]] = | |
| (0 until n) |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| man() { | |
| env \ | |
| LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
| LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
| LESS_TERMCAP_me=$(printf "\e[0m") \ | |
| LESS_TERMCAP_se=$(printf "\e[0m") \ | |
| LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
| LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
| LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
| man "$@" |
| import socket | |
| hostname, sld, tld, port = 'www', 'integralist', 'co.uk', 80 | |
| target = '{}.{}.{}'.format(hostname, sld, tld) | |
| # create an ipv4 (AF_INET) socket object using the tcp protocol (SOCK_STREAM) | |
| client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| # connect the client | |
| # client.connect((target, port)) |
| { | |
| "Version": "2012-10-17", | |
| "Id": "arn:aws:sqs:YOUR-AWS-REGION:YOUR-AWS-ACCOUNT-ID:YOUR-QUEUE-NAME/SQSDefaultPolicy", | |
| "Statement": [ | |
| { | |
| "Sid": "example-statement-ID", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "*" | |
| }, |
Random query recipes of JMESPath for the AWS CLI tools that I might have written or stumbled upon.
| upstream upstream_close_server_keepalive_timeout_0 { | |
| server upstream:10443; | |
| } | |
| upstream upstream_keepalive_server_keepalive_timeout_0 { | |
| server upstream:11443; | |
| keepalive 64; | |
| } | |
| upstream upstream_close_server_keepalive_timeout_300 { |