Skip to content

Instantly share code, notes, and snippets.

View zh4n7wm's full-sized avatar
🎯
Focusing

Hydra zh4n7wm

🎯
Focusing
View GitHub Profile
@zh4n7wm
zh4n7wm / download-wechat-video.md
Last active October 24, 2024 11:31
下载 微信视频号、网页中的视频文件
@zh4n7wm
zh4n7wm / print-jenkins-secret-file-contents.groovy
Created October 8, 2024 07:28 — forked from briceburg/print-jenkins-secret-file-contents.groovy
Print content of secret files from the Jenkins Credentials Store
import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.domains.Domain;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
//
// modify fileName to match the filename of the secret(s) you want to print.
// (ID would probably be more helpful... yay stack overflow copy pasta)
// alternatively comment out the filter [line 15] to dump all secret files.
//
def fileName = "secrets.env"
@zh4n7wm
zh4n7wm / aws-rds-failed.md
Created September 11, 2024 02:02
AWS RDS The vector database encountered an error while processing the request: The request was throttled because of insufficient resources on the database.

error message

botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Retrieve operation: The vector database encountered an error while processing the request: The request was throttled because of insufficient resources on the database. (Service: RdsData, Status Code: 400, Request ID: b762f4a8-177c-4ba4-abd7-bd36b8fc17f4)

refs: https://repost.aws/questions/QUudolCeyiSDq_ZLmARgkIug/aurora-serverless-v2-the-request-was-throttled-because-of-insufficient-resources-on-the-database

action: Databases -> choose your RDS -> Connectivity & security -> RDS Data API , disable and then re-enable

@zh4n7wm
zh4n7wm / list-and-download-aws-s3-object-in-bucket.md
Created June 17, 2024 00:45
list and download the object in the aws s3 bucket

import json import pathlib

import boto3

def download_s3_obj_versions(_bucket, _key_prefix, _filename, is_save=True): client = boto3.client("s3")

_key = (pathlib.Path(_key_prefix) / _filename).as_posix()

@zh4n7wm
zh4n7wm / manifests.yaml
Created May 27, 2024 23:19 — forked from alexeldeib/manifests.yaml
crictl image cleanup
apiVersion: v1
kind: ConfigMap
metadata:
name: imagecleanupconfig
namespace: default
labels:
component: imagecleanup
data:
# removes all images unused by a running container
cronjobs: 0 0 * * * crictl rmi --prune 2>&1
@zh4n7wm
zh4n7wm / list-cognito.py
Last active April 12, 2024 08:20
list dataset records of aws cognito identity pool
import boto3
identity_pool_id = "us-east-1:xxxxx"
dataset_name = "dataset-name-xxx"
client_sync = boto3.client("cognito-sync")
client_identity = boto3.client("cognito-identity")
def get_dataset_detail(identity_id):
@zh4n7wm
zh4n7wm / decent_request.py
Created December 21, 2023 05:27 — forked from laixintao/decent_request.py
Send HTTP requests using python-requests with timeout, tcp reuse(session) and retry.
from requests.adapters import HTTPAdapter, Retry
from requests import Session
retries = Retry(
total=5, backoff_factor=1, status_forcelist=[502, 503, 504]
)
session = Session() # reuse tcp connection
session.mount("http://", HTTPAdapter(max_retries=retries))
session.mount("https://", HTTPAdapter(max_retries=retries))
@zh4n7wm
zh4n7wm / gpu-tips.md
Last active May 25, 2024 01:17
gpu tips
@zh4n7wm
zh4n7wm / ping.go
Last active June 26, 2023 12:04
pinecone ping demo
package main
import (
"bytes"
"context"
"crypto/ed25519"
"encoding/hex"
"encoding/json"
"flag"
"fmt"
@zh4n7wm
zh4n7wm / GitConfigHttpProxy.md
Created December 22, 2022 02:21 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: