Skip to content

Instantly share code, notes, and snippets.

@salrashid123
salrashid123 / main.go
Last active March 18, 2022 12:55
GCS SignedURL which restricts the maximum limit size and content (https://blog.salrashid.dev/articles/2022/limit_gcs_signedurl/)
package main
import (
"bytes"
"context"
"crypto/md5"
"encoding/base64"
"flag"
"fmt"
"net/http"
@salrashid123
salrashid123 / main.go
Created March 17, 2022 16:04
go1.18 generic
package main
import (
"fmt"
)
type Foo struct {
a string
b string
}
@salrashid123
salrashid123 / batchdelete_debug.go
Last active March 12, 2022 20:24
using batch api for google cloud storage (debug) see https://blog.salrashid.dev/articles/2022/blob_zapper/
package main
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
@salrashid123
salrashid123 / blobdelete.go
Last active February 22, 2023 22:32
using batch api for google cloud storage https://blog.salrashid.dev/articles/2022/blob_zapper/
package main
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
@salrashid123
salrashid123 / tracer.go
Last active March 12, 2022 20:30
logging GCS RequestResponse header and body in golang
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"mime/multipart"
"net/http"
@salrashid123
salrashid123 / signjwt.go
Last active March 10, 2022 18:12
golang iam signjwt
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
@salrashid123
salrashid123 / hmacsha.go
Created March 6, 2022 13:13
BigQuery External Function for HMAC SHA256
package remote
import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@salrashid123
salrashid123 / signedurl.go
Last active February 15, 2022 02:29
Golang SignedURL with IAM API
package main
import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
@salrashid123
salrashid123 / main.py
Created February 8, 2022 12:15
GCP container image that prints details of the access_token
import os
from flask import Flask
import google.auth
from google.auth.transport.requests import AuthorizedSession
from google.auth import impersonated_credentials
from google.auth import compute_engine
@salrashid123
salrashid123 / iam_trace.go
Created February 2, 2022 22:30
GCP IAM Trace utlity
package main
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
"io/ioutil"
"regexp"