MathJax入门

1.安装 MathJax-LaTex 插件

2. 安装本地 MathJax 服

wget https://github.com/mathjax/MathJax/archive/master.zip

unzip MathJax

sudo mv MathJax YOUR_WORDPRESS_PATH/wp-content/plugins/mathjax-latex/

sudo -R nginx:nginx YOUR_WORDPRESS_PATH/wp-content/plugins/mathjax-latex/

Mathjax语法总结

$$formula inserted here$$

α \alpha          β \beta
γ \gamma       δ \delta
ϵ \epsilon        ζ \zeta
η \eta               θ \theta
ι \iota               κ \kappa
λ \lambda        μ \mu
ν \nu                 ξ \xi
π \pi                  ρ \rho
σ \sigma           τ \tau
υ \upsilon        ϕ \phi
χ \chi                ψ \psi
ω \omega

• 如果要大写希腊字母，则首字母大写即可，如\Gamma显示为Γ \Gamma
• 有的希腊字母有几种变体，则用var区分，如\varGamma

……

Ubuntu 安装 VSFPTD

1. 安装：sudo apt-get install vsftpd
2. 修改配置文件：sudo vim /etc/vsftpd.conf
• #禁止匿名访问 anonymous_enable=NO
• #接受本地用户 local_enable=YES
• #允许上传 write_enable=YES
• #用户只能访问限制的目录 chroot_local_user=YES
• #如果使用主动模式，下面几行可以不配置
• #使用被动模式
• pasv_enable=YES
• #被动模式下端口设置
• pasv_min_port=1024
• pasv_max_port=1048
1.  创建FTP用户：sudo useradd -d /home/www -M ftpuser;  设置密码：sudo passwd ftpuser
2. 修改/etc/pam.d/vsftpd文件：sudo vim /etc/pam.d/vsftpd 注释掉 #auth required pam_shells.so
3. 关于ftp的根目录，例如www目录，vsftpd不允许ftp根目录有可执行权限，应该设置其权限为544，即rw-r-x-r-x 目录的拥有者设为www:www
4.  在ftp根目录www下创建文件夹，例如data，设置其权限为644，ftp任何上传只能到此目录下

Matlab 小结

matlab符号计算

1> syms Vs Rs Ub1 Ub2 Ub3 Uo rbe1 Cbe1 rbe2 Cbe2 RL Cc S gm1 gm2;     //定义符号变量（常量）

2> eq1 = (Vs-Ub1)/Rs + (Ub3-Ub1)*S*Cc == (Ub1-Ub2)*(1/rbe1+S*Cbe1);  eq2 = (Ub1-Ub2)*(1/rbe1+S*Cbe1+gm1) == Ub2*(1/rbe2+S*Cbe2);  eq3 = (Ub3-Ub1)*S*Cc + gm1*(Ub1-Ub2) + (Ub3-Uo)*(1/rbe2+S*Cbe2) == 0;  eq4 = (Ub3-Uo)*(1/rbe2+S*Cbe2) + gm2*(Ub3-Uo) == Uo/RL + gm2*Ub2;   //联立方程组

3>sol = solve(eq1,eq2,eq3,eq4,Ub1,Ub2,Ub3,Uo);  //指定Ub1,Ub2,Ub3,Uo为未知量，求解eq1，eq2，eq3，eq4方程组，其中输出量sol为结构体类型

4>pretty(sol.Uo)  //让输出结果易于阅读

matlab符号表达式代入（部分）常量求数值解

1> f1 = subs(sol.Uo,[Rs,rbe1,Cbe1,rbe2,Cbe2,gm1,gm2],[8.2e3,1e2,1.59e-9,1,4e-6,1,100])   //代入部分值求数值表达式

2> digits(4)   //指定整数小数位数，简化最终表达式

3> f2=vpa(f1) //输出带部分符号变量的简化表达式

matlab分离符号表达式分子分母

1> [n,d] = numden(sol.Vo);  //N:numerator 分子；D:denominator分母

2> poles = solve(d == 0,S);  //求分母的根，即系统极点

V2ray部署

1.安装，用脚本安装是最方便的。网络上有网友提供了各具特色的脚本。不过有些脚本的提示语言是中文，不但要求VPS安装了中文语言支持，也需要终端支持中文显示。譬如Bandwagonhost的网页终端就不支持中文显示，谷歌云的网页终端是支持的。

bash <(curl -s -L https://233yes.com/v2ray.sh)



location / {
proxy_redirect off; //可要可不要
proxy_pass http://127.0.0.1:8388; //也可以写成 http://localhost:8388,其中8388为V2ray监听端口号
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host$http_host;
}

3.客户端配置

M4800更换显卡之后修改显卡驱动INF信息

M4800的显卡从K1100M改为K2000M，虽然提升很少，不过喜欢折腾的人还是不放过这个机会。

PCI\VEN_10DE&DEV_0FFB&SUBSYS_15CC1028

.inf files by manufacturer
Acer & Gateway = nvaci.inf
Asus = nvami.inf
Apple = nvaoi.inf
Compal = nvcti.inf
Clevo (Sager & other re-brands) = nvcvi.inf
Dell & Alienware = nvdmi.inf
Fujitsu = nvfmi.inf
HP = nvbli.inf
HP = nvhmi.inf
LG = nvloi.inf
Lenovo = nvlti.inf
MSI = nvmii.inf
NEC = nvqni.infSiemens = nvfui.inf
Sony = nvszci.inf
Toshiba Qosmio = nvtdi.inf
Toshiba = nvtsi.inf

[Manufacturer]
%NVIDIA_A% = NVIDIA_Devices,NTamd64.10.0,NTamd64.10.0…14310,NTamd64.10.0,NTamd64.10.0…16299

[NVIDIA_Devices.NTamd64.10.0…14310]
%NVIDIA_DEV.0FF6.05CC.1028% = Section032, PCI\VEN_10DE&DEV_0FF6&SUBSYS_05CC1028
…….
%NVIDIA_DEV.0FFB.15CC.1028% = Section040, PCI\VEN_10DE&DEV_0FFB&SUBSYS_15CC1028

[NVIDIA_Devices.NTamd64.10.0…16299]
%NVIDIA_DEV.0FF6.05CC.1028% = Section032, PCI\VEN_10DE&DEV_0FF6&SUBSYS_05CC1028
…..
%NVIDIA_DEV.0FFB.15CC.1028% = Section040, PCI\VEN_10DE&DEV_0FFB&SUBSYS_15CC1028

[NVIDIA_Devices.NTamd64.10.0]
%NVIDIA_DEV.0FF6.05CC.1028% = Section031, PCI\VEN_10DE&DEV_0FF6&SUBSYS_05CC1028
…..
%NVIDIA_DEV.0FFB.15CC.1028% = Section040, PCI\VEN_10DE&DEV_0FFB&SUBSYS_15CC1028

Ubuntu 18.04 安装以及美化（转载）

1. 建议给Ubuntu三个分区，第一个分区，swap交换分区；第二个分区，/，第三个分区，/home。
2.在分区这一步，注意看最下面的引导器安装选项，选择下拉菜单中包含“windows boot manager”那一项。选择了这一项，意思是将Ubuntu引导器与Windows引导器并列安装到硬盘的UEFI分区中。这样安装完成后，计算机即可正常以UEFI方式启动并引导Windows和Ubuntu，而不对计算机产生额外的影响。默认的顺序是Windows在前，Ubuntu在后。默认进入Win10，如果要进Ubuntu，需要在开机时按下选择启动项的快捷键，然后选择Ubuntu。
3.网上有些教程过于啰嗦，甚至提到额外建立新的UEFI分区，没有必要。安装了win10 x64的系统默认都是以UEFI方式启动，UEFU分区本来就有，一般是个200M左右的分区。
4.如果你想将Ubuntu设为默认启动，只需到BIOS相关设置中修改UEFI启动的系统顺序即可。千万别去纠缠什么/boot和grub的问题，这种模式下Win和Ubuntu的启动相互独立，是平行关系，都归UEFI系统管理，要改也是改UEFI层面的设置。

sudo apt-get update

sudo apt install chrome-gnome-shell

（实际上这个东西和chrome没有任何关系）

（顺带一提，我后面卸载了这个扩展，但是Dock依然还在这里而且貌似更美观了我也不知道发生了什么）

Hide top bar 隐藏顶栏，可设置为平时隐藏鼠标放上去时显示顶栏
Gravatar 把你的Ubuntu用户头像设置成你的Gravtar
Openweather 在顶栏添加一个天气预报

Linux脚本-查找指定后缀的文件

for f in *.cue do \

FILE=“”${f#*.}“”;\ # get all after last delimiter ‘.’ mkdir “FILE”;\ mv “FILE.*” “FILE”;\ done 参考资料 1.Loop over all files in all sub-directories # show all .fasta files in all sub-directories of folder ‘assembly’ find assembly/ -name "*.fasta" assembly/projectA/run1.fasta assembly/projectA/run2.fasta assembly/projectB/run1.fasta assembly/projectB/run2.fasta assembly/final.fasta # search for ‘plasmid’ in all fasta files (run command grep on all files) in folder ‘assembly’ find assembly/ -name "*.fasta" -exec grep plasmid {} \; # compress all .fasta files using gzip, include all sub-directories of folder ‘assembly’ find assembly/ -name "*.fasta" -exec gzip {} \; General find/path/-name filter files -exec run command {} \; -name # filter filenames  -exec # run command  {} # on each file  \;# pass files one by one to the command ———————————————————————————————————— 2.STRING SPLIT Split string of variable ${FILE} by delimiter ‘_

# filename example

FILE=SRR01234_mapped_ecoli.txt

echo ${FILE%%_*} # get all before first delimiter ‘_’ SRR01234 echo${FILE%_*}   # get all before last delimiter ‘_’
SRR01234_mapped
 echo ${FILE##*_} # get all after last delimiter ‘_’ ecoli.txt  echo${FILE#*_}   # get all after first delimiter ‘_’
mapped_ecoli.txt

Basename examples

# get filename without path prefix
F=/path/to/sample/SRR01234_mapped_ecoli.txt
FILE=basename ${F}  echo${FILE}
SRR01234_mapped_ecoli.txt

# get filename without path prefix and without extension
F=/path/to/sample/SRR01234_mapped_ecoli.txt
FILENAME=basename ${F%%.*} # get all before first ‘.’ (remove file ending) echo${FILENAME}
SRR01234_mapped_ecoli
# get sample-ID
F=/path/to/sample/SRR01234_mapped_ecoli.txt
SAMPLE=basename ${F%%_*} # get all before ‘_’ echo${SAMPLE}
SRR01234

# get speciesname “ecoli”

F=/path/to/sample/SRR01234_mapped_ecoli.txt
FILENAME=basename ${F%%.*} # get all before first ‘.’ (remove file ending) SPECIES=${FILENAME##*_}  # get all after last delimiter ‘_’
echo ${SPECIES} ecoli Alternative use: cut # get first word (-f 1) based on delimiter ‘_’ FILE=SRR01234_mapped_ecoli.txt SAMPLE=$( cut -d '_' -f 1 - <<< "${FILE}" ) echo${SAMPLE}
SRR01234
—————————————————————————————————————————————

3.Loop over list of files

Run a command on each file

do something (echo) with all .txt files
for f in *.txt;  do echo ${f}; done; same, but using a pipe (reading from standard input), and a while-loop ls *.txt | while read f; do echo${f}; done;
do something with a small set of files
for f in file1.txt file2.txt file3.txt; do echo ${f}; done; file1.txt file2.txt file3.txt same, but separately defined list of files filelist="file1.txt file2.txt file3.txt" for f in${filelist}; do echo ${f}; done; reading list of files from file ‘filelist.txt’ (for larger number of files) ls *.csv > filelist.txt # define your list of files for f in cat filelist.txt; do echo${f}; done; 
if a line may include spaces better use a while loop:
cat filelist.txt | while read LINE; do echo "${LINE}"; done loop over filenames without extension, see → basename string split for f in Data/*.txt; do FILENAME=${f%%.*};  echo ${FILENAME}; done; Data/fileA .txt Data/fileB .txt loop over filenames without extension and without path prefix for f in Data/*.txt ; do FILENAME=basename${f%%.*}; echo ${FILENAME}; done Data/ fileA .txt Data/ fileB .txt exclude samples that are already processed process input files Data/*.fastq only if result-files Result/*.txt does not exist for f in Data/*.fastq; do \  SAMPLE=basename${f%%.*}; \
  if [ ! -f Results/${SAMPLE}.txt ]; then \  echo "processing sample${SAMPLE}"; \
     # do something \
  fi; \
done

# do something 10 times
for N in {1..10}; do \
   echo ${N}; \ done # double loop over a series of numbers and letters for N in {1..5}; do  for S in {A..C}; do  echo${N} ${S};  done; done;  1 A 1 B 1 C 2 A 2 B 2 C °°° general use of: if then else (-f check if normal file) if [ -f /path/to/${SAMPLE} ];
then

# do something if file exist

else
# do something if file does not exist

fi

Examples

search string ‘ABC’ in all text files
for f in *.txt ; do echo --${f}-- ; grep "ABC"${f} ; done
copy all files in filelist.txt to a newDir/
ls *.csv > filelist.txt    # define your list of files
mkdir newDir  # create the new directory
for f in cat filelist.txt; do echo copying ${f}; cp${f} newDir/; done;
add path if files are not located in working directory
for f in cat filelist.txt; do echo copying ${f}; cp path/to/files/${f} newDir/; done;

4. 单引号双引号区别

1）、单引号属于强引用，它会忽略所有被引起来的字符的特殊处理，被引用起来的字符会被原

2）、双引号属于弱引用，它会对一些被引起来的字符进行特殊处理，主要包括以下情况：

1：$加变量名可以取变量的值 ，比如： [root@localhost ~]# echo ‘$PWD’
$PWD [root@localhost ~]# echo “$PWD”

/root

2：反引号和$()引起来的字符会被当做命令执行后替换原来的字符，比如： [root@localhost ~]# echo ‘$(echo hello world)’
$(echo hello world) [root@localhost ~]# echo “$(echo hello world)”
hello world

[root@localhost ~]# echo ‘echo hello world’
echo hello world
[root@localhost ~]# echo “echo hello world”
hello world

3：当需要使用字符（$ ” \）时必须进行转义，也就是在前面加\ ； [root@localhost ~]# echo ‘$  ” \’
$ ” \ [root@localhost ~]# echo “\$ \ \” \\”
\$ ` ” \

What is dither?

To dither means to add noise to our audio signal. Yes, we add noise on purpose, and it is a good thing.

How can adding noise be a good thing??!!!

We add noise to make a trade. We trade a little low-level hiss for a big reduction in distortion. It’s a good trade, and one that our ears like.

The problem

The problem results from something Nyquist didn’t mention about a real-world implementation—the shortcoming of using a fixed number of bits (16, for instance) to accurately represent our sample points. The technical term for this is “finite wordlength effects”.

At first blush, 16 bits sounds pretty good—96 dB dynamic range, we’re told. And it is pretty good—if you use all of it all of the time. We can’t. We don’t listen to full-amplitude (“full code”) sine waves, for instance. If you adjust the recording to allow for peaks that hit the full sixteen bits, that means much of the music is recorded at a much lower volume—using fewer bits.

In fact, if you think about the quietest sine wave you can play back this way, you’ll realize it’s one bit in amplitude—and therefore plays back as a square wave. Yikes! Talk about distortion. It’s easy to see that the lower the signal levels, the higher the relative distortion. Equally disturbing, components smaller than the level of one bit simply won’t be recorded at all.

This is where dither comes in. If we add a little noise to the recording process… well, first, an analogy…

An analogy

Try this experiment yourself, right now. Spread your fingers and hold them up a few inches in front of one eye, and close the other. Try to read this text. Your fingers will certainly block portions of the text (the smaller the text, the more you’ll be missing), making reading difficult.

Wag your hand back and forth (to and fro!) quickly. You’ll be able to read all of the text easily. You’ll see the blur of your hand in front of the text, but definitely an improvement over what we had before.

The blur is analogous to the noise we add in dithering. We trade off a little added noise for a much better picture of what’s underneath.

Back to audio

For audio, dithering is done by adding noise of a level less than the least-significant bit before rounding to 16 bits. The added noise has the effect of spreading the many short-term errors across the audio spectrum as broadband noise. We can make small improvements to this dithering algorithm (such as shaping the noise to areas where it’s less objectionable), but the process remains simply one of adding the minimal amount of noise necessary to do the job.

Besides reducing the distortion of the low-level components, dither lets us hear components below the level of our least-significant bit! How? By jiggling a signal that’s not large enough to cause a bit transition on its own, the added noise pushes it over the transition point for an amount statistically proportional to its actual amplitude level. Our ears and brain, skilled at separating such a signal from the background noise, does the rest. Just as we can follow a conversation in a much louder room, we can pull the weak signal out of the noise.

Going back to our hand-waving analogy, you can demonstrate this principle for yourself. View a large text character (or an object around you), and view it by looking through a gap between your fingers. Close the gap so that you can see only a portion of the character in any one position. Now jiggle your hand back and forth. Even though you can’t see the entire character at any one instant, your brain will average and assemble the different views to put the characters together. It may look fuzzy, but you can easily discern it.

When do we need to dither?

At its most basic level, dither is required only when reducing the number of bits used to represent a signal. So, an obvious need for dither is when you reduce a 16-bit sound file to eight bits. Instead of truncating or rounding to fit the samples into the reduced word size—creating harmonic and intermodulation distortion—the added dither spreads the error out over time, as broadband noise.

But there are less obvious reductions in wordlength happening all the time as you work with digital audio. First, when you record, you are reducing from an essentially unlimited wordlength (an analog signal) to 16 bits. You must dither at this point, but don’t bother to check the specs on your equipment—noise in your recording chain typically is more than adequate to perform the dithering!

At this point, if you simply played back what you recorded, you wouldn’t need to dither again. However, almost any kind of signal processing causes a reduction of bits, and prompts the need to dither. The culprit is multiplication. When you multiply two 16-bit values, you get a 32-bit value. You can’t simply discard or round with the extra bits—you must dither.

Any for of gain change uses multiplication, you need to dither. This means not only when the volume level of a digital audio track is something other than 100%, but also when you mix multiple tracks together (which generally has an implied level scaling built in). And any form of filtering uses multiplication and requires dithering afterwards.

The process of normalizing—adjust a sound file’s level so that its peaks are at full level—is also a gain change and requires dithering. In fact, some people normalize a signal after every digital edit they make, mistakenly thinking they are maximizing the signal-to-noise ratio. In fact, they are doing nothing except increasing noise and distortion, since the noise level is “normalized” along with the signal and the signal has to be redithered or suffer more distortion. Don’t normalize until you’re done processing and wish to adjust the level to full code.

Your digital audio editing software should know this and dither automatically when appropriate. One caveat is that dithering does require some computational power itself, so the software is more likely to take shortcuts when doing “real-time” processing as compared to processing a file in a non-real-time manner. So, an applications that presents you with a live on-screen mixer with live effects for real-time control of digital track mixdown is likely to skimp in this area, whereas an application that must complete its process before you can hear the result doesn’t need to.

Is that the best we can do?

If we use high enough resolution, dither becomes unnecessary. For audio, this means 24 bits (or 32-bit floating point). At that point, the dynamic range is such that the least-significant bit is equivalent to the amplitude of noise at the atomic level—no sense going further. Audio digital signal processors usually work at this resolution, so they can do their intermediate calculations without fear of significant errors, and dither only when its time to deliver the result as 16-bit values. (That’s OK, since there aren’t any 24-bit accurate A/D convertors to record with. We could compute a 24-bit accurate waveform, but there are no 24-bit D/A convertors to play it back on either! Still, a 24-bit system would be great because we could do all the processing and editing we want, then dither only when we want to hear it.)

字词累积二

dà diāo

(1) 折叠

(2) 同“蹀”。

◎ 揲 shé

〈动〉

(1) 按定数更迭数物,分成等分。古代多用于数蓍草占卦,以卜吉凶

(2) 又如:揲蓍(蓍,蓍草。古人用数点蓍草茎的占卜方法来卜卦,以预测吉利与否,称为揲蓍);揲揲锤锤(形容蟋蟀的叫声)

(3) “舍”的代字。舍亲

字词累积一

(1).弯腰。表示谦恭。《礼记·曲礼下》：“立则磬折垂佩。”《后汉书·马援传》：“ 述 鸞旗旄骑，警蹕就车，磬折而入。” 李贤 注：“磬折者，屈身如磬之曲折，敬也。” 唐 杜甫 《遣遇》诗：“磬折辞主人，开帆驾洪涛。” 清 纪昀 《阅微草堂笔记·滦阳消夏录一》：“是夕月明，余步阶上，仰见树杪两红衣人向余磬折拱揖，冉冉渐没。” 章炳麟 《訄书·明独》：“总是杂术也，以一身教乡井，有贤不肖，或觵之，或挞之，或具染请之，皆磬折而愿为之尸，父师之独也。”

(2).犹言卑躬屈膝；受屈辱。 清 周亮工 《庚子重九前四日板屋欲雨》诗之十三：“展转逢彼怒，磬折自心酸。” 章炳麟 《訄书·不加赋难》：“使八旗之无餉乾甲米，则岁节五百万而赢。今几十三万万矣。以是通商惠工而实军府，何功之不成，而何师之不举？其又磬折徒跣以承白人之頩怒也。”

(3).泛指人身、物体或自然形态曲折如磬。《周礼·考工记·韗人》：“为皋鼓，长寻有四尺，鼓四尺，倨句，磬折。” 郑玄 注：“磬折，中曲之，不参正也。” 唐 杜元颖 《玉水记方流》诗：“斗迴虹气见，磬折紫光浮。” 宋 叶适 《宝谟阁待制知隆兴府徐公墓志铭》：“异时 浦港 磬折以趋海。”《隐居通议·诗歌四》引 元 黄载 《斗蟆图诗》：“髯翁磬折目胜负，突眼老嫗探头覷。” 清 二石生 《十洲春语》卷三：“兴至则乔装挥麈，俯仰磬折，摹写曲情。”

(4).形容声音抑扬宛转。《文选·潘岳＜笙赋＞》：“诀厉悄切，又何磬折？” 李善 注：“磬折，言其声若磬形之曲折也。”