可爱小蛇

可爱可爱小小蛇

【补档】Stanford CS106B: Programming Abstractions

2021-08-17

自做Assignment合集: https://github.com/suchacutesnake/cs106b-assn/tree/master/cppEditedFiles 上学期做的,整门课程花了我122.5h,然后看了看别人的作业代码,发现我的代码从风格到逻辑都完全跟别人不在一个层次上……实在是太菜了……

其实把作业贴上GitHub是不是不太好,相当于给别人抄作业提供了途径,有违教授们认认真真留作业的精神……但是当时做完真的太兴奋了直接就传上去了,以后写lab和作业尽量只在自己blog上发吧……

csapp assembly language quick reference

2021-08-14

Machine-Level Representation

Data Formats

Accessing information

  • Operand Specifiers
  • Data Movement Instructions

Arithmetic and Logical Operations

  • Load Effective Address The load effective address instruction leaq is actually a variant of the movq in- struction. It has the form of an instruction that reads from memory to a register, but it does not reference memory at all. Its first operand appears to be a mem- ory reference, but instead of reading from the designated location, the instruction copies the effective address to the destination. We indicate this computation in Figure 3.10 using the C address operator &S. This instruction can be used to gener- ate pointers for later memory references. In addition, it can be used to compactly describe common arithmetic operations. For example, if register %rdx contains value x, then the instruction leaq 7(%rdx,%rdx,4), %rax will set register %rax to 5x + 7. Compilers often find clever uses of leaq that have nothing to do with effective address computations. The destination operand must be a register.
  • Unary and Binary Operations
  • Shift Operations So, for example, when register %cl has hexadecimal value 0xFF, then instruction salb would shift by 7, while salw would shift by 15, sall would shift by 31, and salq would shift by 63.
  • Special Arithmetic Operations

Control

  • Condition Codes Comparison and test instructions.
  • Accessing the Condition Codes
  • Jump Instructions
  • Implementing Conditional Branches with Conditional Control Disadvantage: a misprediction can incur a serious penalty, say, 15–30 clock cycles of wasted effort, causing a serious degradation of program performance.
  • Implementing Conditional Branches with Conditional Moves Each of these instructions has two operands: a source register or memory location S, and a destination register R.
  • Loops jump to middle and guarded do

Procedures

  • The Run-Time Stack

CMU15-213 Lab1~3: data, bomb, attack

2021-08-10

最强小白级参考,包办环境搭建等问题

1.Data Lab

非常详细的解析 7月26日开始,8月10日凌晨2点结束,历经36.5小时的努力,我完成了第一个lab。看书、看视频,然后一题也不会做,想个个把小时的,然后看思路,再想个把小时,做出来就开心,做不出来就耻辱看答案。 浮点数真的很难,分类讨论的精髓我感觉自己还是没掌握。有关浮点数的三道题都是无法完全独立完成。 中途做出一些题目的时候感觉特别兴奋,但是全部做完以后好像没那么兴奋了。我还是感觉学得太慢,却又明明学得很辛苦。 那么,今后继续努力吧。

        ➜  datalab-handout ./btest -T 20
        Score   Rating  Errors  Function
         1      1       0       bitXor
         1      1       0       tmin
         1      1       0       isTmax
         2      2       0       allOddBits
         2      2       0       negate
         3      3       0       isAsciiDigit
         3      3       0       conditional
         3      3       0       isLessOrEqual
         4      4       0       logicalNeg
         4      4       0       howManyBits
         4      4       0       floatScale2
         4      4       0       floatFloat2Int
         4      4       0       floatPower2
        Total points: 36/36
        ➜  datalab-handout ./dlc -e bits.c 
        dlc:bits.c:147:bitXor: 7 operators
        dlc:bits.c:156:tmin: 1 operators
        dlc:bits.c:170:isTmax: 6 operators
        dlc:bits.c:188:allOddBits: 7 operators
        dlc:bits.c:200:negate: 2 operators
        dlc:bits.c:218:isAsciiDigit: 9 operators
        dlc:bits.c:230:conditional: 8 operators
        dlc:bits.c:243:isLessOrEqual: 14 operators
        dlc:bits.c:257:logicalNeg: 6 operators
        dlc:bits.c:312:howManyBits: 67 operators
        dlc:bits.c:371:floatScale2: 12 operators
        dlc:bits.c:409:floatFloat2Int: 15 operators
        dlc:bits.c:432:floatPower2: 10 operators
