Skip to content

Instantly share code, notes, and snippets.

View bfgits's full-sized avatar

Simon bfgits

  • Shenzhen
View GitHub Profile
@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 / disable-automatic-updates-windows
Created April 16, 2020 03:37
How to disable automatic updates on Server 2016.
How to disable automatic updates on Server 2016.
Open an elevated command prompt window or PowerShell session
Type sconfig and press enter.
Select option 5
Now select “A” for automatically download and install updates, “D” for download only or “M” for Manual updates.
@bfgits
bfgits / set ulimit
Created April 16, 2020 09:00
Set Permanently ulimit -n / open files in ubuntu
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 65535
user@ubuntu:~$ sudo vim /etc/sysctl.conf
# add the following line to it
fs.file-max = 65535
@bfgits
bfgits / analyze_aliyun_fee
Last active October 16, 2020 10:01
analyze_aliyun_fee
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@File : analyze_aliyun_fee
@Date : 16/10/2020 2:53 PM
@Desc :
'''
import pandas as pd
@bfgits
bfgits / change_dns_servers
Created November 13, 2020 02:19
How can I configure an Amazon Elastic Compute Cloud (Amazon EC2) instance with static DNS server entries that persist when the instance is rebooted?
Short Description
The default behavior of an Amazon EC2 instance associated with an Amazon Virtual Private Cloud (Amazon VPC) is to request a DNS server address at startup using the Dynamic Host Configuration Protocol (DHCP). The DNS server addresses returned in the DHCP response are written to the local /etc/resolv.conf file. Manual modifications to the resolv.conf file with custom DNS server addresses are lost when the instance is restarted. The method that you use to solve this issue depends on your Linux distribution. For more information on VPCs and DNS servers, see Amazon DNS Server.
Resolution
Important: Before you change your Amazon EC2 instance, create a backup using an Amazon Machine Image (AMI) or an Amazon Elastic Block Store (Amazon EBS) snapshot. Changing networking configuration for an instance might render the instance unreachable.
Amazon Linux, Amazon Linux 2
Use one of the following options to configure your Amazon EC2 instance. If you apply both options, then the DNS servers specified in
git clone https://github.com/certbot/certbot.git
acme.sh --issue --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please -d *.abcd.com
添加完dns txt记录再运行以下命令
acme.sh --renew --yes-I-know-dns-manual-mode-enough-go-ahead-please -d *.abcd.com
参考https://github.com/acmesh-official/acme.sh/wiki/dns-manual-mode
# certbot
@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 / get-kubeconfig.sh
Created February 23, 2021 07:46
get-kubeconfig.sh
#!/bin/bash
# Copyright 2020 Gravitational, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@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*