Mac strafe
2022年年末的时候,我获得了我的第一台MacBook Pro。
只有可怜的8 Cores和16GB RAM
到手折腾了差不多两个星期,加上一点点学习成本,算是凑齐了用的还算舒服的布局。
Prerequisite: Security
安全是一切的重中之重,关闭SIP对于系统安全性的削弱是无可置疑的,但是出于某些软件的使用便利,我选择降低安全性(停用)。
关机状态下按住command+R启动直到进度条出现,选择恢复模式,选择实用工具,输入csrutil disable
, 回车重启。
Utilities
包管理器:Homebrew。无定制配置。可选Macports但是没试过。
代理工具:Stash,默认配置,设置iCloud云同步配置文件,默认发行版本。
浏览器:Google Chrome, Arc Browser以及专用开发的ungoogled chromium
邮件:Apple邮件,默认配置
远程桌面:ParSec,默认配置
DevEnv
终端模拟器:Alacritty,modified icon,配色文件,位于 /Users/<username>/.config/alacritty/
Powerline字体: Hack Nerd
Shell:Zsh,安装Oh-My-Zsh,主题选择 021011
;
安装Z-Plugins:
plugins=(git
macos
thefuck
zsh-autosuggestions
zsh-syntax-highlighting
autojump
mac-zsh-completions
)
安装The fuck,绑定双击ESC触发;
安装eza,zshrc中加入
alias ls="eza --color=always --icons=always --long"
;
安装Zinit。
终端复用器:TMUX
配置过程极其繁琐并且已迭代若干版本。核心功能:Tmux Plugin Manager
/ Tmux Continuum / T Resurrect / tmux-copycat
Mac on
Mac产品线一直有一种神秘的吸引力,它有巨大的历史包袱,每个路过的PC玩家都会向它吐一口口水,因为他是性能孱弱的花瓶,烧熊掌的铁板,高昂的售价和及其扭曲的配置构成一个神秘的城堡,但是几乎所有从在堡垒里的人都会说这玩意真不赖,嘴里念着离电性能和Unix兼容性、便利的程序开发环境等等玄乎其玄的经文。2020年苹果开始将Mac产品线全面转型ARM指令集架构,它的高功耗比才终于让我有理由花重金购入体验一番。
8GB运存?伙计你在开玩笑吧
是的没错,这正是达特利版本的M1 Mac mini,也是我的第一台Mac,看着我手头的其他设备迭代了四五次,而他依然稳坐头把交椅,静静的待在桌上偷吃电力和灰尘。
一开始给他的定位是做iOS的逆向开发,所以安装了Xcode和一些必要组件,结果256G的小硬盘没一会就满了。格机了两三次后现在只好让它安心的当家用服务器和路由器使用。
终端使用默认终端,默认描述文件,安装ohmyzsh,一切默认。
目前只负责处理代理流量转发和局域网文件服务器。
@rnatlance203 在 C++中流重载使用方法 中说:
还有个问题,就是如果私有或者受保护成员是字符串或者数组的话怎么整
(史前大坑)
我发现我就是个人才,就算挖坑都不会把自己坑到
class blu {
protected:
char s[100];
char c[100];
char p;
public:
blu() {
strcpy(s, "fsk");
strcpy(c, "fkb");
p = 'z';
}
~blu() {
}
friend istream & operator>>(istream & in, blu &cu) {
in >> cu.s >> cu.c >> cu.p;
return in;
}
friend ostream & operator<<(ostream & out, blu &cu) {
out << cu.s << '\t' << cu.c << '\t' << cu.p;
return out;
}
};
这不是跟上面的整型变量一样了吗 成员函数都不用写了,爽死
@rnatlance203 在 C++中流重载使用方法 中说:
还可以拓展一下 虽然用了臭名昭著的goto,(但是)对于这种规模的东西也没必要上那些高端操作
其实就是偷懒
codelist_2.cpp// codelist_2.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include<iostream> #include<iomanip> #include<fstream> #include<string> #include<stdlib.h> #include<set> using namespace std; class type { protected: int str1; int str2; int str3; public: type() { str1 = 0, str2 = 0, str3 = 0; } ~type() {}; friend istream & operator>>(istream & in, type &cu ) { in >> cu.str1 >> cu.str2 >> cu.str3; return in; } friend ostream & operator<<(ostream & out, const type &st) { out << st.str1 << st.str2 << st.str3 << endl; return out; } int getstr1() { return str1; } int getstr2() { return str2; } int getstr3() { return str3; } }; void readFile() { type type0; ifstream fkb("fkb.txt"); fkb >> type0; cout << type0 << endl; fkb.close(); } void writeFile() { type type0; ofstream fkb("fkb.txt"); cin >> type0; fkb << type0 << endl; fkb.close(); } int main() { int choice; MAIN: { system("cls"); cout << "1=read/2=write/0=exit" << endl; cin >> choice; if (choice == 1) goto READ; else { if (choice == 2) goto WRITE; else return 0; } } READ: { readFile(); system("pause"); goto MAIN; } WRITE:{ writeFile(); system("pause"); goto MAIN; } return 0; }
我是不知道我拓展了个什么玩意,我只知道大半夜很容易出错
函数void readFile()
只能读第一行而且会把所有数据连在一起,一眼就能看出;
函数void writeFile()
写入的时候会把所有数据都连在一起,再读取的话就gg;
修复的方法也很简单
//在class type里的插入流重载中--------------------
friend ostream & operator<<(ostream & out, blu &cu) {
out << cu.s << '\t' << cu.c << '\t' << cu.p;
return out;
}
//-----------------------------------------------
void readFile() {
char str[100];
ifstream fkb("fkb.txt");
while (fkb.getline(str, 100)) {
cout << str << endl;
}
}
void writeFile() {
type type0;
ofstream fkb("fkb.txt", ios::app);
cin >> type0;
fkb << type0 << endl;
fkb.close();
}
还可以拓展一下 虽然用了臭名昭著的goto,(但是)对于这种规模的东西也没必要上那些高端操作其实就是偷懒
codelist_2.cpp
// codelist_2.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
#include<stdlib.h>
#include<set>
using namespace std;
class type
{
protected:
int str1;
int str2;
int str3;
public:
type() {
str1 = 0, str2 = 0, str3 = 0;
}
~type() {};
friend istream & operator>>(istream & in, type &cu ) {
in >> cu.str1 >> cu.str2 >> cu.str3;
return in;
}
friend ostream & operator<<(ostream & out, const type &st) {
out << st.str1 << st.str2 << st.str3 << endl;
return out;
}
int getstr1() {
return str1;
}
int getstr2() {
return str2;
}
int getstr3() {
return str3;
}
};
void readFile() {
type type0;
ifstream fkb("fkb.txt");
fkb >> type0;
cout << type0 << endl;
fkb.close();
}
void writeFile() {
type type0;
ofstream fkb("fkb.txt");
cin >> type0;
fkb << type0 << endl;
fkb.close();
}
int main() {
int choice;
MAIN: {
system("cls");
cout << "1=read/2=write/0=exit" << endl;
cin >> choice;
if (choice == 1) goto READ;
else
{
if (choice == 2) goto WRITE;
else return 0;
}
}
READ: {
readFile();
system("pause");
goto MAIN;
}
WRITE:{
writeFile();
system("pause");
goto MAIN;
}
return 0;
}