//1
/* 
 * bitXor - x^y using only ~ and & 
 *   Example: bitXor(4, 5) = 1
 *   Legal ops: ~ &
 *   Max ops: 14
 *   Rating: 1
 */
int bitXor(int x, int y) {
  return ~(~x & ~y) & ~(x & y);
}
/* 
 * tmin - return minimum two's complement integer 
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 4
 *   Rating: 1
 */
int tmin(void) {
  return 0x1<<31;
}
//2
/*
 * isTmax - returns 1 if x is the maximum, two's complement number,
 *     and 0 otherwise 
 *   Legal ops: ! ~ & ^ | +
 *   Max ops: 10
 *   Rating: 1
 */
int isTmax(int x) {
  //returns 1 if x == 0x7fff ffff
  int y = x + 1; // y == 0x8000 0000, y + y == 0
  //but y != 0
  return !(y + y) & !!y;
}
/* 
 * allOddBits - return 1 if all odd-numbered bits in word set to 1
 *   where bits are numbered from 0 (least significant) to 31 (most significant)
 *   Examples allOddBits(0xFFFFFFFD) = 0, allOddBits(0xAAAAAAAA) = 1
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 12
 *   Rating: 2
 */
int allOddBits(int x) {
  int y = 0xaa;
  //printf("%x\n",y);
  y = y + (y<<8);
  //printf("%x\n",y);
  y = y + (y<<16);
  //printf("%x\n",y);
  //y = 0xaaaaaa
  return !((x & y) ^ y);
}
/* 
 * negate - return -x 
 *   Example: negate(1) = -1.
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 5
 *   Rating: 2
 */
int negate(int x) {
  //x=0x00000002 == 2
  //y=0xfffffffe == -2
  return ~x + 1;
}
//3
/* 
 * isAsciiDigit - return 1 if 0x30 <= x <= 0x39 (ASCII codes for characters '0' to '9')
 *   Example: isAsciiDigit(0x35) = 1.
 *            isAsciiDigit(0x3a) = 0.
 *            isAsciiDigit(0x05) = 0.
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 15
 *   Rating: 3
 */
int isAsciiDigit(int x) {
  //0x30 == 0011 0000
  //0x39 == 0011 1001
  //x - 0x39 - 1 < 0 && 0x30 - x - 1 < 0
  //printf("\n前项=   %x\n",(x+~0x39)>>31);
  //printf("后项=   %x\n",(0x30+~x)>>31);
  return !!(((x+~0x39)>>31) & ((0x30+~x)>>31));
}
/* 
 * conditional - same as x ? y : z 
 *   Example: conditional(2,4,5) = 4
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 16
 *   Rating: 3
 */
int conditional(int x, int y, int z) {
  // ~!x = 0xffffffff(x == 1) or 0x00000000(x == 0)
  x = (~!!x) + 1;
  return (x & y) | (~x & z);
}
/* 
 * isLessOrEqual - if x <= y  then return 1, else return 0 
 *   Example: isLessOrEqual(4,5) = 1.
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 24
 *   Rating: 3
 */
int isLessOrEqual(int x, int y) {
  int xs = x>>31, ys = y>>31;//0xffffffff or 0x00000000
  //      x<0,y>0            y-x>=0         not x>0,y<0
  return (xs & !ys) | (!((y + ~x + 1)>>31) & !((!xs) & ys));
  //Hooooooooooraaaaaaaay!!!!
}
//4
/* 
 * logicalNeg - implement the ! operator, using all of 
 *              the legal operators except !
 *   Examples: logicalNeg(3) = 0, logicalNeg(0) = 1
 *   Legal ops: ~ & ^ | + << >>
 *   Max ops: 12
 *   Rating: 4 
 */
