个人常用笔记

Windows字符集的统一与转换 (bbsmax.com)
V8源码编译启动教程

git配置本地代理


# 打开cmd
$ git config --global http.proxy 'socks5://127.0.0.1:10808'
$ git config --global https.proxy 'socks5://127.0.0.1:10808'
# 取消代理
$ git config --global --unset http.proxy
$ git config --global --unset https.proxy
# 文件名太长
$ git config --system core.longpaths true
# 查看配置信息
$ git config -l --global

gradle


# 打开cmd 不要跳转路径,在家路径操作
$ win+r
$ mkdir .gradle
$ cd .gradle
$ vim init.gradle
# 复制以下内容保存即可

init.gradle文件内容

allprojects {
    repositories {
        mavenLocal()
        maven { name "public" ;  url "https://maven.aliyun.com/repository/public"}
        maven { name "google" ;  url "https://maven.aliyun.com/repository/google"}
        maven { name "gradle-plugin" ;  url "https://maven.aliyun.com/repository/gradle-plugin"}
        maven { name "spring" ; url "https://maven.aliyun.com/repository/spring"}
        maven { name "spring-plugin"; url "https://maven.aliyun.com/repository/spring-plugin"}
        maven { name "grails-core"; url "https://maven.aliyun.com/repository/grails-core"}
        maven { name "apache snapshots"; url "https://maven.aliyun.com/repository/apache-snapshots"}
        maven { name "Bstek"; url "http://nexus.bsdn.org/content/groups/public/" }
        mavenCentral()
    }

    buildscript { 
        repositories { 
            mavenLocal()
            maven { name "public" ;  url "https://maven.aliyun.com/repository/public"}
            maven { name "google" ;  url "https://maven.aliyun.com/repository/google"}
            maven { name "gradle-plugin" ;  url "https://maven.aliyun.com/repository/gradle-plugin"}
            maven { name "spring" ;  url "https://maven.aliyun.com/repository/spring"}
            maven { name "spring-plugin" ;  url "https://maven.aliyun.com/repository/spring-plugin"}
            maven { name "grails-core" ;  url "https://maven.aliyun.com/repository/grails-core"}
            maven { name "apache snapshots" ;  url "https://maven.aliyun.com/repository/apache-snapshots"}
            maven { name "Bstek" ; url 'http://nexus.bsdn.org/content/groups/public/' }
            maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
        }
    }
}

maven


# 打开cmd 不要跳转路径,在家路径操作
$ win+r
$ mkdir .m2
$ cd .m2
$ vim settings.xml
# 复制以下内容保存即可

# 操作完成,cd到项目所在路径
# 执行编译命令,跳过单元测试(如果存在),跳过语法检查(如果存在)
$ mvn compile -Dmaven.test.skip=true -Dcheckstyle=true

settings.xml文件内容

<?xml version="1.0" encoding="UTF-8" ?><settingsxmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="
	http://maven.apache.org/SETTINGS/1.0.0 
	http://maven.apache.org/xsd/settings-1.0.0.xsd">
	<profiles>
		<profile>
		<id>jdk-1.8</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<jdk>1.8</jdk>
			</activation>
			<properties>
				<maven.compiler.source>1.8</maven.compiler.source>
				<maven.compiler.target>1.8</maven.compiler.target>
				<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
			</properties>
		</profile>
	</profiles>
	<mirrors>
		<mirror>
			<id>public</id>
			<mirrorOf>central</mirrorOf>
			<name>public</name>
			<url>https://maven.aliyun.com/repository/public</url>
		</mirror>
		<mirror>
			<id>google</id>
			<mirrorOf>central</mirrorOf>
			<name>google</name>
			<url>https://maven.aliyun.com/repository/google</url>
		</mirror>
		<mirror>
			<id>gradle-plugin</id>
			<mirrorOf>central</mirrorOf>
			<name>gradle-plugin</name>
			<url>https://maven.aliyun.com/repository/gradle-plugin</url>
		</mirror>
		<mirror>
			<id>spring</id>
			<mirrorOf>central</mirrorOf>
			<name>spring</name>
			<url>https://maven.aliyun.com/repository/spring</url>
		</mirror>
		<mirror>
			<id>spring-plugin</id>
			<mirrorOf>central</mirrorOf>
			<name>spring-plugin</name>
			<url>https://maven.aliyun.com/repository/spring-plugin</url>
		</mirror>
		<mirror>
			<id>grails-core</id>
			<mirrorOf>central</mirrorOf>
			<name>grails-core</name>
			<url>https://maven.aliyun.com/repository/grails-core</url>
		</mirror>
		<mirror>
			<id>apache snapshots</id>
			<mirrorOf>central</mirrorOf>
			<name>grails-core</name>
			<url>https://maven.aliyun.com/repository/apache-snapshots</url>
		</mirror>
	</mirrors></settings>

