Skip to content

Instantly share code, notes, and snippets.

View angelotinho's full-sized avatar
🎯
Focusing

Angelo angelotinho

🎯
Focusing
  • @Bahmon
  • Manasarovar Kailash
View GitHub Profile
@angelotinho
angelotinho / jq-cheetsheet.md
Created May 13, 2020 17:00 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@angelotinho
angelotinho / jq to filter by value.md
Created May 13, 2020 16:30 — forked from ipbastola/jq to filter by value.md
JQ to filter JSON by value

JQ to filter JSON by value

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)

@angelotinho
angelotinho / Netfilter-IPTables-Diagrams.md
Created April 30, 2020 02:30 — forked from intika/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

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.

@angelotinho
angelotinho / timeout_and_tick.go
Created March 7, 2020 17:10 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// 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:
@angelotinho
angelotinho / smtp-gmail-send.go
Created March 6, 2020 23:28 — forked from jpillora/smtp-gmail-send.go
Send email using Go (Golang) via GMail with net/smtp
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
@angelotinho
angelotinho / exercise-web-crawler-slution1.go
Created March 3, 2020 22:35 — forked from SaoYan/exercise-web-crawler-slution1.go
A Tour of Go Exercise: Web Crawler
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"

AWS Golang SDK examples