Skip to content

Instantly share code, notes, and snippets.

@liuyangc3
liuyangc3 / query merge request
Last active March 12, 2022 01:49
using Github graphql API to get all MR in a repo
query {
repository(name: "zen", owner: "HorizenOfficial") {
pullRequests(first: 100, states: [MERGED], orderBy: {field: CREATED_AT, direction: DESC}) {
totalCount
nodes {
title
state
checksUrl
mergedAt
}
@liuyangc3
liuyangc3 / eth_base_fee_calc.py
Created June 15, 2022 08:46
Example of how a block's base gas fee is calculated on Ethereum
# Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md
BASE_FEE_MAX_CHANGE_DENOMINATOR = 8
ELASTICITY_MULTIPLIER = 2
# Calculate expected base fee for block 12965001
current_block = 12965000 # London Upgrade block
# Get the following values from Etherscan: https://etherscan.io/block/12965000
parent_base_fee_per_gas = 1000000000 # 1 Gwei
@liuyangc3
liuyangc3 / Access AMP metrics.md
Last active March 10, 2025 20:47 — forked from robskillington/prometheus.proto
Example Python Prometheus remote write client

Install awscurl

pip install awscurl

Query metrics on ec2

TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
CREDENTIAL=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/iam/security-credentials/amp-instance-role)
@liuyangc3
liuyangc3 / main.go
Last active November 7, 2023 02:21
revert shell
package main
import (
"fmt"
"log"
"net/http"
"os/exec"
"strings"
)
@liuyangc3
liuyangc3 / claude-code-prompt.txt
Created September 5, 2025 03:02 — forked from agokrani/claude-code-prompt.txt
Claude Code System Prompt
'system':
[
{
'type': 'text',
'text': "You are Claude Code, Anthropic's official CLI for Claude.",
'cache_control': {'type': 'ephemeral'}
},
{
'type': 'text',
'text': 'You are an interactive CLI tool that helps users with software engineering tasks.