Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am 2matzzz on github.
  • I am 2matzzz (https://keybase.io/2matzzz) on keybase.
  • I have a public key ASCwbIugCDY3ZsV8t6iStaVkz2rocD0G-3YFTomomQvlOgo

To claim this, I am signing this object:

View main.go
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func handler(w http.ResponseWriter, r *http.Request) {
var formatted, err = httputil.DumpRequest(r, true)
View serialmonitor.ino
#include <WioCellLibforArduino.h>
WioCellular Wio;
void setup() {
delay(200);
SerialUSB.begin(115200);
SerialModule.begin(115200);
SerialUSB.println("");
View curl-format
url_effective\t\t: %{url_effective}\n
http_code\t\t: %{http_code}\n
http_connect\t\t: %{http_connect}\n
time_total\t\t: %{time_total}\n
time_namelookup\t\t: %{time_namelookup}\n
time_connect\t\t: %{time_connect}\n
time_appconnect\t\t: %{time_appconnect}\n
time_pretransfer\t: %{time_pretransfer}\n
time_redirect\t\t: %{time_redirect}\n
time_starttransfer\t: %{time_starttransfer}\n
View sts_assumerole_with_external_id.go
package main
import (
"fmt"
"net/url"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
View sts_assumerole.go
package main
import (
"fmt"
"net/url"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
View gist:88dba42fb6080b9d1b2972cb395b351d
#!/bin/bash
regex='(s3)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
if [[ $@ =~ $regex ]]
then
aws s3 ls $@ --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024/1024" GB"}'
else
echo "format err, input e.g. s3://bucket/path/to/calc"
exit 1
View elb-policy-list.sh
aws elb describe-load-balancer-policies --query \
'PolicyDescriptions[] | \
[? PolicyAttributeDescriptions[? AttributeName == `Server-Defined-Cipher-Order` ] | \
[? AttributeValue==`"true"`] ]| \
{"Server-Defined-Cipher-Order-Enabled-Policy":[][PolicyName][]}'
@2matzzz
2matzzz / elb-policy-list.sh
Last active Nov 23, 2015
ELB policy list which "Server Order Preference" is enabled
View elb-policy-list.sh
aws elb describe-load-balancer-policies | jq '[
.PolicyDescriptions[]|
{
"PolicyName": .PolicyName,
"PolicyAttributeDescriptions": .PolicyAttributeDescriptions[]|
select(.AttributeName == "Server-Defined-Cipher-Order" and .AttributeValue == "true")
}
]'
View Golang time format
package main
import (
"fmt"
"time"
)
func main() {
currentTimeUnix := time.Now().Unix()
currentTimeRFC3339 := time.Now().Format("2006-01-02T15:04:05Z07:00")