Skip to content

Instantly share code, notes, and snippets.

View bfgits's full-sized avatar

Simon bfgits

  • Shenzhen
View GitHub Profile
@bfgits
bfgits / migrate-redis.py
Created August 4, 2017 06:39 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
@bfgits
bfgits / s3-to-es-lamba.py
Created October 18, 2017 11:12 — forked from s-fujimoto/s3-to-es-lamba.py
Import Elasticsearch from ELB access log for AWS Lambda Function
##################################################
### Elasticsearch host name
ES_HOST = "search-******************.ap-northeast-1.es.amazonaws.com"
### Elasticsearch prefix for index name
INDEX_PREFIX = "awslogs"
#################################################
### ELB access log format keys
ELB_KEYS = ["timestamp", "elb", "client_ip", "client_port", "backend_ip", "backend_port", "request_processing_time", "backend_processing_time", "response_processing_time", "elb_status_code", "backend_status_code", "received_bytes", "sent_bytes", "request_method", "request_url", "request_version", "user_agent"]
@bfgits
bfgits / kubeadm-install-offline.md
Created October 30, 2018 03:45 — forked from jgsqware/kubeadm-install-offline.md
Offline Kubeadm install

On master and nodes

Pull images form internet access laptop

docker pull gcr.io/google_containers/kube-apiserver-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-controller-manager-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-proxy-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-scheduler-amd64:v1.5.0
docker pull weaveworks/weave-npc:1.8.2
docker pull weaveworks/weave-kube:1.8.2
@bfgits
bfgits / node_exporter_setup.md
Created April 13, 2020 09:45 — forked from nwesterhausen/node_exporter_setup.md
node_exporter installation on ubuntu

Installing node_exporter

Steps to install node_exporter

  1. Add user for node_exporter

    sudo useradd --no-create-home --shell /bin/false node_exporter
@bfgits
bfgits / curl.md
Last active January 12, 2021 07:34 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@bfgits
bfgits / bot.rb
Created January 14, 2021 09:05 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@bfgits
bfgits / install cfssl
Created February 24, 2021 02:35 — forked from guoyoujin/install cfssl
linux install cfssl
source:
https://pkg.cfssl.org/
install:
$ curl -s -L -o /bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
$ curl -s -L -o /bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
$ curl -s -L -o /bin/cfssl-certinfo https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64
$ chmod +x /bin/cfssl*
@bfgits
bfgits / principles.md
Created May 16, 2022 01:43 — forked from johnpryan/principles.md
Ray Dalio's Principles

Summary And Table Of Life Principles

Think for yourself to decide 1) what you want, 2) what is true, and 3) what you should do to achieve #1 in light of #2, and do that with humility and open-mindedness so that you consider the best thinking available to you.

Life Principles Introduction

Look to the patterns of those things that affect you in order to understand the cause-effect relationships that drive them and to learn principles for dealing with them effectively.

Part II: Life Principles

@bfgits
bfgits / 验证中国身份证 前6位对应地区码
Created September 3, 2022 12:36 — forked from mayufo/验证中国身份证 前6位对应地区码
验证中国身份证 前6位对应地区码
var GB2260 = {
"110000": "北京市",
"110100": "北京市市辖区",
"110101": "北京市东城区",
"110102": "北京市西城区",
"110103": "北京市崇文区",
"110104": "北京市宣武区",
"110105": "北京市朝阳区",
"110106": "北京市丰台区",
"110107": "北京市石景山区",
#!/bin/bash -ex
ARCH=darwin
#ARCH=linux
VAULT_VERSION=1.5.3
PACKER_VERSION=1.6.2
CONSUL_VERSION=1.8.4