WeiNote

yyrcd

web

gym

TA

NOV

16

unzip alternative

ditto -V -x -k --sequesterRsrc --rsrc file.zip dir/

NOV

15

NOV

11

Denotational Semantics: ppt p5

NOV

11

continue at 26

NOV

11

NOV

09

单附点音符:原音符的时值延长一半 双附点音符:再加上原音符时值的1/4

NOV

09

NOV

08

Mongo commands runtime larger than 200

{'wb97mv.pre1.runtime': {$gte: 200}}

total_energy is null

{'wb97mv.wb97md3bj.total_energy': null}

NOV

07

Check if is SSD drive

lsblk -d -o name,rota

NOV

06

NOV

06

NOV

04

he = psi4.geometry("""
H
""")
psi4.set_options({'guess': 'core',
                  'basis': 'cc-pvdz',
                  'scf_type': 'pk',
                  'e_convergence': 1e-8,
                  'reference': 'uhf'})
psi4.energy('SCF')

NOV

03

einsum

  1. python - Understanding NumPy's einsum - Stack Overflow
  2. A basic introduction to NumPy's einsum – ajcr – Haphazard investigations
  3. 能「看到」的张量运算:​因子图可视化
A = np.array([0, 1, 2])
B = np.array([[ 0,  1,  2,  3],
              [ 4,  5,  6,  7],
              [ 8,  9, 10, 11]])

(np.expand_dims(A, 1) * B).sum(axis=1)  # array([ 0, 22, 76])
np.einsum('i,ij->ij', A, B)  # array([[ 0,  0,  0,  0],
                             #        [ 4,  5,  6,  7],
                             #        [16, 18, 20, 22]])

np.einsum('i,ij->i', A, B)   # array([ 0, 22, 76])

np.einsum('i,ij->', A, B)    # 98

Here is what happens next:

  • A has one axis; we've labelled it i. And B has two axes; we've labelled axis 0 as i and axis 1 as j.

  • By repeating the label i in both input arrays, we are telling einsum that these two axes should be multiplied together.

  • Notice that j does not appear as a label in our desired output. By omitting the label, we're telling einsum to sum along this axis.

NOV

03

Abbreviation

  • a.k.a. - also known as
  • BLAS - Basic Linear Algebra Subprograms

NOV

03

GiB vs GB

NOV

02

Shift + Opt + M - copy current tab as markdown url

NOV

01

NOV

01

NOV

01

Install ORCA

Openmpi

wget https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-10-30-openmpi-3.1.4.tar.gz
tar -xvf 2019-10-30-openmpi-3.1.4.tar.gz
cd openmpi-3.1.4
./configure --prefix=/home/richard/apps/openmpi314
make all install -j  # remove -j if error

ORCA

wget https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-10-30-orca_4_2_1_linux_x86-64_shared_openmpi314.tar.xz
tar -xvf 2019-10-30-orca_4_2_1_linux_x86-64_shared_openmpi314.tar.xz

Env

# openmpi
export PATH=$PATH:/path/to/openmpi314/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/openmpi314/lib
# orca
export PATH=$PATH:/path/to/orca
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/orca
export ORCA_PATH=/path/to/orca

Test

mpiexec -V  # openmpi
mkdir test_orca
cd test_orca
wget https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-11-01-test.inp
/path/to/orca/orca 2019-11-01-test.inp > test.out

OCT

30

OCT

30

docker

part 1 orientation

docker
docker container --help

docker --version  # Display Docker version and info
docker version
docker info

docker run hello-world  # Execute Docker image

docker image ls  # List Docker images

docker container ls  #List Docker containers (running, all, all in quiet mode)
docker container ls --all
docker container ls -aq

part 2 containers

docker build -t friendlyhello .  # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyhello  # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello         # Same thing, but in detached mode
docker container ls                                # List all running containers
docker container ls -a             # List all containers, even those not running
docker container stop <hash>           # Gracefully stop the specified container
docker container kill <hash>         # Force shutdown of the specified container
docker container rm <hash>        # Remove specified container from this machine
docker container rm $(docker container ls -a -q)         # Remove all containers
docker image ls -a                             # List all images on this machine
docker image rm <image id>            # Remove specified image from this machine
docker image rm $(docker image ls -a -q)   # Remove all images from this machine
docker login             # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag  # Tag <image> for upload to registry
docker push username/repository:tag            # Upload tagged image to registry
docker run username/repository:tag                   # Run image from a registry

part 3 services

docker stack ls                                            # List stacks or apps
docker stack deploy -c <composefile> <appname>  # Run the specified Compose file
docker service ls                 # List running services associated with an app
docker service ps <service>                  # List tasks associated with an app
docker inspect <task or container>                   # Inspect task or container
docker container ls -q                                      # List container IDs
docker stack rm <appname>                             # Tear down an application
docker swarm leave --force      # Take down a single node swarm from the manager

OCT

29

OCT

28

Set power supply for GPU

sudo nvidia-smi -q -d POWER  # check the current limit
sudo nvidia-smi -i 2 -pl 250  # set power limit of gpu3 to 250W
sudo nvidia-smi -pm 1  # set to persistent mode (no need to change everytime start?)

