Skip to content

Instantly share code, notes, and snippets.

@J1nH4ng
J1nH4ng / cors.conf
Last active April 8, 2024 07:29
[Nginx 基本配置] Nginx 基本配置文件 #Nginx #Devops
# Nginx 跨域请求配置文件
# 跨域请求的预检请求
if ($request_method = 'OPTIONS') {
# * 允许所有来源的请求访问资源
add_header Access-Control-Allow-Origin * always;
# 允许跨域请求的方法
add_header Access-Control-Allow-Methods GET,POST,OPTIONS always;
# 允许跨域请求包含的头部信息
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,X-Auth-Token,auth,authtoken,x-authtoken,Cache-Control,Content-Type,access-control-allow-origin,Authorization,X-Authorization,dept_id,deptid,x-terminal,x-preview-token,x-appid,x-nonce,X-signature,x-terminal,x-timestamp,ignorecanceltoken,x-debug-token,x-token' always;
@J1nH4ng
J1nH4ng / my.cnf
Last active April 7, 2024 09:19
[Mysql 配置文件] Mysql 配置文件 #Devops #Mysql
# mysql 8.0 配置文件
[mysqld]
# Specifies the server ID
server_id=1
# 只能用IP地址检查客户端的登录
skip_name_resolve=On
# 日志内记录时间使用系统时间(the local system time zone)
log_timestamps=SYSTEM
@J1nH4ng
J1nH4ng / nmap.xsl
Created April 7, 2024 07:34
[NMAP XSL] NMAP 美化模板 #NMAP
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
<xsl:template match="/">
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css"/>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
{
"name": "example-module",
"author": "example <[email protected]>",
"contributors": [
"example1 <[email protected]> (https://www.example1.com)",
"example2 <[email protected]> (https://www.example2.com)"
],
"homepage": "https://works.example.com",
"description": "package.json 示范文件",
"keywords": [
#!/bin/bash
#
# Description: file sync script
# Author: J1nH4ng<[email protected]>
# Date: 2025-01-14
# Version: V1.0.1.20250115_release
# Copyright 2025 © Team 4r3al. All rights reserved.
function check_application() {
if command -v rsync &> /dev/null; then
#!/bin/bash
#
# Description: backup mysql with mysqldump
# Author: J1nH4ng<[email protected]>
# Date: 2025-02-06
# Version: V0.0.1.20250205_alpha
# Copyright 2025 © Team 4r3al. All rights reserved.
function main() {
:
#!/bin/bash
#
# Description: Delete newly five shell history.
# Author: J1nH4ng<[email protected]>
# Date: 2025-02-14
# Version: V1.0.0.20250214_public
# 主要用于 Xshell 配置
for i in {1..5}; do history -d $(history 1 | awk '{print $1}'); done
#!/bin/bash
#
# Description: compare IP is right.
# Author: J1nH4ng<[email protected]>
# Date: 2025-02-14
# Version: V1.0.0.20250214_public
expected_ip=$1
current_ip=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
check_4r3al_ip(){ expected_ip=$1; current_ip=$(ip addr show wlo1|grep 'inet '|awk '{print $2}'|cut -d'/' -f1); if [ "$current_ip" == "$expected_ip" ]; then echo -e "\033[1;32m验证通过\033[0m -- 当前 IP 地址为:\033[1;33m${current_ip}\033[0m"; else echo -e "\033[1;31m验证不通过\033[0m -- 当前 IP 地址为:\033[1;33m${current_ip}\033[0m,预期 IP 地址为:\033[1;33m${expected_ip}\033[0m,请退出检查配置!"; fi; }
clear
check_4r3al_ip 127.0.0.1
for i in {1..4}; do history -d $(history 1 | awk '{print $1}'); done