int logicalNeg(int x) {
  //logicalNeg(0) = 1, logicalNeg(others) = 0
  //compare sign before and after neg
  return ((x>>31) | ((~x + 1)>>31)) + 1;
}
/* howManyBits - return the minimum number of bits required to represent x in
 *             two's complement
 *  Examples: howManyBits(12) = 5
 *            howManyBits(298) = 10
 *            howManyBits(-5) = 4
 *            howManyBits(0)  = 1
 *            howManyBits(-1) = 1
 *            howManyBits(0x80000000) = 32
 *  Legal ops: ! ~ & ^ | + << >>
 *  Max ops: 90
 *  Rating: 4
 */
int howManyBits(int x) {
  //printf("\n\nthis time, x = %x\n", x);
  int b16, b8, b4, b2 ,b1;
  //the sign of x, equals 1 if x >= 0
  int xs = !(x>>31);
  
  //the next two lines imply
  //x = xs? x : (~x)
  int temp = (~!!xs) + 1;
  x = (temp & x) | (~temp & (~x));
  
  xs = 1;
  //if x == 0 then make xs == 0
  xs = xs & !!x;

  //printf("x=%x, %d\n", x, x);
  
  b16 = !!(x>>16);
  temp = ~b16 + 1;//b16==0,temp=0;b16==1,temp=0xffffffff
  x = (~temp & x) | (temp & (x>>16));//if b16==1 then x=x>>16
  //printf("x=%x, %d\n", x, x);
  b8 = !!(x>>8);
  temp = ~b8 + 1;
  x = (~temp & x) | (temp & (x>>8));
  
  //printf("x=%x, %d\n", x, x);
  b4 = !!(x>>4);
  temp = ~b4 + 1;
  x = (~temp & x) | (temp & (x>>4));
  
  //printf("x=%x, %d\n", x, x);
  b2 = !!(x>>2);
  temp = ~b2 + 1;
  x = (~temp & x) | (temp & (x>>2));
  
  //printf("x=%x, %d\n", x, x);
  b1 = !!(x>>1);
  
  //printf("x=%x, %d\n", x, x);
  //int a = (b16<<4) + (b8<<3) + (b4<<2) + (b2<<1) + b1;
  //printf("a = %d\n%d%d%d%d%d%d\n", a,b16,b8,b4,b2,b1,xs);
  return (b16<<4) + (b8<<3) + (b4<<2) + (b2<<1) + b1 + 1 + xs;
}
//float
/* 
 * floatScale2 - Return bit-level equivalent of expression 2*f for
 *   floating point argument f.
 *   Both the argument and result are passed as unsigned int's, but
 *   they are to be interpreted as the bit-level representation of
 *   single-precision floating point values.
 *   When argument is NaN, return argument
 *   Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while
 *   Max ops: 30
 *   Rating: 4
 */
