jq is useful to slice, filter, map and transform structured json data.
brew install jq
Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'
Example: To get json record having _id equal 611
cat my.json | jq -c '.[] | select( ._id | contains(611))'
Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)
1) Filter Table
Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.
// keepDoingSomething will keep trying to doSomething() until either | |
// we get a result from doSomething() or the timeout expires | |
func keepDoingSomething() (bool, error) { | |
timeout := time.After(5 * time.Second) | |
tick := time.Tick(500 * time.Millisecond) | |
// Keep trying until we're timed out or got a result or got an error | |
for { | |
select { | |
// Got a timeout! fail with a timeout error | |
case <-timeout: |
package main | |
import ( | |
"log" | |
"net/smtp" | |
) | |
func main() { | |
send("hello there") | |
} |
#!/usr/bin/python | |
#This script does the basic security check. | |
#It checks | |
#1.the server hosting, that is, if any server is hosted in VPC Classic, | |
#2.if there is any security group which has ports opened for all. | |
#3.are all IAM keys rotated in 90 days | |
#4.if MFA is enabled on each user of an account | |
#5.if Cloudtrail is enabled in all regions | |
#6.if any s3 bucket has open permissions |
#!/usr/bin/python | |
#This script does the basic security check. | |
#It checks | |
#1.the server hosting, that is, if any server is hosted in VPC Classic, | |
#2.if there is any security group which has ports opened for all. | |
#3.are all IAM keys rotated in 90 days | |
#4.if MFA is enabled on each user of an account | |
#5.if Cloudtrail is enabled in all regions | |
#6.if any s3 bucket has open permissions |
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
/* | |
This solution uses channels to force each gorountines to wait for its child gorountines to exit. | |
*/ |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"path" | |
"strings" |