Skip to content

Instantly share code, notes, and snippets.

@2matzzz
2matzzz / gist:57be6d7e866b84c63559f022c6ff9e61
Created November 27, 2023 07:11
python3 http post server
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
import sys
from urllib.parse import unquote
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
file_name = os.path.basename(unquote(self.path))
if file_name:

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:

package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func handler(w http.ResponseWriter, r *http.Request) {
var formatted, err = httputil.DumpRequest(r, true)
#include <WioCellLibforArduino.h>
WioCellular Wio;
void setup() {
delay(200);
SerialUSB.begin(115200);
SerialModule.begin(115200);
SerialUSB.println("");
@2matzzz
2matzzz / curl-format
Created March 12, 2018 04:43
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
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"
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"
#!/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
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 November 23, 2015 11:53
ELB policy list which "Server Order Preference" is enabled
aws elb describe-load-balancer-policies | jq '[
.PolicyDescriptions[]|
{
"PolicyName": .PolicyName,
"PolicyAttributeDescriptions": .PolicyAttributeDescriptions[]|
select(.AttributeName == "Server-Defined-Cipher-Order" and .AttributeValue == "true")
}
]'