blog's People
blog's Issues
学会看日志
less /var/log/example.log
G 跳转到最后一行
g跳转到第一行
/pattern 搜索
n下一个匹配
N上一个匹配
figue 浮动参数
These are optional parameters to fine tune the placement of tables and figures, with the following meaning:
h, here
t, top
b, bottom
p, page of float
and LaTeX will try to honour the placement with respect to the actual place, the top or bottom of the page, or a separate page of floats coming immediately after the present insertion point. For example, when using ht LaTeX will try to put the figure at the insertion point, then on the top of the next page if it happens to violate its typesetting rules. You may also force LaTeX to "insist" on these specifications by adding an exclamation mark (!) before the placement parameters, e.g. \begin{figure}[!htb]
Why do we use “./” to execute a file?
将路径 加入到环境变量 $PATH就行了
In Linux, UNIX and related operating systems, . denotes the current directory. Since you want to run a file in your current directory and that directory is not in your $PATH, you need the ./ bit to tell the shell where the executable is. So, ./foo means run the executable called foo that is in this directory.
You can use type or which to get the full path of any commands found in your $PATH.
常用sed命令
sed -n '/Degree/p' reosys-bit.log >> reosys-bit.loge
打印出reosys-bit.log中含有Degree的行,写入末尾
整数 到 补码
求n的补码
按位取反再加1
(n^((1<<n.bit_length())-1))+1
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
In unix terminology, the short answer is that:
terminal = tty = text input/output environment
console = physical terminal
shell = command line interpreter
https://unix.stackexchange.com/questions/4126/what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-con
youtube-dl常用选项
youtube-dl --write-auto-sub --sub-lang en --yes-playlist https://www.youtube.com/watch?list=PLGBLeOh9tAYOSgYk2Ev93ySUx1MXaBsX-
--write-auto-sub --sub-lang en 下载自动转换的英语字幕
--yes-playlist 下载整个playlist(注意后面链接里只有list)
ss突然不能用
less /var/log/shadowsocks.log
查看log报错信息:
报错信息:
2017-10-14 12:45:41 ERROR can not parse header
2017-10-14 12:45:41 ERROR can not parse header when handling connection from ::ffff:119.39.248.40:53953
2017-10-14 12:45:41 WARNING unsupported addrtype 247, maybe wrong password or encryption method
解决方案:
换个高端口可能会有效,比如10000以上的。
SSH Keys Authentication
https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets
公钥是锁
私钥是钥匙
客户端目录~/.ssh/
id_rsa 私钥
id_rsa.pub 公钥
服务端目录~/.ssh/authorized_keys 公钥列表
服务端配置/etc/ssh/sshd_config
sudo及su -的使用
sudo的工作过程如下:
1,当用户执行sudo时,系统会主动寻找/etc/sudoers文件,判断该用户是否有执行sudo的权限(使用visudo命令 修改)
2,确认用户具有可执行sudo的权限后,让用户输入用户自己的密码确认(su是输入root密码)
3,若密码输入成功,则开始执行sudo后续的命令
4,root执行sudo时不需要输入密码(eudoers文件中有配置root ALL=(ALL) ALL这样一条规则)
5,若欲切换的身份与执行者的身份相同,也不需要输入密码
su 用户名 (切换用户)
su与su -的区别是前者保留环境变量,后者重置
https://unix.stackexchange.com/questions/7013/why-do-we-use-su-and-not-just-su
if __name__ == '__main__':
作为主程序的时候 执行
其他人调用你的模块,使用其中的函数时 不执行
https://stackoverflow.com/questions/419163/what-does-if-name-main-do
汇编语言与CPU指令集
每一种特定的汇编语言和其特定的机器语言指令集是一一对应的
使用汇编语言编写的源代码,然后通过相应的汇编程序将它们转换成可执行的机器代码。这一过程被称为汇编过程。
计算机存储形式只有0、1,这样机器码比较难记,因此汇编语言作为助记符出现了
risc是一类机器指令集,MIPS是一种典型的risc
更深入一点,机器指令->微指令->微命令(微操作-对应一个信号来控制硬件)
ccd 交通规划
//
// main.cpp
// demo
//
// Created by King_Jane on 2017/3/13.
// Copyright © 2017年 King_Jane. All rights reserved.
//
#include<cstdio>
#include<queue>
#include<vector>
#define MAXN 100005
#define INF 0x7fffffff
int n,m;
using namespace std;
struct Point
{
int u;
int dist;
Point(int uu,int d){
u=uu,dist=d;
}
//优先队列 ,按dist从小到大
bool operator < (const Point &a) const {
return dist > a.dist;
}
};
struct Edge
{
int v;
int cost;
Edge(int vv,int c){
v=vv,cost=c;
}
};
vector<Edge> G[MAXN];
bool vis[MAXN];
int disto[MAXN];
int costo[MAXN];
void Dijkstra(int s)
{
//源是1
for(int i=1;i<=n;i++){
// 初始化 都没访问,dist都是最大
vis[i]=false;
disto[i]=costo[i]=INF;
}
disto[s]=0;
costo[s]=0;
priority_queue<Point> queue;
queue.push(Point(s,0));
while(!queue.empty()){
Point p=queue.top();//选择dist最小的点
queue.pop();
int u=p.u;
if(!vis[u]){ //没有在集合S中
for(int i=0;i<G[u].size();i++){//遍历u相邻的点
int v=G[u][i].v;
int co=G[u][i].cost;
if(!vis[v]){ //没有在S中
if(disto[v]>disto[u]+co){
disto[v]=disto[u]+co;//更新dist
queue.push(Point(v,disto[v]));
costo[v]=co;
}
if(disto[v]==disto[u]+co){
costo[v]=min(costo[v],co);//贪心,相同,选择这一段最小的
}
}
}
}
vis[u]=true;
}
}
int main()
{
int u,v,c;
scanf("%d%d",&n,&m);
while(m--){
//邻接表 存储图
scanf("%d%d%d",&u,&v,&c);
G[u].push_back(Edge(v,c));
G[v].push_back(Edge(u,c));
}
Dijkstra(1);
int ans=0;
for(int i=2;i<=n;i++)
ans+=costo[i];
printf("%d",ans);
}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.