unsigned floatScale2(unsigned uf) {
  //start implementation
  //float: 1s 8exp 23frac, exp=E+Bias, Bias=127
  //(-1)^s * frac * 2^E
  //int s = uf>>31;//0xffffffff(neg) or 0(pos)
  //这题抄的
  unsigned sign = uf & 0x80000000u;
  unsigned exp = uf & 0x7f800000;
  unsigned frac = uf & 0x007fffff;
  //INF and NaN
  if(exp == 0x7f800000) {
    return uf;
  }
  //denormalized nums and 0
  if(!exp) {
    return sign | uf<<1;
  }
  exp += 1<<23;
  //add to +INF
  if(exp == 0x7f800000) {
    frac = 0;
  }
  return sign | exp | frac;



  // printf("\n\nuf = %x\n", uf);
  // int frac = uf<<8;
  // printf("frac = %x\n", frac);
  // frac = frac>>8;//0(sign) 00000000(exp) frac or 1 11111111 frac
  // printf("frac = %x\n", frac);
  // int exp = uf>>23;//0 exp or 1 exp
  // if(exp>>8) { //clear sign bit
  //   exp += 0xffffff00;//now exp = 0 exp
  // }
  // printf("exp = %x\n", exp);
  // //to make frac = 0 00000000 frac
  // if(frac>>23 && exp) { //exp!=0
  //   frac += (1<<23);
  //   printf("if(frac>>23) frac = %x\n", frac);
  // }
  // //if exp!=0 then exp+=1
  // if(exp) {
  //   frac += (1<<23);
  //   printf("if(exp) frac = %x\n", frac);
  // }
}
/* 
 * floatFloat2Int - Return bit-level equivalent of expression (int) f
 *   for floating point argument f.
 *   Argument is passed as unsigned int, but
 *   it is to be interpreted as the bit-level representation of a
 *   single-precision floating point value.
 *   Anything out of range (including NaN and infinity) should return
 *   0x80000000u.
 *   Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while
 *   Max ops: 30
 *   Rating: 4
 */
int floatFloat2Int(unsigned uf) {
  //这题基本是抄的
  //float: 1s 8exp 23frac, exp=E+Bias(normalized)
  //E=1-bias(denormalized, exp=0), Bias=127
  //(-1)^s * frac * 2^E
  //NaN:exp=0xff,frac!=0;infinity:exp=0xff,frac==0
  unsigned sign = uf>>31;
  unsigned exp = uf & 0x7f800000;
  unsigned frac = (uf & 0x007fffff) + 0x00800000;
  int res;
  //printf("\nexp = %x\n", exp);
  int E = (exp>>23) - 127;
  //printf("E = %x, %d\n", E,E);
  if(E < 0) {
    return 0;
  }
  if(E > 31) {
    return 0x80000000u;
  }
  if(E < 23) {
    res = frac>>(23 - E);
  } else {
    res = frac<<(E - 23);
  }
  return sign ? (~res + 1) : res;
}
/* 
 * floatPower2 - Return bit-level equivalent of the expression 2.0^x
 *   (2.0 raised to the power x) for any 32-bit integer x.
 *
 *   The unsigned value that is returned should have the identical bit
 *   representation as the single-precision floating-point number 2.0^x.
 *   If the result is too small to be represented as a denorm, return
 *   0. If too large, return +INF.
 * 
 *   Legal ops: Any integer/unsigned operations incl. ||, &&. Also if, while 
 *   Max ops: 30 
 *   Rating: 4
 */
unsigned floatPower2(int x) {
  //min denorm:0 00000000 00...1 = 2^(1-127-23), E=-149
  if(x<-149) return 0;
  //max denorm:0 00000000 10...0 = 2^(1-127-1), E=-127
  if(x<=-127) return 1<<(x+149);
  //max norm:0 11111110 00...0 = 2^(2^8-2-127), E=127
  if(x<=127) return (x+127)<<23;
  //if(x>127)
  return 0xff<<23;
}

2.Bomb Lab

(Aug 14)Unfortunate start…

大三上力扣合集

2021-07-23

速记

2021-11-17 09:22:16 星期三 数据范围与时间复杂度:https://www.acwing.com/blog/content/32/ 2021-09-12 13:17:51 星期日

11. 盛最多水的容器

2021.7.23 头一回写出比参考答案更优的解法,非常兴奋。 https://leetcode-cn.com/problems/container-with-most-water/comments/1042336 提交记录

19. 删除链表的倒数第n个结点

2021.7.25 这位老哥真的太秀了 https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/comments/229867

2021.8.29 打了256周周赛,easy都做不出来,自闭了……花了一个多小时才发现第一题第二题都理解错了,第一题好长时间都没理解k有什么用,第二题做了老半天才发现nums是个string的vector而不是int,这名字起得真坑……最后半个小时一通操作猛如虎,全是解答错误……真的跪了orz,我不会真这么菜吧……?

49.Group Anagrams

全新的题型。两个需要注意的点,for each循环和map中的it->second使用。

  • for each
int my_array[5] = { 1, 2, 3, 4, 5 };

// 不会改变 my_array 数组中元素的值
// x 将使用 my_array 数组的副本
for (int x : my_array)
{
    x *= 2;
    cout << x << endl;
}

// 会改变 my_array 数组中元素的值
// 符号 & 表示 x 是一个引用变量,将使用 my_array 数组的原始数据
// 引用是已定义的变量的别名
for (int& x : my_array)
{
    x *= 2;
    cout << x << endl;
}

// 还可直接使用初始化列表
for (int x : { 1, 2, 3, 4, 5 })
{
    x *= 2;
    cout << x << endl;
}

- it->second

std::map<X, Y>实际储存了一串std::pair<const X, Y>

bilibili转播YouTube节目

2021-05-16

Typecho的编辑器居然是靠缩进来识别格式,我非常不习惯,排版很烂,请见谅。

条件

  1. 国外vps一台 我是用的是vultr的服务器,最低配版(但不能只支持IPv6!)。
  2. 国内vps一台 我看了挺多,最后用的腾讯云学生版,最低配,带宽5M。
  3. 拥有一定Linux知识或者懂得Google

原理

  请参考: https://github.com/LetMeDecay/bilibili_live_foreign_stream_solution

  问题关键在于绕开bilibili对国外流的限制,而这位前辈给出的解决方案虽然是国外直播到bilibili,但我们其实完全可以拿来用。   我这里的逻辑是: [youtube] -> [vultr] -> [TencentServer] -> [bilibili]

配置

  • 1.配置国外vps
  • 1.1安装NGINX+rtmp

  我的是centos7,但是似乎Debian会好用很多,在安装NGINX和rtmp时,Debian似乎一行就能解决,但centos需要编译安装,非常的麻烦。   https://www.howtoforge.com/tutorial/how-to-install-nginx-with-rtmp-module-on-centos/   这里做完step4就可以,由于我们不需要像前文那样反复在服务器之间推流,所以这一步rtmp的配置完全可以免去。

  出问题多Google。

  • 1.3安装youtube-dl

  不记得是怎么装的了,这就意味着这没太大麻烦,请自行Google。

  • 2.配置国内vps

  依旧是centos7,安装ffmpeg后,照做1.1到step5,但是链接里面config的配置这样写(vim nginx.conf以后,i进入编辑模式,文档底部会出现insert,然后把下面这部分编辑好复制进去,esc,输入:wq!保存更改,或输入:q!放弃更改):

    worker_processes  auto;
    events {
        worker_connections  1024;
    }
    
    # RTMP configuration(这是唯一需要改的部分)
    rtmp {
        server {
                listen 1935;#保持默认
                chunk_size 128; 
    
                application testmusic {#testmusic是我随便起的应用名
                    live on;
                    exec_push ffmpeg -i rtmp://127.0.0.1:1935/testmusic -c copy -f flv rtmp://live-push.bilivideo.com/live-bvc/[你的直播码];#ffmpeg参数可调
                }
        }
    }
    http {
        sendfile off;
        tcp_nopush on;
        aio on;
        directio 512;
        default_type application/octet-stream;
    
        server {
            listen 8080;
    
            location / {
                # Disable cache
                add_header 'Cache-Control' 'no-cache';
    
                # CORS setup
                add_header 'Access-Control-Allow-Origin' '*' always;
                add_header 'Access-Control-Expose-Headers' 'Content-Length';
    
                # allow CORS preflight requests
                if ($request_method = 'OPTIONS') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Max-Age' 1728000;
                    add_header 'Content-Type' 'text/plain charset=UTF-8';
                    add_header 'Content-Length' 0;
                    return 204;
                }
    
                types {
                    application/dash+xml mpd;
                    application/vnd.apple.mpegurl m3u8;
                    video/mp2t ts;
                }
    
                root /mnt/;
            }
        }
    }

  在bilibili开播设置里面找到直播码:

xray: VLESS TCP XTLS + NGINX指南

2021-05-14

服务器端

首先需要有个域名,并解析向当前的服务器。 (5.15更新:这个仿佛更好)

[服务器一键脚本][2]

    [root@vultrguest ~]# bash -c "$(curl -L git.io/xray-yes)" - install
 …………………………………………………………………………………………好长一串

[+] Xray 安装成功 (VLESS+tcp+xtls+nginx)


 Xray 配置信息 
 地址 (address):  ……
 端口 (port):  ……
 用户id (UUID/密码):  ……
 流控 (flow):  xtls-rprx-direct
 SNI:  ……
 TLS:  XTLS

 分享链接: ……

 提示:您可以在 Linux 平台上使用流控 xtls-rprx-splice 以获得更好的性能。

中间失败了好几次,好像是因为重定向的问题;然后又是端口占用;这波我把stackoverflow、reddit、GitHub issue等一众网站逛了个遍,最终解决的方法居然是重启NGINX!也不知道为啥……流下没有知识的眼泪……

客户端

客户端配置指南

我只完成了iOS和macOS版。提一下有几个没说到的点,

  1. Qv2ray不能用稳定release,要用最新的beta版

  2. Qv2ray需要在preferences->kernel settings里配置v2ray core executable path(/usr/local/Cellar/xray/1.4.2/bin/xray)和v2ray assets directory(/usr/local/Cellar/xray/1.4.2/share/xray/),这里必须用到xray的文件而不是v2ray的。可能用到的命令:

    brew install xray brew ls xray //显示xray所在目录

还有,配置的时候tls settings里面sni也填上吧,毕竟给了。

半小时新建科学上网节点

2021-05-14

