Skip to content

Instantly share code, notes, and snippets.

View bfgits's full-sized avatar

Simon bfgits

  • Shenzhen
View GitHub Profile
@bfgits
bfgits / openssh-private-key-to-rsa-private-key
Created February 26, 2020 07:12
openssh private key to rsa private key
#https://stackoverflow.com/questions/54994641/openssh-private-key-to-rsa-private-key
#You have an OpenSSH format key and want a PEM format key. It is not intuitive to me, but the suggested way to convert is by changing the password for the key and writing it in a different format at the same time. The command looks like this:
ssh-keygen -p -N "" -m pem -f /path/to/key
#It will change the file in place, so make a backup of your current key just in case. -N "" will set the passphrase as none. I haven't tested this with a passphrase.
#The public key should be fine as is.
#For the full explanation of the above command, see the -m option here: https://man.openbsd.org/ssh-keygen
解密aws windows ec2密码的时候会报以下错误。
@bfgits
bfgits / Disable Automatic Updates on Server 2016
Last active December 18, 2019 07:43
Disable Automatic Updates on Server 2016
Open an elevated command prompt window : cmd with admin
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.
https://www.tdsheridanlab.com/disable-automatic-updates-on-server-2016/
@bfgits
bfgits / install_istioctl.sh
Created November 23, 2019 09:52
install istioctl and add _istioctl
#https://istio.io/docs/ops/diagnostic-tools/istioctl/
#https://github.com/istio/istio/issues/12607
curl -sL https://istio.io/downloadIstioctl | sh -
export PATH=$PATH:$HOME/.istioctl/bin
#generate the bash completion file
istioctl collateral --bash
source istioctl.bash
@bfgits
bfgits / centos init
Created November 21, 2019 08:41
centos init
#调整分区大小
$ sudo resize2fs /dev/xvda1
service sshd start
yum -y install setuptool
yum -y install ntsysv system-config-firewall-tui system-config-network-tui
yum -y install openssh-clients
yum -y install telnet vim ntpdate wget
yum install ntp ntpdate ntp-doc
yum install mkfontscale (字体工具)
@bfgits
bfgits / mongodb_user_ip
Created October 15, 2019 08:36
mongodb get current user IPs
db.currentOp(true).inprog.reduce((accumulator, connection) => { ipaddress = connection.client ? connection.client.split(":")[0] : "unknown"; accumulator[ipaddress] = (accumulator[ipaddress] || 0) + 1; accumulator["TOTAL_CONNECTION_COUNT"]++; return accumulator; }, { TOTAL_CONNECTION_COUNT: 0 })
@bfgits
bfgits / busybox.sh
Last active May 11, 2020 09:04
k8s busybox
kubectl run curl-tool --image=radial/busyboxplus:curl -i --tty --rm
@bfgits
bfgits / check_mysql_db_size.sql
Created June 14, 2019 03:06
how to check database size in mysql
SELECT
table_schema 'Database Name',
SUM(data_length + index_length) 'Size in Bytes',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) 'Size in MiB'
FROM information_schema.tables
GROUP BY table_schema;
@bfgits
bfgits / cloudwatch_logs_filter
Created June 5, 2019 06:30
AWS Cloudwatch logs filter
fields @timestamp, @message
| sort @timestamp desc
|filter @message like /bbb4e265-08b5-44be-9296-bb5ece1cxxxx/
| limit 20
@bfgits
bfgits / aws-all-regions
Created April 25, 2019 02:08
get aws all regions
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r ".prefixes | .[].region " ip-ranges.json | sort | uniq
@bfgits
bfgits / my.cnf
Created April 24, 2019 09:03
mysql5.7配置文件模板
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# 以下模板是mysql5.7参照配置,差异配置属性请参照下行关键字 #diff: ,所有配置参数统一使用"-"
[mysql]
# CLIENT #
port = 3306
socket=/var/lib/mysql/mysql.sock
default-character-set = utf8mb4