跳至主要內容
常用工具
[[toc]] 日常工具 代码转图片 ; 正则表达式可视化工具 ; 在线调色板 ; web开发文档 ; 免版权插图 ; 娱乐社区 社区 Github (https://github.com/zhanghaijun666) : 全球最大开源社区。; CSDN (https://blog.csdn.net/) :老牌中文技术博客社区。; 掘金 (https...

编程技巧WindowsWindows大约 7 分钟
CSS命名规范

CSS 的命名,采用 BEM 命名规范,可以有效的避免组件间样式的相互污染,减少嵌套层级。具体规则如下:

BEM 是什么?

BEM 使用分隔符将类名区隔成三个部分:

[prefix]-[block]__[element]--[modifier]

  • prefix:全局的前缀,这里指代表 tdesign 的前缀,也就是 t-
  • Block(块) :组件的最外层父元素,这个类包含最通用和可重用的功能。
  • Element(元素) :组件内可包含一个或多个元素,元素为块添加了新功能。无需重置任何属性。
  • Modifier(修饰类) :块或元素都可以通过修饰词来表示为变体。

编程技巧CSSSCSSS大约 5 分钟
SSH配置多个GIT平台

1、Git全局配置

如果之前设置过全局的user.nameuser.email, 需要先删掉,删除命令如下

# 查看全局配置
git config --global --list
# 删除全局配置的用户名
git config --global --unset user.name
# 删除全局配置的邮箱
git config --global --unset user.email

编程技巧WindowsWindows大约 1 分钟
Linux中磁盘管理

一、磁盘分区

在Linux下,磁盘格式化、分区和挂载的详细步骤如下所示:

1.确定磁盘设备

使用以下命令来查看可用磁盘设备:

fdisk -l
# Disk /dev/mmcblk1: 7456 MB, 7818182656 bytes, 15269888 sectors
# 238592 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes

# Disk /dev/mmcblk1 doesn't contain a valid partition table
# Disk /dev/mmcblk1boot0: 4 MB, 4194304 bytes, 8192 sectors
# 128 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes

# Disk /dev/mmcblk1boot0 doesn't contain a valid partition table
# Disk /dev/mmcblk1boot1: 4 MB, 4194304 bytes, 8192 sectors
# 128 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes

# Disk /dev/mmcblk1boot1 doesn't contain a valid partition table
# Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors
# 486192 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes

# Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
# /dev/mmcblk0p1 *  0,32,33     8,73,1            2048     133119     131072 64.0M  c Win95 FAT32 (LBA)
# /dev/mmcblk0p2    8,73,2      912,229,21      133120   31116287   30983168 14.7G 83 Linux

编程技巧CentOSCentOS大约 10 分钟
美化Centos的终端

Centos的终端用起来太单一了。想着换成zsh终端,并配合oh my zsh的主题。从而打造不一样的终端吧。


编程技巧CentOSCentOS大约 1 分钟
用proxy改造你的console

解决方案

方案一,通过ast解析console 将变量名放在console后面,奈何esbuild不支持ast操作(不是我不会 哈哈哈哈), 故放弃。

方案二,既然vue能代理对象,那么console是不是也能被代理。

实践

第一步代理console,将原始的console,用全局变量originConsole保存起来,以便后续使用 withLogging 函数拦截console.log 重写log参数

js复制代码const originConsole = window.console; 
var console = new Proxy(window.console, { 
    get(target, property) { 
    if(property === 'log') { 
        return withLogging(target[property]) 
    } 
    return target[property] }, 
})

编程技巧VUE应用VUE应用大约 1 分钟
Jar瘦身实例

1、依赖拆分配置

只需要在项目pom.xml文件中添加下面的配置:

 <build>
  <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
      <executable>true</executable>
      <layout>ZIP</layout>
      <!-- 这里是填写需要包含进去的jar,
          必须项目中的某些模块,会经常变动,那么就应该将其坐标写进来
          如果没有则nothing ,表示不打包依赖 -->
      <includes>
        <include>
          <groupId>nothing</groupId>
          <artifactId>nothing</artifactId>
        </include>
        <!-- 除了第三方依赖,会将子模块的引用加进来 -->
        <!-- 
        <include>
          <groupId>com.example</groupId>
          <artifactId>example-util</artifactId>
        </include> 
        -->
      </includes>
    </configuration>
   </plugin>
   <!--拷贝依赖到jar外面的lib目录-->
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
      <execution>
        <id>copy</id>
        <phase>package</phase>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
        <configuration>
          <!--指定的依赖路径-->
          <outputDirectory>${project.build.directory}/lib</outputDirectory>
        </configuration>
      </execution>
    </executions>
   </plugin>
  </plugins>
 </build>

编程技巧JavaJava大约 2 分钟
Netty介绍

一、Netty 简介

Netty 是由 Jboss 提供的一个 Java 开源框架,现为 Github 上的独立项目。Netty 提供异步的、时间驱动的网络应用程序框架和工具,用以快速开发高性能、高可靠性的网络服务器和客户端程序。

也就是说,Netty 是一个基于 NIO 的客户、服务器端编程框架,使用 Netty 可以确保你快速和简单的开发出一个网络应用,例如实现了某种协议的客户、服务端应用。Netty 相当于简化和流线化了网络应用的编程开发过程,例如:基于 TCP 和 UDP 的 socket 服务开发。

二、Hello Netty


编程技巧JavaJava大约 3 分钟
20230815

1、Redis 的单机、哨兵、集群的区别和选型?

单机模式

在单机模式下,Redis 运行在单个实例上,所有的数据都存储在这一个实例中。优点包括部署简单、操作方便,适用于快速的数据缓存需求。

  • 缺点
    • 单点故障:如果 Redis 实例出现故障,数据可能会丢失。
    • 有限的容量:内存容量受到物理服务器的限制。
    • 不支持高可用性:无法提供自动故障转移或负载均衡。

哨兵模式


编程技巧JavaJava大约 2 分钟
制作RPM包

一、rpmbuild

rpmbuid是用于制作rpm格式包的工具。

rpm 4.4.x版本之前,rpmbuid工具默认的工作车间为/usr/src/redhat,所以造成普通用户不能制作rpm包。

rpm 4.5.x版本开始,将rpmbuid工具默认的工作车间为$HOME/rpmbuild(用户家目录),并且推荐用户尽量不用root账号制作rpm包。

## rpm版本查看方法
rpm -qa | grep rpm

编程技巧Shell脚本Shell脚本大约 8 分钟
2
3
4
5
...
8