Skip to content

Instantly share code, notes, and snippets.

View terrywang's full-sized avatar

Terry Wang terrywang

View GitHub Profile

mTLS 配置

对于mTLS的配置的证书来说,有如下的提示。

  • 三个文件。 对于大多数系统,如:MySQL, Redis,PostgreSQL。会需要三个文件:CA证书 + CERT 和 KEY。可以在我的这个开源项目(https://github.com/haoel/mTLS/tree/main/certs )中找到我生成的CA,以及 Server 和 Client的 .crt.key 文件。生成的方法也在我的那个开源项目中了。

  • 两个文件。 对于有的系统,比如:MongoDB,他只要两个文件,一个是CA,一个是 pem 文件,对于pem文件,你可以直接把上面的 .crt 和 .key 合并了就好了。如:cat server.crt server.key > server.pem

  • JKS文件。 对于一些系统,比如:Kafka 和 Zookeeper。他要的不是上面的明文的格式,他要的是一种jks的格式,这是Java的格式。怎么从上面的明文的方式转到jks的文件。需要经过下面几步。

@matthewpi
matthewpi / README.md
Last active May 6, 2024 14:16
Nix on Fedora

NixOS on Fedora

Please note that these instructions are not offically supported or condoned by Nix and are not guaranteed to always work, but from my testing everything seems to work perfectly fine.

These steps may not be required if NixOS/nix#2374 is resolved.

SELinux

These commands are required for both Fedora Workstation and Fedora Silverblue

@huytd
huytd / wordle.md
Last active May 2, 2024 12:13
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@radiantly
radiantly / noMangleGoogle.user.js
Last active December 28, 2023 04:31
Prevent Google from mangling links on the search results when clicking or copying on Firefox
// ==UserScript==
// @name Prevent link mangling on Google
// @namespace LordBusiness.LMG
// @match https://www.google.com/search
// @grant none
// @version 1.1
// @author radiantly
// @description Prevent google from mangling the link when copying or clicking the link on Firefox
// ==/UserScript==
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@Weiyuan-Lane
Weiyuan-Lane / mfa-auth.sh
Last active March 23, 2023 04:54
Authentication steps for MFA using AWS Cli
#!/bin/bash
# Copyright (c) 2020 by Liu Weiyuan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jinie
jinie / archive_lj.py
Created August 8, 2019 10:09
Script to archive all electronic issues of Linux Journal
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import re
account_no = '000000' #LJ Account number, zero prefixed
baseurl = 'https://secure2.linuxjournal.com'
def get_filename_from_cd(cd):
"""
@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@shellexy
shellexy / .inputrc
Last active May 8, 2019 00:44
把这个文件保存为 ~/.inputrc 就能直接上下方向键搜索历史记录了。还能随时 cat ~/.inputrc 一下查看 shell 快捷键备忘
## history search
"\e[A": history-search-backward
"\e[B": history-search-forward
## visible ring
set visible-stats on
## menu complete
"\C-n": menu-complete
## 快捷键备忘
## Ctrl + a : 光标移到行首。