Skip to content

Instantly share code, notes, and snippets.

View linjungz's full-sized avatar

Randy Lin linjungz

View GitHub Profile
@linjungz
linjungz / my_prometheus_values.yaml
Created December 29, 2021 16:31
Helm chart values for Prometheus Server installed in EKS
## The following is a set of default values for prometheus server helm chart which enable remoteWrite to AMP
## For the rest of prometheus helm chart values see: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/values.yaml
##
## 通过以下参数安装Prometheus Server在EKS中,并将指标采集并上报至AMP
serviceAccounts:
server:
name: "amp-iamproxy-ingest-service-account"
annotations:
eks.amazonaws.com/role-arn: "arn:aws:iam::294254988299:role/amp-iamproxy-ingest-role"
@linjungz
linjungz / gist:b0123caaeb08bb70b445f18f78cd9432
Created December 11, 2020 16:55
Simple demo for creating S3 pre-signed url in Lambda
import json
import boto3
from botocore.exceptions import ClientError
s3client = boto3.client('s3')
def lambda_handler(event, context):
@linjungz
linjungz / describe_volumes.py
Last active August 6, 2019 05:54
Filter EBS volumes by tag
import boto3
client = boto3.client('ec2')
volumes = client.describe_volumes(
Filters = [
{
'Name': 'tag:Owner',
'Values': [
'Randy'
@linjungz
linjungz / gist:43b00385217b268fa5051e817ca9b584
Created June 28, 2019 11:21
Remove duplicated consecutive lines
inf = open('input.txt', 'r')
outf = open('output.txt', 'w')
curWord = ''
for s in inf.readlines():
s = s.strip()
if curWord == '' or s != curWord :
curWord = s
outf.write(s + ' ')
@linjungz
linjungz / .zshrc
Last active October 5, 2018 13:38
zshrc
#~/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/linjungz/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
filetype plugin indent on
syntax on
:set noexpandtab
:set copyindent
:set preserveindent
:set softtabstop=0
:set shiftwidth=2
:set tabstop=2