OCT

26

curl

curl github.com

Node.js

var request = require('request');

var options = {
    url: 'github.com'
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

python

import requests

response = requests.get('http://github.com')

OCT

22

Slurm, there is resource, but why my job is still pending?

There might be one resource job is also pending. Then you submitted another job, though resources are enough to run your job. And your job is also pending, the reason is priority.

Whether slurm will run your job will depend on how long your priority job needs to run. for example: This job might take few hours, then slurm might determin it could run. If it will take days, might not, because the resource job came first, and he will needs to wait days to get his job started.

OCT

21

OCT

16

High Performance Computing (HPC) and parallel programming

  1. OpenMp
  2. MPI

OCT

15

LL grammer

  • Non-LL
    A ::= A σ | β  # This is not LL (Left recursive) 
    A -> A σ -> A σ σ -> A σ σ σ -> A σ σ σ σ  
    β σ σ σ σ σ σ σ σ  # The result should alway like this  
    A way to fix Left recursive 
    A ::= β B  
    B ::= σ B | ε  
  • LL
    A ::= a A | b  # This is LL
    A -> a A -> a a A -> a a a A
    aaaaaaab

OCT

15

SML examples

rev2

fun  rev2 ( [], (y:'a list) ) = (  ([]:'a list),  y  )
   | rev2 (  (x::xs),  y  ) = rev2(  xs,   x::y   );
val rev2 = fn : 'a list * 'a list -> 'a list * 'a list

explicitly give the type because the type checking algorithm

fun rev x = let val (a,b) = rev2 (x,[]) in b end;
val rev = fn : ‘a list -> ‘a list

foldl

           α    β      γ  list           β
fun foldl    f     e         []     =      e
    | foldl f e (x::xs) = foldl f  (f(x,e)) xs;

x: γ
xs:  γ list
f: α and  α = γ * β -> β
Thus
foldl : (γ * β -> β) -> β -> γ list -> β
val foldl = fn: ('a * 'b -> 'b ) -> 'b -> 'a list -> 'b
Evaluate:
fun foldl f e [] = e
      | foldl f e (x::xs) = foldl f  (f(x,e)) xs;
foldl op+ 0 [1,2,3]
= foldl op+ (op+(1,0)) [2,3]
= foldl op+  1 [2,3]

map

         α       β list           γ list
fun map   f       []      =       []
  |  map f (x      ::      xs) =    (f x) :: map f xs
           β            β list 

(f x): γ
f: β -> γ
map: (β -> γ) -> β list -> γ list

OCT

15

Small notes

  • Type Safety: C: enum (red, blue) red is just int (not safe) Java: enum, type is an object (safe)

  • Deep binding: 被当作参数传入的时候bind Shallow binding: 传入之后,被调用的时候bind

  • Predict set EPS(α) = (α →* ε) (this is either true for false) PREDICT(A ::= α) = FIRST(α) U (if EPS(α) then FOLLOW(A) else {})

  • Sometimes one creates a variation of a function of one list argument that has two arguments one is a partial solution and the other is the remaining input. This is to make a linear version of a functions whose obvious implementation is polynomial

  • a* zero or more | a+ one or more | a+ == a(a*)

  • Remark: + is overloaded, NOT polymorphic

  • CR LF: '\r\n'

  • Three ways to formalize the notion of type Denotational, Constructive, Abstraction-based

  • Dynamic Scope Current binding is one encountered most recently during program execution (APL, Lisp, Perl)

  • Statically Scope Scope of a binding is determined by lexical structure of the program (made by the compiler)

  • Compiler-based Early-binding Efficient Interpreter-based Late-binding Flexibility

  • 为什么有reserved word和keyword? reserved可能是未来要用的。 keyword是在用的

  • L-value: 可以被赋值 (a = 1) R-value: 不可以被赋值 (a + 1 = 5)

  • S-attributed L-attributed S的一定是L的。 S的是一层一层递归得到的。(bottom-up) L的可以一遍过。(top-down)

OCT

13

  1. Float 为单精度,4 个字节,有效数位是 7 位(因为有正负,所以不是8位) double为 双精度,占 8 个字节,有效数位是 16 位

  2. 浮点数:数符,尾数,指数符,指数四部分。

    • 数符占 1 位二进制,表示数的正负。
      尾数表示浮点数有效数字,0.xxxxxxx, 但不存开头的 0 和点。
    • 指数符占 1 位二进制,表示指数的正负。
      指数存指数的有效数字。
    • 可能是数符加尾数占 24 位,指数符加指数占 8 位 -- float。
      数符加尾数占 48 位,指数符加指数占 16 位 -- double。

OCT

07

19 first half part is about assignment 3 21 last half part is about lambda caculus (23:27)

OCT

07

OCT

07

NAMES

  1. Federico (M)
  2. Y(sh)amila (F)
  3. Nilu (F)
  4. Pierre Louis (M) (French)

OCT

05

Backup mongodb

  1. backup.sh
#!/bin/bash

MONGO_DATABASE="roitberg"
APP_NAME="roitberg-web"
MONGO_HOST="ds8888.mlab.com"
MONGO_PORT="88888"
USER="username"
PW="password"

TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/richard/production/backup/$APP_NAME"
BACKUP_NAME="$APP_NAME-$TIMESTAMP"

$MONGODUMP_PATH -h $MONGO_HOST:$MONGO_PORT -d $MONGO_DATABASE -u $USER -p $PW

mkdir -p $BACKUPS_DIR
mv dump $BACKUP_NAME
tar -zcvf $BACKUPS_DIR/$BACKUP_NAME.tgz $BACKUP_NAME
rm -rf $BACKUP_NAME

# only keep the newest 30 backups
cd $BACKUPS_DIR
ls --color=no -t | sed -e '1,30d' | xargs -d '\n' rm
  1. Automatic backup
# install mongodb backup tools
sudo apt install -y mongodb-org-shell
sudo apt install -y mongodb-org-tools
# edit the crontab file
sudo crontab -e
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any')
# m h  dom mon dow   command
00 01 * * * /bin/bash /home/richard/production/backup/scripts/backup.sh

Online crontab editor: https://crontab.guru/

OCT

05

OCT

04

Show two image one line at weinote (Not usable on mobile)

<p class="img" style="display: inline-flex;">
<img width=49% src="imglink">
<img width=49% src="imglink">
</p>
<p class="img" style="display: inline-flex;">
<img width=49%  height=initial src="https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-05-02-IMG_1303_HDR.jpg">
<img width=49%  height=initial src="https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-05-02-IMG_1479_HDR.jpg">
</p>

OCT

04

Update Slurm after Replace GPU

If chang gpu on mordor or isengard, both of them needs to be updated

sudo vim /etc/slurm-llnl/slurm.conf
sudo vim /etc/slurm-llnl/gres.conf

Then restart

sudo /etc/init.d/slurmd restart
sudo /etc/init.d/slurmctld restart

OCT

03

OCT

03

OCT

02

OCT

02

从邓丽君到周杰伦——流行音乐和声全解析

  1. 基础课:和声进行,原来如此!
  2. 经典歌曲是怎么用和声套路的
  3. 被忽略的秘密——和声节奏
  4. 流行音乐怎么用五度循环圈
  5. 能力飞跃1——副属和弦
  6. 小调的和声
  7. 能力飞跃2——调式混合
  8. 挂留和弦
  9. 变化低音经过和弦

OCT

02

SEP

30

  • (AB) = BA

  • Hermitian
    Hermitian matrix (or self-adjoint matrix) is a complex square matrix that is equal to its own conjugate transpose

  • Commutator
    • If two operators commute
      The observables A and B can be measured simultaneously with infinite precision
    • If the operators do not commute
      They can't be prepared simultaneously to arbitrary precision, and there is an uncertainty relation between the observables

SEP

30

细思极恐的音程度数

continue here

SEP

29

关系大小调

C大调: CDEFGAB a小调:ABCDEFG

大调的六级音是小调的主音(或者说大调主音下方小三度的音是小调的主音) 小调的三级音是大调的主音

每个大调都有他的关系小调,反之亦然


小调的调号用的就是关系大调的调号

SEP

29

自然小调

大调:欢快,明朗(也能表达悲伤) 小调:悲伤,浪漫(也能表达快乐的情感)


C大调:C D E F G A B C (C - E 大三度) C小调:C D Eb F G Ab Bb C (C - Eb 小三度)(最重要的是Eb:调式特性音级) 小三度是小调听起来悲伤的重要原因 小调另一个特征:六级和七级音比大调对应位置低半音


因此可以说: 主音 - 三级音 是大三度 即为大调 主音 - 三级音 是小三度 即为小调


还有:旋律小调、和声小调


小调: 全 半 全 全 半 全 全 C D Eb F G Ab Bb C 记法: (全 半 全)(全 半 全) 全


A小调 所有音都是白键 A B C D E F G A


构成音一样,主音不同的大调和小调叫做关系大小调 如:C大调与A小调

SEP

29

Table template

|      |      |      |
| :--- | :--: | ---: |
|      |      |      |
|      |      |      |

SEP

29

SEP

28

Shortcuts

Youdao-Alfred

Cmd + Enter Pronounce

Ticktick

Shift + Cmd + A Show quick add Bar Shift + Cmd + O Show Mini Main Window Cmd + 0 Clear Date Cmd +1 Set today

Option + cmd + A Open All Option + cmd + T Open Today

SEP

27

Potential energy = Electronic energy Total energy = Potential energy + Kinetics energy

SEP

26

SEP

25

Save CSV file and load from http

Save

import pandas as pd
df = pd.DataFrame(dict([(k, pd.Series(v)) for k, v in data.items()]))
data = {'wavenumber': wavenumber, 'absorbance': absorbance}
df.to_csv('wave_abs.csv', mode='a', index=False)

Load from http

data = pd.read_csv('https://yyrcd-1256568788.cos.na-siliconvalley.myqcloud.com/yyrcd/2019-09-25-wave_abs.csv')
wavenumber = data['wavenumber'].values
absorbance = data['absorbance'].values

SEP

25

bullshit转移到了hey yyrcd

SEP

23

EMAIL

  1. Thanks for your prompt reply!

SEP

22

SEP

19

Ubuntu add user

sudo adduser username
sudo usermod -aG sudo username

SEP

17

Disccusion

  1. ESI is very low amount
  2. Open source?
  3. What equation I should display on enzyme page?
  4. Server?
  5. Is uncompetitive behavior normal?
  6. Description (one page)
  7. Show all parameters somewhere
  8. Unit

Questions

  1. Equations for Non-competitive Inhibition
  2. rate constant, always first order?

SEP

15

SEP

15

Gas for one round trip to ST Augustine is about 16$, about 6.75 gallon (2.37$/g) MPG (Mile per Gallon) is around 25

SEP

12

VMD mac

alias vmd='/Applications/VMD.app/Contents/MacOS/startup.command'

SEP

11

SEP

11

Junit test on storm.cise

  1. moyi
    jar -cMf jinze_xue_38239101_hw1.jar cop5556fa19/ testInputFiles/
    scp jinze_xue_38239101_hw1.jar jinze@storm.cise.ufl.edu:~/
  2. storm
    jar xf jinze_xue_38239101_hw1.jar 
    mkdir out
    javac -d out/ -cp .:/cise/homes/jinze/lib/junit-jupiter-api-5.5.1.jar:/cise/homes/jinze/lib/apiguardian-api-1.1.0.jar cop5556fa19/ScannerTest.java
    java -jar /cise/homes/jinze/lib/junit-platform-console-standalone-1.5.1.jar -cp ./out/ --scan-classpath -details=tree
    output
    Test run finished after 132 ms
    [         3 containers found      ]
    [         0 containers skipped    ]
    [         3 containers started    ]
    [         0 containers aborted    ]
    [         3 containers successful ]
    [         0 containers failed     ]
    [        17 tests found           ]
    [         0 tests skipped         ]
    [        17 tests started         ]
    [         0 tests aborted         ]
    [        17 tests successful      ]
    [         0 tests failed          ]

SEP

09

VSCode Shortcuts

Code > Preferences > Keyboard Shortcuts > keybindings.json (see image above)

[
    {
        "key": "ctrl+shift+tab",
        "command": "workbench.action.previousEditor"
    },
    {
        "key": "ctrl+tab",
        "command": "workbench.action.nextEditor"
    },
]

SEP

08

SEP

04

Slurm: Kill task failed

And state=MIXED+DRAIN

  • log file

    richard@moria~> sudo cat /var/log/slurm-llnl/slurmctld.log
    [2019-09-04T15:16:31.313] backfill: Started JobID=2076 in queue on moria
    [2019-09-04T15:36:52.152] _slurm_rpc_submit_batch_job: JobId=2077 InitPrio=4294899834 usec=645
    [2019-09-04T15:37:01.327] backfill: Started JobID=2077 in queue on moria
    [2019-09-04T15:38:41.041] _slurm_rpc_kill_job: REQUEST_KILL_JOB job 2077 uid 1026
    [2019-09-04T15:38:43.734] _slurm_rpc_submit_batch_job: JobId=2078 InitPrio=4294899833 usec=648
    [2019-09-04T15:39:34.232] Resending TERMINATE_JOB request JobId=2077 Nodelist=moria
    [2019-09-04T15:39:42.055] error: slurmd error running JobId=2077 on node(s)=moria: Kill task failed
    [2019-09-04T15:39:42.055] drain_nodes: node moria state set to DRAIN
    [2019-09-04T15:39:42.081] cleanup_completing: job 2077 completion process took 61 seconds
  • nodes information

    richard@moria~> scontrol show nodes
    NodeName=moria Arch=x86_64 CoresPerSocket=8
     CPUAlloc=4 CPUErr=0 CPUTot=16 CPULoad=4.34
     AvailableFeatures=(null)
     ActiveFeatures=(null)
     Gres=gpu:gtx1080ti:2,gpu:titanv:3,gpu:v100:1,gpu:gp100:2
     NodeAddr=moria NodeHostName=moria Version=17.11
     OS=Linux 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 
     RealMemory=120000 AllocMem=0 FreeMem=1023 Sockets=2 Boards=1
     State=MIXED+DRAIN ThreadsPerCore=1 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/A
     Partitions=queue 
     BootTime=2019-02-03T15:36:08 SlurmdStartTime=2019-02-13T18:00:18
     CfgTRES=cpu=16,mem=120000M,billing=16
     AllocTRES=cpu=4
     CapWatts=n/a
     CurrentWatts=0 LowestJoules=0 ConsumedJoules=0
     ExtSensorsJoules=n/s ExtSensorsWatts=0 ExtSensorsTemp=n/s
     Reason=batch job complete failure [slurm@2019-09-04T15:39:42]
  • how to fix

    richard@moria~> scontrol update nodename=moria state=resume
  • For more information

  • show cpu information

    richard@moria~> sinfo -O cpusstate
    CPUS(A/I/O/T)(allocated/idle/other/total)
    5/11/0/16 

SEP

02

Extract file from a foo.jar file

jar -xf myFile.jar

compile

javac -cp .:/home/richard/study/COP5556/hw/lib/junit-jupiter-api-5.5.1.jar cop5556fa19/*.java

run

java -jar /home/richard/study/COP5556/hw/lib/junit-platform-console-standalone-1.5.1.jar -cp . --scan-classpath

SEP

02

SEP

02

JAVA

Some simple notes for java

for each loop

public class TestArray {
   public static void main(String[] args) {
      double[] myList = {1.9, 2.9, 3.4, 3.5};

      // 打印所有数组元素
      for (double element: myList) {
         System.out.println(element);
      }
   }
}

Ternary operator

variable x = (expression) ? value if true : value if false

Keyword

final constant

Float

In JAVA, values like: 8.5, 3.9 are assumed as double and not float. You can also perform a cast in order to solve the problem:

float b = (float) 3.5;
// or
float b = 3.5f;

Convention

  • 类名:对于所有的类来说,类名的首字母应该大写。如果类名由若干单词组成,那么每个单词的首字母应该大写,例如 MyFirstJavaClass 。
  • 方法名:所有的方法名都应该以小写字母开头。如果方法名含有若干单词,则后面的每个单词首字母大写。
  • 源文件名:源文件名必须和类名相同。当保存文件的时候,你应该使用类名作为文件名保存(切记 Java 是大小写敏感的),文件名的后缀为 .java。(如果文件名和类名不相同则会导致编译错误)。
  • 主方法入口:所有的 Java 程序由 public static void main(String []args) 方法开始执行。

AUG

31

鸡胸肉怎么做好吃?

(Due to the connectivity issue of AWS us-east-1 (mlab status), wiki is currently not avaliable. This is a temporary place for wiki.

AUG

29

AUG

29

Particle in a 1D box

Source code on gist

AUG

28

AUG

24

Sound Interference

Source code on gist

AUG

24

python global

globvar = 0

def set_globvar_to_one():
    global globvar    # Needed to modify global copy of globvar
    globvar = 1

def print_globvar():
    print(globvar)     # No need for global declaration to read value of globvar

set_globvar_to_one()
print_globvar()       # Prints 1

AUG

23

pathlib is better than os.path

AUG

18

git undo a commit

git reset --hard HEAD^
git push origin +branch_name  # force push 

AUG

16

COP5556 PROGRAMMING LANGUAGE PRINCIPLES

java

IntelliJ IDEA Tutorial

book

Syntax and Semantics of Programming Languages

AUG

16

Car

  • Oil change today (every 3000miles)
  • Air engine filter changed today. (every 15000miles)

AUG

16

python import a package

# ~/.bashrc
export $PYTHONPATH=/path/to/package:$PYTHONPATH

then the path will be shown in sys.path, then you can import package Another way is

import sys
sys.path.append(/path/to/package)

AUG

15

Tools

Google colab

  • integrate with github
  • permision to view or edit
  • search for colab tips

AUG

14

python str.format()

'CPU  {: 4d}%'.format(100)
'CPU  {: 4d}%'.format(10)
'CPU  {: 4d}%'.format(0)
CPU   100%
CPU    10%
CPU     0%
'CPU  {:04d}%'.format(100)
'CPU  {:04d}%'.format(10)
'CPU  {:04d}%'.format(0)
CPU  0100%
CPU  0010%
CPU  0000%

AUG

14

create a restricted guest user on linux

# root
useradd -s /bin/rbash -d /home/guest guest
mkdir /home/guest
chown guest:guest /home/guest
passwd guest

At this point, guest user still can access all the commands which are in $PATH. At least you need to remove all shell from $PATH. E.G. bash zsh

change guest shell to specific command

# write command to .sh file
sudo chsh -s /home/guest/guest-shell.sh guest

AUG

13

AUG

13

AUG

13

AUG

12

AUG

12

macOS 应用开发 Swift 入门教程 - 菜鸟

感觉还是html最简单啊。。

AUG

11

五度循环圈

C大调中所有的纯五度音程,连起来。 纯五度:7个半音。 重要性:纯五度的两个音,协和程度仅次于纯一度和纯八度 原因:频率比,泛音列 记法:共12个点,刚好是钟表的形状,C在12点

AUG

10

AUG

10

大乱斗

皮卡丘

ZeRo

零基础攻略 电玩部落

  • (上B)的作用:当角色处于浮空状态时,各种招式的形态都会发生变化,其中大部分上必杀技将能提供一段向上的位移。
  • 闪避通过肩键+左/右完成,能够在水平方向上进行位移并且躲避敌人的伤害。
  • 下+A:
  • 奔跑时按A
  • 连按A

AUG

07

netdata

Web API

Webfile location: /opt/netdata/netdata-web-files/my.html

API usage: http://pc.moyi.yyrcd.com/api/v1/chart?chart=system.ram

API for shell

eval "$(curl -s 'http://localhost:19999/api/v1/allmetrics')"

# GPU RAM
NETDATA_NVIDIA_SMI_GPU0_MEM_USAGE_USED
# GPU UTIL
NETDATA_NVIDIA_SMI_GPU0_GPU_UTILIZATION_UTILIZATION

# CPU RAM
NETDATA_SYSTEM_RAM_USED
# CPU UTIL
NETDATA_SYSTEM_CPU_VISIBLETOTAL

AUG

06

NFS setting

  1. server:

    sudo apt install nfs-kernel-server
    sudo vim /etc/exports
  2. client:

    sudo apt install nfs-common
    sudo vim /etc/fstab
  3. if client is mac use vifs instead of /etc/fstab, more detail

  4. useful commands

    showmount -e : Shows the available shares on your local machine
    showmount -e <server-ip or hostname>: Lists the available shares at the remote server
    showmount -d : Lists all the sub directories
    exportfs -v : Displays a list of shares files and options on a server
    exportfs -a : Exports all shares listed in /etc/exports, or given name
    exportfs -u : Unexports all shares listed in /etc/exports, or given name
    exportfs -r : Refresh the server’s list after modifying /etc/exports

JUL

31

pytorch two test molecule

model = ANI_D.model.ANI_MO_Pair_Model(device=device)

coordinates = torch.tensor(
    [[[0.03192167, 0.00638559, 0.01301679],
      [-0.83140486, 0.39370209, -0.26395324],
      [-0.66518241, -0.84461308, 0.20759389],
      [0.45554739, 0.54289633, 0.81170881],
      [0.66091919, -0.16799635, -0.91037834]],
     [[-4.1862600, 0.0575700, -0.0381200], 
      [-3.1689400, 0.0523700, 0.0200000],
      [-4.4978600, 0.8211300, 0.5604100], 
      [-4.4978700, -0.8000100, 0.4155600],
      [0.00000000, -0.00000000, -0.00000000]]],
    requires_grad=True,
    device=device)

species = torch.tensor([[1, 0, 0, 0, 0], [2, 0, 0, 0, -1]], device=device)

pred, _, MO_num = model([(species, coordinates)])

JUL

29

Note that calling my_tensor.to(device) returns a new copy of my_tensor on GPU. It does NOT overwrite my_tensor. Therefore, remember to manually overwrite tensors: my_tensor = my_tensor.to(torch.device('cuda')).

JUL

14

Nullboard Notes

JUL

13

Alfred Youdao cmd + enter 发音

JUL

02

TensorFlow-nightly anaconda setup

# base
conda update -n base -c defaults conda
conda update conda-build
# tf
conda create -n tf python=3.6 anaconda
conda update setuptools #tf needs setuptools>=41.0.0
pip install tf-nightly-gpu==1.14.1.dev20190620
conda install -c conda-forge jupytext
conda install -c conda-forge pysnooper
conda install -c conda-forge matplotlib
conda install -c anaconda jupyter 

JUL

02

git

所有更改都add上

git add -u .

remove from git, but keep in local

git rm --cached mylogfile.log 
git rm --cached -r directory

JUL

01

常用network工具

ip route
default via 10.30.160.1 dev enp3s0 proto dhcp metric 100 
10.30.160.0/20 dev enp3s0 proto kernel scope link src 10.30.171.30 metric 100 
169.254.0.0/16 dev enp3s0 scope link metric 1000 

ip route get 10.241.124.148
10.241.124.148 via 10.136.0.1 dev en0  src 10.136.196.12

JUN

30

Wireguard

IPv4 only环境下通过Wireguard获取全局IPv6地址

tcpdump

richard@miami > sudo tcpdump -i wg0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wg0, link-type RAW (Raw IP), capture size 262144 bytes
12:05:06.856663 IP 172.22.2.2 > 172.22.2.3: ICMP echo request, id 28433, seq 0, length 64
12:05:06.856721 IP 172.22.2.2 > 172.22.2.3: ICMP echo request, id 28433, seq 0, length 64
12:05:06.876567 IP 172.22.2.3 > 172.22.2.2: ICMP echo reply, id 28433, seq 0, length 64
12:05:06.876592 IP 172.22.2.3 > 172.22.2.2: ICMP echo reply, id 28433, seq 0, length 64
12:05:07.859800 IP 172.22.2.2 > 172.22.2.3: ICMP echo request, id 28433, seq 1, length 64
12:05:07.859827 IP 172.22.2.2 > 172.22.2.3: ICMP echo request, id 28433, seq 1, length 64
12:05:07.879684 IP 172.22.2.3 > 172.22.2.2: ICMP echo reply, id 28433, seq 1, length 64
12:05:07.879707 IP 172.22.2.3 > 172.22.2.2: ICMP echo reply, id 28433, seq 1, length 64

ping

richard@mbpr > ping 172.22.2.3
PING 172.22.2.3 (172.22.2.3): 56 data bytes
64 bytes from 172.22.2.3: icmp_seq=0 ttl=63 time=32.214 ms
64 bytes from 172.22.2.3: icmp_seq=1 ttl=63 time=32.074 ms
^C
--- 172.22.2.3 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 32.074/32.144/32.214/0.070 ms

JUN

28

pm2

pm2 save  # Saving current process list
pm2 resurrect  #Manually resurrect processes

JUN

24

linux系统硬件信息

lspci
lscpu
lshw # 最全

linux安装ssd硬盘

vim /etc/fstab  #安装硬盘上之后,mount到某文件夹;每次开机都会自动mount

Show RAM information

$ sudo lshw -short -C memory
H/W path      Device     Class          Description
===================================================
/0/0                     memory         64KiB BIOS
/0/3c                    memory         24GiB System Memory
/0/3c/0                  memory         8GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2133 MHz (0.5 ns)
/0/3c/1                  memory         [empty]
/0/3c/2                  memory         16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2133 MHz (0.5 ns)
/0/3c/3                  memory         [empty]
/0/42                    memory         256KiB L1 cache
/0/43                    memory         1MiB L2 cache
/0/44                    memory         6MiB L3 cache
/0/100/1f.2              memory         Memory controller

JUN

23

JUN

23

nmap secure jupyter

JUN

20

Transformer Model Bert XLNet

JUN

18

Markdown 上下标

Emin<sup>Maj7</sup> 
H<sub>2</sub>O  CO<sub>2</sub>

EminMaj7 H2O CO2

JUN

18

和弦

三和弦

分类

  • 大三和弦 Cmajor(Cmaj C): C(大三度)E(小三度)G
  • 小三和弦 Dminor(Dmin Dm): D(小三度)F(大三度)A
  • 减三和弦 Bdiminished(Bdim B°): B(小三度)D(小三度)F

C大调和弦:

  • 1 4 5(C F G)为根音的和弦为大三和弦
  • 2 3 6(D E A)为根音的和弦为小三和弦
  • 7(B)为根音的和弦为减三和弦

和弦转位 和弦中的低音不等于根音 根音为C是C和弦(CEG)。 但是低音可以是C、E 或者 G

  • 原位 CEG
  • 第一转位 EGC - C/E 和弦/根音
  • 第二转位 GCE - C/G 和弦/根音

七和弦

分类

  • 大七和弦(大大七和弦 = 大三和弦 + 大七度) Cmajor7 (Cmaj7 CM7): C(大三度)E(小三度)G(大三度)B

  • 小七和弦(小七和弦 = 小三和弦 + 小七度) Aminor7 (Amin7 Am7): A(小三度)C(大三度)E(小三度)G

  • 属七和弦(属七和弦 = 大三和弦 + 小七度) Gdominant7 (Gdom7 G7): G(大三度)B(小三度)D(小三度)F 这里的小七度可以根据G的大二度来推算

  • 小大七和弦(小大七和弦 = 小三和弦 + 大七度) EminMaj7 (EmM7): E(小三度)G(大三度)B(大三度)D# 这里的大七度可以根据E的小二度来推算

和弦转位

  • 原位 CEGB - CM7
  • 第一转位 EGBC - CM7/E
  • 第二转位 GBCE - CM7/G
  • 第二转位 BCEG - CM7/B

总结 根音:C、D、E、F... 类型:M(Major)、m(minor)、M7、m7...

JUN

18

TensorFlow: Could not load dynamic library 'libcupti.so.10.0'

conda install cudatoolkit=10.0 -c pytorch

JUN

18

TensorFlow get operation by name

op = tf.get_default_graph().get_operation_by_name("training_2/SGD/gradients/loss_1/output_1_loss/Mean_grad/DynamicStitch")
op.inputs[1]

JUN

18

JUN

18

JUN

18

JUN

17

Piano - frequently used English word

  • C sharp 升C
  • B flat 降B

JUN

17

Logic Pro X Shortcut

enter 回到开头 opt + 拖动 复制拖动 , 快退 . 快进 shift + , 快退8小节 shift + . 快进8小节


C 开启/关闭循环 U 开启/关闭特定片段循环 cmd + →/↑ 放大 cmd + ←/↓ 缩小 Z(空白处) 放大所有,充满显示区 Z(特定片段) 放大特定片段 Ctrl + opt + 选框 放大选框 Ctrl + opt + 空白 返回放大之前


cmd + A 全选 cmd + B 导出并轨 mp3

JUN

16

JUN

16

Piano

  • 36个黑键,52个白键,Total: 88
  • 每组5个黑键,7个白键,Total: 12个
  • 共7组,3 + 7x12 + 1 = 3 + 84 + 1
  • 中央C:C4

  • 4/4:每小节有4拍 / 以四分音符为一拍
  • 120:每分钟有多少拍(bpm: beats per minute)

  • 大调:全全半全全全半
  • 稳定音:1 5 3
  • 不稳定音:6 2 4 7
  • 不稳定音倾向于运动到稳定音,1 ← 2, 3 ← 4, 5 ← 6, 7 → 1

音程

  • 一四五八无大小
  • 音程度数:从1开始数
  • 半音数:从0开始数
  • 转位
    • 4 → 7 :增四
    • 7 ← 4 :减五
    • 度数相加等于九
    • 大小增减是互换,例如:大三转位变成小六度
    • 纯音程不变,例如:纯四度转位变成纯五度
  • 音程协和性
    • 完全协和音程:纯一度、纯八度
    • 协和音程:纯四度、纯五度
    • 不完全协和音程:大小三度、大小六度
    • 不协和音程:大小二度、大小七度、增四减五度

JUN

13

npm install so slow, this might because no swap space enabled. https://stackoverflow.com/a/32444643/9581569

sudo fallocate -l 2G /swapfile #Create a 4 gigabyte swapfile
sudo chmod 600 /swapfile #Secure the swapfile by restricting access to root
sudo mkswap /swapfile #Mark the file as a swap space
sudo swapon /swapfile #Enable the swap
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab #Persist swapfile over reboots (thanks for the tip, bman!)

JUN

12

Multiple CSS/JS Dropdowns https://stackoverflow.com/a/49745579/9581569 The dropdown buttons used in this website are based on this answer (Jquery way).

JUN

10

2 numpy molecule

import numpy as np
coor = np.array([[[0.03192167,  0.00638559,  0.01301679],
[-0.83140486,  0.39370209, -0.26395324],
[-0.66518241, -0.84461308,  0.20759389],
[0.45554739,   0.54289633,  0.81170881],
[0.66091919,  -0.16799635, -0.91037834]],
[[-1.46909, 2.22911, 0.00000],
[-0.44909, 2.22911, 0.00000],
[-1.80908, 1.69374, 0.79886],
[-1.80909, 1.80497, -0.86308],
[-1.80909, 1.80497, -0.86308]]])
spe = np.array([[1, 0, 0, 0, 0], [1, 0, 0, 0, 0]])

JUN

10

trainable weights

homo_model.animodel.layers[0].trainable
homo_model.weights

JUN

10

print all numpy values

import sys
import numpy
numpy.set_printoptions(threshold=sys.maxsize)

JUN

10

GPU status

watch -n 1 -d nvidia-smi 

JUN

10

保持fork之后的项目和上游同步

git remote add upstream https://github.com/staticblog/staticblog.github.io.git
git remote -v
git fetch upstream
git checkout master
git merge upstream/master
origin  git@github.com:ibrother/staticblog.github.io.git (fetch)
origin  git@github.com:ibrother/staticblog.github.io.git (push)
upstream        https://github.com/staticblog/staticblog.github.io.git (fetch)
upstream        https://github.com/staticblog/staticblog.github.io.git (push)

JUN

08

Ubuntu 休眠 合上笔记本盖子不休眠的方法

sudo gedit /etc/systemd/logind.conf
然后将其中的:
#HandleLidSwitch=suspend
改成下面,记得去掉“#”号:
HandleLidSwitch=ignore

JUN

07

jupyter

jupyter notebook password
conda config --set changeps1 False #terminal是否显示env名字

JUN

07

git reset everything

git checkout -- .

JUN

07

tensorflow gpu set

# 1
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5)
with tf.Session(config=tf.ConfigProto(allow_soft_placement=True, gpu_options=gpu_options)) as sess:

# 2
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
tf.enable_eager_execution(config=config)
with tf.Session(config=config) as sess:

JUN

07

vim Comment multiple lines https://stackoverflow.com/a/1676690/9581569 comment

JUN

07

nohup command &

nohup scp -P 2022 confs_gdb01-06_red03-07_cv_1_chkpts.tar.gz \
ly.yyrcd.com:/mnt/data/richard/ &

jobs
kill %1

JUN

07

size of current folder

du -h 
df -h  #磁盘使用情况

JUN

07

vim copy cut paste

y copy
d cut
p paste

JUN

07

mongodb sort

db.getCollection('music163s').find({}).sort({ _id: 1})

JUN

07

inspect

import inspect
print(inspect.getsource(tf.keras.metrics.RootMeanSquaredError))
print(inspect.getsource(tf.keras.metrics.mean_squared_error))
print(inspect.getmro(tf.keras.metrics.RootMeanSquaredError))

JUN

06

async

const async = require('async');
const request = require('request');

function httpGet(url, callback) {
  const options = {
    url :  url,
    json : true
  };
  request(options,
    function(err, res, body) {
      callback(err, body);
    }
  );
}

const urls= [
  "http://localhost:3010/alm/build_tool",
  "http://localhost:3010/alm/development_tool",
  "http://localhost:3010/alm/project_architecture"
];

async.map(urls, httpGet, function (err, res){
  if (err) return console.log(err);
  console.log(res);
});

Promise

router.get('/', function (req, res, next) {
      let uid = req.query.uid;
      let type = req.query.type;
      let typelist = ['Total', 'Last week']
      console.log(typelist[type]);
    if (!uid) {
        uid = 10115387;
    }
    if (!type) {
        type = 1;
    }
    var api_week =["https://musicapi.yyrcd.com/user/record?uid=", uid, "&type=", type];
    var url_week = api_week.join('') ;

    new Promise((resolve, reject) => {
        request({url: url_week ,method: 'get'}, (err, res, body) => {
            if (res && res.statusCode === 200) {
                let data = JSON.parse(body);
                if (type == 1) {
                    resolve(data.weekData);
                }else{
                    resolve(data.allData);
                }

            } else {
                reject('error');
            }
        });
    }).then(result => {
        res.render('music', {
        weekData: result,
        type: typelist[type],
        uid: uid
        })
    })
    .catch(next)
})

2018

DEC

12

test port

wget baidu.com:2014

DEC

07

如何练习发声

面部

  • 笑肌
  • 嘶 练习
  • 张大嘴巴,做出咬苹果的姿式
  • 努嘴
  • 用舌头顶左边腮帮子

腹部

  • 站直,挺胸,深呼吸
  • 腹部使劲

伪声