My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
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
| diskutil list | |
| diskutil unmountDisk /dev/disk2 | |
| diskutil eraseDisk FAT32 SANDISK /dev/disk2 |
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
| SELECT table, | |
| formatReadableSize(sum(bytes)) as size, | |
| min(min_date) as min_date, | |
| max(max_date) as max_date | |
| FROM system.parts | |
| WHERE active | |
| GROUP BY table |
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
| = Examples of how OTX API calls relate different indicator types = | |
| Official documentation is available at https://otx.alienvault.com/api but may be missing a couple of the newer calls | |
| These are some unofficial notes | |
| The API key below is for a dummy demo account. It should work but I would suggest using your own. | |
| Some of the JSON responses are quite nested, and editor such as http://jsoneditoronline.org/ may be useful | |
| == Input: Hostname / Domain == | |
| The following calls can be made for both domains and hostname, ie you can swap 'hostname' with 'domain' below. |
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
| For REST/JSON web service that returns : | |
| { | |
| "DatabaseConnections": [ | |
| { | |
| "DatabaseName": "database1", | |
| "DatabaseStatus": "Open", | |
| }, | |
| { | |
| "DatabaseName": "database2", | |
| "DatabaseStatus": "Open", |
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
| #!/bin/sh | |
| for d in `docker ps -a | awk '{print $1}' | tail -n +2`; do | |
| d_name=`docker inspect -f {{.Name}} $d` | |
| echo "=========================================================" | |
| echo "$d_name ($d) container size:" | |
| sudo du -d 2 -h /var/lib/docker/aufs | grep `docker inspect -f "{{.Id}}" $d` | |
| echo "$d_name ($d) volumes:" | |
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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |