2020年5月3日
MD5 Algorithm 一个最小的MD5算法(md5.c) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 #include <stdint.h> void md5_compress(uint32_t state[static 4], const uint8_t block[static 64])……
阅读全文
2020年5月2日
Open schools first Open schools first……
阅读全文
2020年5月1日
Dynamic Programming 1. 最长上升子序列 1 2 3 4 5 6 7 8 9 10 11 12 class Solution: def lengthOfLIS(self, nums: List[int]) -> int: if len(nums) == 0: return 0 dp = [1] * len(nums) L = len(nums) for i in range(L): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j]+1) return max(dp) 2. 最长公共子序列 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: L1, L2 = len(text1), len(text2) dp = [[0] * (L1+1) for _ in range(L2+1)] for i in range(1, L2+1): for j in range(1, L1+1): if text2[i-1] == text1[j-1]: dp[i][j] = dp[i-1][j-1] + 1 else: dp[i][j] = max(dp[i-1][j], dp[i][j-1]) return dp[-1][-1] 3. 三角形最小路……
阅读全文
2020年4月30日
命令行的艺术 bg, fg and CTRL+Z ssh-add, ssh-agent ls -i描述符, df -i个数 dig grep -i, -v, -o, -A, -B, -C xargs pgrep, pkill lsof here documents python -m http.server 7777 128限制 ag wc, tee awk, sed, grep httpie ncdu awk sw_vers BASH ${#varname} ${varname:offset:length} ${variable#pattern} ${variable##pattern} ${path##*/} ${variable/#pattern/string} ${file%.png}.jpg ${varname^^} ${varname,,} shell $0 脚本文件名 $1 对应脚本的第一个参数 $# 参数的总数 $@ 全部的参数 read 1 2 3 4 5 6 filename='/etc/hosts' while read myline do echo "$myline" done < $filename IFS 1 2 3 4 5 input="/path/to/txt/file" while IFS= read -r line do echo "$line" done < "$input" 上面的命令可以逐……
阅读全文
2020年4月25日
再次思考深度学习框架的自动求导 刚开始读研的时候,对Pytorch以及Tensorflow的反向求导机制非常感兴趣,于是寻找了大量的资料去了解反向求导的机制。2017年华盛顿大学有一门课程非常棒dlsys,第一个实验关于自动求导,第二个实验关于将自动求导的矩阵计算使用GPU来操作。……
阅读全文
2020年4月24日
After the disease, the debt 目前的政治家对新冠以后的世界还没有做好准备。……
阅读全文
2020年4月11日
The coronavirus crisis will change the world of commerce ……
阅读全文
2020年4月10日
Pytorch Distributed Training Distributed data parallel training in Pytorch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 import os from datetime import datetime import argparse import torch.multiprocessing as mp import torchvision import torchvision.……
阅读全文
2020年4月7日
CASPP 第三章课后习题解答 3.58 一个函数的原型为 1 long decode2(long x, long y, long z); GCC产生的汇编代码为 1 2 3 4 5 6 7 decode2: subq %rdx, %rsi imulq %rsi, %rdi movq %rsi, %rax salq $63, %rax sarq $63, %rax xorq %rdi, %rax 参数x、y、z通过寄存器%rdi、%rsi和%rdx传递。代码将返回值存放在寄存器%rax中。写出等价于上述汇编代码的C代码。 1 2 3 4 5 6 7 8 int decode(int x, int y,……
阅读全文