pip


# user/pip/pip[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]trusted-host = https://pypi.tuna.tsinghua.edu.cn

npm


$ npm config set registry https://registry.npm.taobao.org$ npm config list

linux全局代理


alias setproxy="export http_proxy=http://192.168.31.177:10809; export https_proxy=$http_proxy; echo 'HTTP Proxy on';"
alias unsetproxy="unset http_proxy; unset https_proxy; echo 'HTTP Proxy off';"
setproxy

apt-get代理设置


# 编辑文件.apt_proxy
Acquire::http::proxy "http://192.168.31.177:10809/";
Acquire::ftp::proxy "ftp://192.168.31.177:10809/";
Acquire::https::proxy "https://192.168.31.177:10809/";
# .zshrc添加命令
alias aptp='apt-get -c /root/.apt_proxy'
# 加载.zshrc 之后使用aptp是使用代理下载文件
source .zshrc

scoop相关软件安装


# 打开Powershell win+r输入powershell
# you must change the execution policy
$ Set-ExecutionPolicy RemoteSigned -scope CurrentUser
$ Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# or shorter
$ iwr -useb get.scoop.sh | iex
# 安装git
$ scoop install git
# 添加三方仓库,包含国内GUI程序
$ scoop bucket add apps https://github.com/kkzzhizhou/scoop-apps
# 国内网络
$ scoop bucket add apps https://gitee.com/kkzzhizhou/scoop-apps
# 安装常用软件
$ scoop install aliyundrive ant baidunetdisk googlechrome gradle jetbrains-toolbox maven mysql neteasemusic nodejs python qq qqmusic vscode wechat 

设置ttl,windows


netsh interface ipv4 set global defaultcurhoplimit=64

linux设置代理


alias s="export http_proxy=http://192.168.31.177:10809; export https_proxy=$http_proxy; echo 'HTTP Proxy on';"
alias u="unset http_proxy; unset https_proxy; echo 'HTTP Proxy off';"
alias c=clear

# wget
wget -e "https_proxy=http://127.0.0.1:10809" https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.1.tar.xz

#curl
curl --proxy http://127.0.0.1:10809 https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.1.tar.xz -o fileName
#curl配置文件
vim ~/.curlrc
proxy="http://127.0.0.1:10809"

# apt-get代理设置 编辑文件.apt_proxy
Acquire::http::proxy "http://192.168.31.177:10809/";
Acquire::ftp::proxy "ftp://192.168.31.177:10809/";
Acquire::https::proxy "https://192.168.31.177:10809/";
# .zshrc添加命令
alias aptp='apt-get -c /root/.apt_proxy'
# 加载.zshrc 之后使用aptp是使用代理下载文件
source .zshrc

查看符号表


# c _add # c++ ?add@@YAHHH@Z
objdump -t .\lib1\cmake-build-debug\add.lib

MSVC和visual studio对应关系


MSC 1.0      _MSC_VER == 100 
MSC 2.0      _MSC_VER == 200 
MSC 3.0      _MSC_VER == 300 
MSC 4.0      _MSC_VER == 400 
MSC 5.0      _MSC_VER == 500 
MSC 6.0      _MSC_VER == 600 
MSC 7.0      _MSC_VER == 700 
MSVC++ 1.0   _MSC_VER == 800 
MSVC++ 2.0   _MSC_VER == 900 
MSVC++ 4.0   _MSC_VER == 1000 (Developer Studio 4.0) 
MSVC++ 4.2   _MSC_VER == 1020 (Developer Studio 4.2) 
MSVC++ 5.0   _MSC_VER == 1100 (Visual Studio 97 version 5.0) 
MSVC++ 6.0   _MSC_VER == 1200 (Visual Studio 6.0 version 6.0) 
MSVC++ 7.0   _MSC_VER == 1300 (Visual Studio .NET 2002 version 7.0) 
MSVC++ 7.1   _MSC_VER == 1310 (Visual Studio .NET 2003 version 7.1) 
MSVC++ 8.0   _MSC_VER == 1400 (Visual Studio 2005 version 8.0) 
MSVC++ 9.0   _MSC_VER == 1500 (Visual Studio 2008 version 9.0) 
MSVC++ 10.0  _MSC_VER == 1600 (Visual Studio 2010 version 10.0) 
MSVC++ 11.0  _MSC_VER == 1700 (Visual Studio 2012 version 11.0) 
MSVC++ 12.0  _MSC_VER == 1800 (Visual Studio 2013 version 12.0) 
MSVC++ 14.0  _MSC_VER == 1900 (Visual Studio 2015 version 14.0) 
MSVC++ 14.1  _MSC_VER == 1910 (Visual Studio 2017 version 15.0) 
MSVC++ 14.11 _MSC_VER == 1911 (Visual Studio 2017 version 15.3) 
MSVC++ 14.12 _MSC_VER == 1912 (Visual Studio 2017 version 15.5) 
MSVC++ 14.13 _MSC_VER == 1913 (Visual Studio 2017 version 15.6) 
MSVC++ 14.14 _MSC_VER == 1914 (Visual Studio 2017 version 15.7) 
MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8) 
MSVC++ 14.16 _MSC_VER == 1916 (Visual Studio 2017 version 15.9) 
MSVC++ 14.2  _MSC_VER == 1920 (Visual Studio 2019 Version 16.0) 
MSVC++ 14.21 _MSC_VER == 1921 (Visual Studio 2019 Version 16.1) 
MSVC++ 14.22 _MSC_VER == 1922 (Visual Studio 2019 Version 16.2)