事实上,如果操作过一遍,只要5分钟……

  1. 部署服务器 vultr.com

  2. root

    macOS terminal ~ % ssh root@108.61.148.107 The authenticity of host ‘108.61.148.107 (108.61.148.107)’ can’t be established. ECDSA key fingerprint is SHA256:r12mF07x6odpVpU2XFuJH9Mq2HtGezlaDdjFwYG7gms. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added ‘108.61.148.107’ (ECDSA) to the list of known hosts. root@108.61.148.107’s password: Activate the web console with: systemctl enable –now cockpit.socket

  3. 直接一键脚本

    bash <(curl -sL https://s.hijk.art/v2ray.sh) 脚本说明: https://v2raytech.com/centos-one-click-install-v2ray/

  4. 配置客户端 脚本会直接配置好服务端,然后给出客户端的config.json地址,照着用就行 macOS:https://github.com/yanue/V2rayU Windows:https://github.com/2dust/v2rayN iOS:shadowrocket(需要美区Apple ID)

  5. 可供参考的网站 v2ray社区 https://www.v2fly.org/

【建站笔记】- 视频背景的引导页制作

2021-01-21

耗时3天半的心血完成了新cutesnake.top的制作,虽然还只是照搬照抄的地步,但是做到这样的效果在我眼里已经是巨大的成功了,还好中间没有放弃。

套用的模板来自Rishabh,不过他的Readme写得过于简单,对于白痴的我有种无从下手的感觉。。。本来我是想整进secretbase里面去的,但是后来发现Rishabh用的是html+JavaScript,而secretbase的sakura模板,作者用的是php+css+js,“Sakura模板里是怎么实现点击播放功能的”,这个问题我怎么都看不明白。在style.css里面只是在控制装载视频的container之类的,按理来说有关点击触发的事件应该在index.php里面有说明,但是事实上index.php里却对这部分内容只字未提。而且麻烦的是我现在用的sakurairo主题是经3个人修改得到的,而最初的作者Akina所给出的说明文档所在的网站直接就打不开了……做到这一步花了我接近两天的时间。

所以我才直接放弃了整合代码的想法,转而去设置引导页。这就简单多了,毕竟只需要把Rishabh的代码全部下载下来,稍微改改再放到网站上套用就行。

这里有一个需要注意的点就是main.js里的这一部分:

// Array of objects containing the src and type
// of different video formats to add
src: [
  {
    src: 'night.mp4',
    type: 'video/mp4'
  },
  {
    src: 'http://test1.cutesnake.top/violet2.webm',
    type: 'video/webm;codecs="vp8, vorbis"'
  }
],

src要填自己上传的视频的所在位置,别傻傻的像我一样看他填的night.mp4,我就填了violet.mp4,他那样填实际上应该是在GitHub上读取的视频。

处理视频也花了我不少功夫。为了下载b站上的视频我先是下了you-get(homebrew万岁!terminal里一行搞定),然后用handbrake转码,ffmpeg(再次homebrew万岁!)剪切视频,再传到服务器上。下面分享一些资源:

  • homebrew国内源一键安装

terminal里直接

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

只能说,感谢大佬,属实给力。没国内源速度简直就是乌龟爬。

terminal里直接

brew install you-get
brew install ffmpeg

一个字,爽! you-get指令基本上会一个you-get -i [url]足以搞定一切 ffmpeg精确裁切视频

开源视频转码器,超给力,屡试不爽(虽说ffmpeg也可以就是了,但是还是有ui界面比较舒服嘛!而且ffmpeg不知道为什么总出各种各样的问题,总之虽然强大但就是不太好用)。

【建站笔记】维护日志

2020-11-10

2020.11.10 修复了评论提醒邮件无法发出的问题:SMTP connect() failed //(Gmail太安全了 2021.1.10 维护里站评论邮件提醒功能。 2021.1.21 大幅度调整网站结构。将cutesnake.top改为视频背景的引导页,原隶属于cutesnake.top的内容转移至blog.cutesnake.top,另在secretbase中添加右下角播放视频选项。 2021.5.5 修复背景图片显示失败问题(Gitee用户名更改);添加友链。secretbase鼠标样式修改,删除花里胡哨的主题效果,添加music页面,关闭主页背景视频播放选项。 2021.8.17 添加代码高亮插件,解决点开文章刷新才能显示问题(关闭所有插件的jQuery),解决文章目录不显示问题(关闭插件editorMD的markdown解析至前台功能)。 2021.8.19 由于速度过慢体验太过不佳,放弃引导页播放视频,改为GIF,同时将秘密基地首页由大图改为GIF,大幅提升了访问速度。此外,在主视觉界面直接使用了百度图片的url,相比之前自己在Gitee或者GitHub+cdn搭建的图床,更进一步提升了访问速度。更换秘密基地配色,由紫罗兰色改为黄色基调,看着更舒服了。 2021.9.1 blog主题更新至2.0,修复不知道什么原因导致的友链报错:Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/blog.cutesnake.top/usr/themes/Cuckoo/functions.php on line 440解决方法是直接到源码里面把count($Links)改为常数10,非常暴力,因为其他的我也不会…… 2021-10-01 12:44:48 星期五 其实一直以来都非常好奇访客情况,试过种种插件,包括Typecho的access,WordPress的wp-statistic,都不尽人意。暑假末尾配置了matomo,到现在用下来,真的是非常满意。尽管配置相对麻烦一些,需要亲手为它建立数据库,并在网站相应主题的header.php或index.html或index.php文件中插入js代码,但拥有自己独立的数据库就是不一样!连访客停留了几秒,点击了什么内容都可以看到,真的老厉害了。 我这个运营一年多的博客终于开始一个星期有两三个活人来访(而不是爬虫机器人了),我流下了感动的泪水(╥﹏╥)太不容易了(╥﹏╥)。还记得去年费了好大心思把里站评论回复的提醒邮件弄得特别好看,结果根本没人来评论orz