Skip to content

Instantly share code, notes, and snippets.

View zhaopan's full-sized avatar
🤣

ZP zhaopan

🤣
  • CQ·CHINA
  • 07:52 (UTC +08:00)
View GitHub Profile
# git 重命名文件夹/文件
git mv -f <oldfolder> <newfolder>

# eg: 现有文件夹:test,需修改为:test_file
git mv -f test test_file
git add -u test_file    # -u:会更新已经追踪的文件和文件夹
git commit -m "重命名文件夹"
git push origin master
# 设置主机名称 (centos7+支持)
# centos6修改主机名的配置文件是 /etc/sysconfig/network
# centos7修改主机名的配置文件是 /etc/hostname
$hostnamectl set-hostname <your hostname>
--static # 注:该命令会同步修改 /etc/hostname
--pretty # 给主机起别名(昵称)
# eg: 设置为 ts01
$hostnamectl set-hostname "ts01" --static
@zhaopan
zhaopan / MaxDepth.cs
Last active March 1, 2023 07:01
MaxDepth
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
///
/// </summary>
namespace ConsoleApp2
{
/// <summary>
@zhaopan
zhaopan / EnumPower.cs
Last active March 1, 2023 07:00
EnumPower 角色权限
using System;
using System.Collections;
using System.Text;
namespace Common.Lib
{
/// <summary>
/// 角色权限对象,拥有指定权限。(可支持64个独立的权限项)
/// </summary>
/// <typeparam name="T">泛型 T (权限列表)必须是一个枚举。</typeparam>
@zhaopan
zhaopan / UnitTest.cs
Last active March 1, 2023 07:01
UnitTest
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MyTests
{
[TestClass]
public class UnitTest1
{
/// <summary>
/// Test.txt
@zhaopan
zhaopan / ListComparer.cs
Last active March 1, 2023 07:02
ListComparer
public class MaterielCodesComparer : IEqualityComparer<EntMaterielCodes>
{
public bool Equals(EntMaterielCodes x, EntMaterielCodes y)
{
if (Object.ReferenceEquals(x, y)) return true;
return x != null && y != null && x.RFIDCode == y.RFIDCode && x.UniqueCode == y.UniqueCode;
}
public int GetHashCode(EntMaterielCodes obj)
{
@zhaopan
zhaopan / List-Union-Intersect-Except.cs
Last active March 1, 2023 07:02
List-Union-Intersect-Except
并集:var union =arps.Union(flts).ToList();
交集:var inters = arps.Intersect(flts)ToList();
差集:var except= arps.Except(flts)ToList();