windows开启远程访问


# 1.设置远程桌面端口(可以不用输,直接第二步,默认开启3389)
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /t REG_DWORD /v portnumber /d 3389 /f

# 2.开启远程桌面
wmic RDTOGGLE WHERE ServerName='%COMPUTERNAME%' call SetAllowTSConnections 1

#检查端口状态
netstat -an|find "3389"#关闭远程桌面
wmic RDTOGGLE WHERE ServerName='%COMPUTERNAME%' call SetAllowTSConnections 0

代理


# 设置代理如下操作
$ git config --global http.proxy http://127.0.0.1:7890
$ git config --global https.proxy http://127.0.0.1:7890
$ netsh winhttp set proxy 127.0.0.1:7890
$ set HTTP_PROXY=http://127.0.0.1:7890 
$ set HTTPS_PROXY=http://127.0.0.1:7890 

# 取消代理如下操作
$ git config --global --unset http.proxy
$ git config --global --unset https.proxy
$ netsh winhttp reset proxy
$ set HTTP_PROXY=
$ set HTTPS_PROXY=

V8编译


# 直接编译
tools/dev/gm.py x64.release
# 生成VS项目
gn gen --ide=vs2022 out/vs

字符处理


定义一个MBCS字符数组:char arr[LEN];或者CHAR arr[LEN];

定义一个MBCS字符指针:char *p;或者LPSTR p;

定义一个MBCS常量字符串指针:const char * cp;或者LPCSTR cp;

定义一个MBCS常量字符串:cp=”Hello World!\n”;

如果使用Unicode字符集一般这么写:

定义一个Unicode字符数组:wchar_t arr[LEN];或者WCHAR arr[LEN];

定义一个Unicode字符指针:wchar_t *p;或者LPWSTR p;

定义一个Unicode常量字符串指针:const wchar_t * cp;或者LPCWSTR cp;

定义一个Unicode常量字符串:cp=L”Hello World!\n”;

一般字符集和串操作离不开。

如果对MBCS字符串连接、复制、比较、求长运算为:strcat、strcpy、strcmp、strlen。

如果对Unicode字符串连接、复制、比较、求长运算为:wcscat、wcscpy、wcscmp、wcslen。

对于相应的字符集定义和串操作如下:

定义一个字符数组:TCHAR arr[LEN];

定义一个字符指针:LPTSTR p;

定义一个常量字符串指针:LPCTSTR cp;

定义一个常量字符串:cp=_T(”Hello World!\n”);

连接、复制、比较、求长运算为:_tcscat、_tcscpy、_tcscmp、_tcslen。

这里的TCHAR不是一个新的类型,它是根据UNICODE宏来自动映射为char和wchar_t,相应的LPTSTR、LPCTSTR、_T()宏亦是如此。

将上述的宏定义抽象出来如下:

#ifdef UNICODE
    typedef wchar_t WACHR,TCHAR;
    typedef wchar_t *LPWSTR,*LPTSTR;
    typedef const wchar_t *LPCWSTR,*LPCTSTR;
    #define _T(x) L ## x
    #define _tcscat wcscat
    #define _tcscpy wcscpy
    #define _tcscmp wcscmp
    #define _tcslen wcslen#
else
    typedef char CHAR,TCHAR;
    typedef char *LPSTR,*LPTSTR;
    typedef const char *LPCSTR,*LPCTSTR;
    #define _T(x) x
    #define _tcscat strcat
    #define _tcscpy strcpy
    #define _tcscmp strcmp
    #define _tcslen strlen
#endif 

因此,使用TCHAR代替已有的字符、串定义、操作可以完成字符集处理的统一和通用化。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值