找到
86
篇与
OWLSAMA
相关的结果
- 第 3 页
-
debian配置系统IP 以及多IP多网关通信 一、IP配置 1、使用命令 nano /etc/network/interfaces改为如下 auto eth0 iface eth0 inet static address 192.168.0.190 gateway 192.168.0.1 netmask 255.255.255.0 auto eth1 iface eth1 inet static address 192.168.1.190 gateway 192.168.1.1 netmask 255.255.255.0address:IP地址 gateway:网关 netmask:子网掩码 auto eth0:开机自启 iface eth0 inet static: 静态ip 2、配置dns nano /etc/resolv.conf改为如下 nameserver 114.114.114.114 nameserver 8.8.8.8 3、重启并应用 systemctl restart networking二、多网多网关通信 1、参考linux配置三网同时通信
-
debian 9 安装成功后 root 用户界面无法登录 一、Debian安装完后,默认是不允许root用户直接登陆的 1、先用普通用户登录进系统,然后 su root,输入root密码切换到root用户, 直接 nano /etc/gdm3/daemon.conf再security下面加上这么一行:AllowRoot = true,然后按Ctrl+X退出并保存,确认保存输入Y 2、修改gdm-password文件 nano /etc/pam.d/gdm-password直接用#注释掉auth required pam_succeed_if.so user != root quiet_success这一行,然后按Ctrl+X保存,确认保存输入Y, 3、最后reboot重启系统可用root账户直接登录了
-
Debian系统root用户无法SSH登录的问题 Debian默认是不允许root登录的 一、用户普通用户登录,打开终端,输入 命令 su root 回车, 输入root密码 回车 切换到root账号 二,设置root用户登录 nano /etc/ssh/sshd_config修改配置 将PasswordAuthentication no的注释去掉,并且将no修改为yes 将#PermitRootLogin prohibit-password的注释去掉,将prohibit-password改为yes三、 重启shh服务 service ssh restart四、添加开机自启动 update-rc.d ssh enable
-
H3C交换机配置Telnet远程登录 一、进入系统视图,并开启Telnet服务。 <H3C> system [H3C] telnet server enable二、配置VTY接口认证模式为scheme模式(用户名+密码认证)。 [H3C] line vty 0 4 [H3C-line-vty0-4] authentication-mode scheme [H3C-line-vty0-4] quit三、创建本地账号abc,密码为123456,授权用户角色为network-admin。 [H3C] local-user abc [H3C-luser-manage-abc] password simple 123456 [H3C-luser-manage-abc] service-type telnet [H3C-luser-manage-abc] authorization-attribute user-role network-admin [H3C-luser-manage-abc] quit四、保存配置。 [H3C] save
-
H3C光模块相关命令和检测方法 一、光模块信息查询命令和检测方法 1. display transceiver interface {interface-type interface-number}该命令用于查询指定接口的光模块信息,包括光模块的型号、序列号、制造商、光模块的支持速率、传输距离等。 2. display transceiver diagnostics {interface-type interface-number}该命令用于查询指定接口上光模块的诊断信息,包括光功率接收和发送功率、光耦合度等。通过该命令可以了解光模块发射和接收光信号的品质。 3. display transceiver alarm {interface-type interface-number}该命令用于查询光模块的告警信息,如温度告警、电压告警、光功率告警等。通过该命令可以了解光模块是否存在故障或异常情况。 二、光模块参数配置命令和检测方法 1. transceiver eeprom-read {interface-type interface-number}该命令用于读取光模块的EEPROM信息,包括制造商、型号、序列号等。通过该命令可以了解光模块的基本信息。 2. transceiver diagnose-test {interface-type interface-number}该命令用于进行光模块的诊断测试,包括光发送和接收测试。通过该命令可以测试光模块的发送和接收功能是否正常。 3. interface {interface-type interface-number}该命令用于配置指定接口的光模块类型。通过该命令可以设置光模块的类型,以满足不同的光纤需求。 三、光模块状态监测命令和检测方法 1. display transceiver power该命令用于查询所有光模块的电源信息,包括电源供电状态、电源电压等。通过该命令可以了解光模块的电源情况。 2. display transceiver statistics {interface-type interface-number}该命令用于查询指定接口上光模块的统计信息,包括接收光功率、发送光功率、光耦合度等。通过该命令可以了解光模块的工作状态和光信号质量。 3. display transceiver alarm {interface-type interface-number}该命令用于查询指定接口上光模块的告警信息,如温度告警、电压告警、光功率告警等。通过该命令可以及时发现并处理光模块的故障或异常情况。 以上是一部分H3C光模块相关命令和检测方法的介绍,通过这些命令和方法可以对光模块进行信息查询、参数配置和状态监测,以确保光模块的正常工作和性能。
-
vue 项目 页面刷新404问题 vue页面访问正常,但是一刷新就会404的问题解决办法: 第一种解决方法: 将vue路由模式mode: 'history' 修改为 mode: 'hash' //router.js文件 const router = new Router({ //mode: 'history', mode: 'hash', routes: [ { path: '/', redirect: '/login' }, { path: '/login', component: Login }, ] })第二种解决方法: 在服务器Nginx配置文件里,添加如下代码,再刷新就OK了 location / { try_files $uri $uri/ @router; index index.html; } location @router { rewrite ^.*$ /index.html last; }
-
SpringBoot集成Swagger2 前言 本章节主要介绍SpringBoot项目集成Swagger2的一些相关知识,包括集成版本、依赖、集成方式、以及简单的使用。官方提供的SwaggerUI太low,本篇集成了knife4j,在可视化方面有了大大的提示,操作更加人性化。 一、Swagger是什么? Swagger是一个restful规范和完整的框架,用于生成、描述、调用和可视化RESTful风格的 工具。在后端服务定义好参数格式以及方法,启动服务后网页即可访问接口信息文档 ,并且在网页端可进行接口测试。Swagger让部署管理和使用功能强大的API变得非常简单。 二、集成步骤 1.依赖引入 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.4.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <java.version>1.8</java.version> </properties> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-ui</artifactId> <version>3.0.3</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>3.0.0</version> </dependency>2.代码配置 config初始化配置,主要用于初始化swagger以及定义基本信息basePackage为扫描controller的路径 其他信息按照自己想法定义即可 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SwaggerConfig{ @Bean public Docket customDocket() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() //扫描的包路径 .apis(RequestHandlerSelectors.basePackage("com.example.owladmin.controller")) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("OwlAdmin接口文档") .description("OwlAdmin接口文档") .contact(new Contact("owlsama","http://blog.owlsama.com","ybzhang1013@gmial.com")) .version("1.0.0") .build(); } }3.Controller层代码 // 定义模块名称 @Api(tags = "HELLO控制接口") // value 接口标签名称 notes 接口描述 @ApiOperation(value = "用户访问信息", notes = "用于收集用户访问的IP 位置 天气等") import com.example.zimuge.AjaxResponse; import com.example.zimuge.config.HttpTemplate; import com.example.zimuge.model.LombokPOJO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @RestController @Slf4j @Api(tags = "HELLO控制接口") public class HelloController { // 用户访问信息获取 // value 接口标签名称 notes 接口描述 @ApiOperation(value = "用户访问信息", notes = "用于收集用户访问的IP 位置 天气等") @GetMapping(value = "/userinfo") public AjaxResponse userinfo() { Object res = HttpTemplate.httpGet("https://api.vvhan.com/api/visitor.info"); return AjaxResponse.success(res, "查询成功!"); } }4.访问路径 http://localhost:port/doc.html#/home 5.效果展示 image.png图片 image.png图片 总结 以上就是SpringBoot集成swagger内容。需要注意的是,不同版本会导致swagger集成后网页访问报错,参数定义不一致也会有同样的问题。
-
Vue中使用axios发送请求与封装 在Vue中使用axios发送请求,首先需要安装axios,可以通过以下命令在项目中安装axios: npm install axios --save然后在Vue组件中使用axios发送请求,可以按照以下步骤进行: 在组件中引入axios: import axios from 'axios';在Vue实例中设置axios的基本配置,比如API的基础URL、请求头等: Vue.prototype.$http = axios.create({ baseURL: 'http://api.example.com', headers: { 'Content-Type': 'application/json' } });在组件中使用axios发送请求,例如获取数据: export default { data() { return { users: [] } }, mounted() { this.$http.get('/users') .then(response => { this.users = response.data; }) .catch(error => { console.log(error); }); } }这里使用了axios的get方法来获取数据,并将获取到的数据赋值给组件的users属性。 以上就是在Vue中使用axios发送请求的基本步骤。当然,axios还提供了其他请求方法,比如post、put、delete等,可以根据实际需求选择使用。同时,也可以使用axios的拦截器来处理请求和响应,增加请求的安全性和可维护性。 封装axios请求可以使代码更具可读性和可维护性,同时也方便全局统一处理请求错误等情况。以下是一种基本的封装方式: 在src目录下新建api文件夹,用于存放所有API请求相关的文件; 在api文件夹下新建index.js文件,用于导出所有API请求的方法; 在index.js文件中导入axios并创建一个新的axios实例,设置基础URL和其他配置,然后将所有API请求方法导出。 以下是示例代码: import axios from 'axios'; // 创建一个axios实例 const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // 设置基础URL timeout: 5000 // 设置请求超时时间 }); // 请求拦截器 service.interceptors.request.use( config => { // 在请求发送之前可以做一些处理,比如添加请求头 return config; }, error => { // 请求出错时的处理 console.log(error); return Promise.reject(error); } ); // 响应拦截器 service.interceptors.response.use( response => { // 在响应返回之前可以做一些处理,比如判断返回数据的状态码 return response; }, error => { // 响应出错时的处理 console.log(error); return Promise.reject(error); } ); // 导出API请求方法 export function fetchData(params) { return service({ url: '/data', method: 'get', params }); } export function postData(data) { return service({ url: '/data', method: 'post', data }); }以上代码中,service实例是一个已经配置好基础URL和拦截器的axios实例。在导出API请求方法时,直接使用service实例来发送请求。在拦截器中可以处理请求和响应的相关信息,比如添加请求头、判断响应状态码等。 封装好API请求方法之后,在Vue组件中直接引入并使用即可,代码更加简洁易懂: import { fetchData } from '@/api'; export default { mounted() { fetchData({ id: 1 }).then(response => { console.log(response.data); }).catch(error => { console.log(error); }); } }当然,这只是一种基本的封装方式,具体的实现可能会因为项目需求和团队约定而有所不同。
-
springboot项目获取来访地址并解析 引入依赖 <dependency> <groupId>org.lionsoul</groupId> <artifactId>ip2region</artifactId> <version>1.7.2</version> </dependency> <!-- 引入fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>2.0.7</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.12.0</version> </dependency>创建IpUtils 工具类 import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.lionsoul.ip2region.DataBlock; import org.lionsoul.ip2region.DbConfig; import org.lionsoul.ip2region.DbMakerConfigException; import org.lionsoul.ip2region.DbSearcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.URL; import java.net.URLConnection; import java.net.UnknownHostException; import java.util.Map; import java.util.Objects; public class IpUtils { public static final String UNKNOWN = "未知"; private static final Logger logger = LoggerFactory.getLogger(IpUtils.class); private static final String dbPath; private static DbSearcher searcher; private static DbConfig config; //key 腾讯位置上申请的key 并 将服务器的IP加入白名单 private final static String format_url = "https://apis.map.qq.com/ws/location/v1/ip?ip={}&key=xxxx-xxxx-xxxx-xxxx-xxxx"; private final static String localIp = "127.0.0.1"; static { dbPath = Objects.requireNonNull(IpUtils.class.getResource("/ip2region.db")).getPath(); try { config = new DbConfig(); } catch (DbMakerConfigException e) { e.printStackTrace(); } try { searcher = new DbSearcher(config, dbPath); } catch (FileNotFoundException e) { e.printStackTrace(); } } /** * 获取ip地址 * * @param request * @return */ public static String getIp(HttpServletRequest request) { String ipAddress; try { ipAddress = request.getHeader("x-forwarded-for"); if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("WL-Proxy-Client-IP"); } if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getRemoteAddr(); if (localIp.equals(ipAddress)) { // 根据网卡取本机配置的IP InetAddress inet = null; try { inet = InetAddress.getLocalHost(); ipAddress = inet.getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } } } // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 if (ipAddress != null && ipAddress.length() > 15) { // = 15 if (ipAddress.indexOf(",") > 0) { ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); } } } catch (Exception e) { ipAddress = ""; } return "0:0:0:0:0:0:0:1".equals(ipAddress) ? localIp : ipAddress; } /** * 解析ip地址 * * @param ip ip地址 * @return 解析后的ip地址 */ public static String getCityInfo(String ip) { //解析ip地址,获取省市区 String s = analyzeIp(ip); Map map = JSONObject.parseObject(s, Map.class); System.out.println(map); Integer status = (Integer) map.get("status"); String address = UNKNOWN; if (status == 375) { String mess = (String) map.get("message"); System.out.println(mess); address = mess; } if (status == 0) { Map result = (Map) map.get("result"); System.out.println(result); Map addressInfo = (Map) result.get("ad_info"); String nation = (String) addressInfo.get("nation"); String province = (String) addressInfo.get("province"); String city = (String) addressInfo.get("city"); address = nation + "-" + province + "-" + city; } return address; } /** * 根据ip2region解析ip地址 * * @param ip ip地址 * @return 解析后的ip地址 */ public static String getIp2region(String ip) { if (StringUtils.isEmpty(dbPath)) { logger.error("Error: Invalid ip2region.db file"); return null; } if (config == null || searcher == null) { logger.error("Error: DbSearcher or DbConfig is null"); return null; } try { //define the method Method method = null; //B-tree, B树搜索(更快) method = searcher.getClass().getMethod("btreeSearch", String.class); DataBlock dataBlock; dataBlock = (DataBlock) method.invoke(searcher, ip); String ipInfo = dataBlock.getRegion(); if (!StringUtils.isEmpty(ipInfo)) { ipInfo = ipInfo.replace("|0", ""); ipInfo = ipInfo.replace("0|", ""); } return ipInfo; } catch (Exception e) { e.printStackTrace(); } return null; } /** * 根据在腾讯位置服务上申请的key进行请求解析ip * * @param ip ip地址 * @return */ public static String analyzeIp(String ip) { StringBuilder result = new StringBuilder(); BufferedReader in = null; try { String url = format_url.replace("{}", ip); URL realUrl = new URL(url); // 打开和URL之间的链接 URLConnection connection = realUrl.openConnection(); // 设置通用的请求属性 connection.setRequestProperty("accept", "*/*"); connection.setRequestProperty("connection", "Keep-Alive"); connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); // 创建实际的链接 connection.connect(); // 定义 BufferedReader输入流来读取URL的响应 in = new BufferedReader(new InputStreamReader( connection.getInputStream())); String line; while ((line = in.readLine()) != null) { result.append(line); } } catch (Exception e) { logger.error("发送GET请求出现异常!异常信息为:{}", e.getMessage()); } // 使用finally块来关闭输入流 finally { try { if (in != null) { in.close(); } } catch (Exception e2) { e2.printStackTrace(); } } return result.toString(); } }调用 @SpringBootApplication public class OwlAdminApplication{ public static void main(String[] args) { SpringApplication.run(OwlAdminApplication.class, args); HttpServletRequest request = null; String ip = IpUtils.getIp(request); String ipaddress = IpUtils.getCityInfo(ip); System.out.println(ipaddress); } }效果展示 image.png图片
-
壁纸 漫画二次元壁纸: 1.HSQWall(超级英雄):https://hdqwalls.com/ 2.vilipix:https://www.vilipix.com/ 3.pixivic:https://pixivic.com/ 4.pixivel:https://pixivel.moe/ 6.次元小镇:https://dimtown.com/ 6.Anime-pictures:https://anime-pictures.net/ 综合类型壁纸 1.wallpaperHaven:https://wallhaven.cc/ 2.Wall Room(只能通过分辨率筛选):https://wallroom.io/ 3.wallpaperup(侧重于搜索):https://www.wallpaperup.com/ 4.wallpaperscraft(类似于wallpaperhaven):https://wallpaperscraft.com/ 5.10wallpapers:https://www.10wallpaper.com/cn/ 6.极简壁纸:https://bz.zzzmh.cn/index 7.必应壁纸:https://bing.ioliu.cn/ 某一领域壁纸 1.foodiesfeed(食物):https://www.foodiesfeed.com/ 2.故宫壁纸:https://www.dpm.org.cn/lights/royal.html 3.ESO(天文宇宙):https://www.eso.org/public/images/ 4.Simpledesktops(极简风格):http://simpledesktops.com/ 5.天空之城(航拍):https://www.skypixel.com/