Blog Archive

Thursday, June 13, 2019

how to download voxceleb data automatically and prepare for kaldi experiment

Part 1: folder structure preparation:
suppose voxceleb 1 & 2 need to be downloaded into: voxceleb1 & voxceleb2
create dev, test under each directory and put all dev files into dev, test into test
i.e, the final folder directory should be:
mkdir -p voxceleb1/dev voxceleb1/test
mkdir -p voxceleb2/dev voxceleb2/test


Part 2: data download
wget --user=XX --password=YY http://www.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox2_test_aac.zip

You can follow the above example on both voxceleb1 and voxceleb2
Note you need fill this form to request a password.

https://github.com/kaldi-asr/kaldi/tree/master/egs/voxceleb/v1


Reference:
http://www.robots.ox.ac.uk/~vgg/data/voxceleb/vox1.html
http://www.robots.ox.ac.uk/~vgg/data/voxceleb/vox2.html
https://askubuntu.com/questions/29079/how-do-i-provide-a-username-and-password-to-wget

Sunday, May 26, 2019

How to setup & visit home server from outside

Date: 5/26/2019

Abstract:
This essay will focus on visiting home linux server from outside.
Step 1:
Go to the following website to register an account
https://www.noip.com/
For example:
username: YourOwnAccount@gmail.com
password: YourOwnPassword

Step 2: In your server, Download client & install & configure
Download the linux version of the noip client from the following link:
https://www.noip.com/download?page=linux


Once you have opened your Terminal window, log in as the “root” user. You can become the root user from the command line by entering “sudo -s” followed by the root password on your machine.
  1. cd /usr/local/src/
  2. wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
  3. tar xf noip-duc-linux.tar.gz
  4. cd noip-2.1.9-1/
  5. make install
  6. /usr/local/bin/noip2 -C (dash capital C, this will create the default config file)
  7. /usr/local/bin/noip2  & # run noip2 in backgroud


Ref:

https://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client-on-ubuntu/

Step 3: install ssh in your server
sudo apt-get update  # in case you have any problem, reboot system and re-run this
sudo apt-get install openssh-server
sudo service ssh status
http://ubuntuhandbook.org/index.php/2016/04/enable-ssh-ubuntu-16-04-lts/
Step 4: port forwarding:
Suppose you get you domain name from noip.com like the following:

http://YouOwnDDNSaccount.ddns.net/
Then you can setup port forwarding in the following
http://YouOwnDDNSaccount.ddns.net/port_forwarding.php
you can also try:
http://192.168.10.1/
the default
user:admin
pass:password

Step 5: Check:
Option 1:you can validate step3 with local ip of your server:
for example: (port: 22)
ssh yourUserName@10.0.0.136

Option 2:
try port 22 and ip: 12.34.56.78 (just for example)
https://www.yougetsignal.com/tools/open-ports/

Option 3: testing outside your home network (outside your home wifi)
ssh yourUserName@12.34.56.78
Note, you can not test option 3 within your home network.

Refererece:
1) https://www.howtogeek.com/66438/how-to-easily-access-your-home-network-from-anywhere-with-ddns/
2) hardware: arris router
ARRIS Surfboard (24x8) DOCSIS 3.0 Cable Modem Plus AC1750 Dual Band Wi-Fi Router and Xfinity Telephone, 1 Gbps Max Speed, Certified for Comcast Xfinity Only (SVG2482AC)
https://www.amazon.com/gp/product/B06XDGWKSB/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Wednesday, April 10, 2019

[how to remember] priority_queue vs sort



https://coliru.stacked-crooked.com/view?id=27147c4921124ec6

http://www.cplusplus.com/reference/algorithm/sort/

#include <functional>
#include <queue>
#include <vector>
#include <iostream>
bool myfunction (int left, int right) { return (left ) < (right);}
//auto cmp = [](int left, int right) { return left < right;};
auto cmp = [](int  left, int head) { return left < head;}; 
// head is 1st come out of priority_queue; left is what is left
template<typename T> void print_queue(T& q) {
    while(!q.empty()) {
        std::cout << q.top() << " ";
        q.pop();
    }
    std::cout << '\n';
}

int main() {
    std::priority_queue<int> q;

    for(int n : {1,8,5,6,3,4,0,9,7,2})
        q.push(n);

    print_queue(q);

    std::priority_queue<int, std::vector<int>, std::greater<int> > q2;

    for(int n : {1,8,5,6,3,4,0,9,7,2})
        q2.push(n);

    print_queue(q2);

    // Using lambda to compare elements.
    //auto cmp = [](int left, int right) { return (left ^ 1) < (right ^ 1);};
    //auto cmp = [](int left, int right) { return (left ) < (right);};

    std::priority_queue<int, std::vector<int>, decltype(cmp)> q3(cmp);

    for(int n : {1,8,5,6,3,4,0,9,7,2})
        q3.push(n);

    print_queue(q3);
    std::vector<int> ivec({1,8,5,6,3,4,0,9,7,2});
   
    sort(ivec.begin(), ivec.end(), myfunction);
    for(std::vector<int>::iterator it=ivec.begin(); it!=ivec.end(); it++){
       std::cout<<*it<<" ";
    }
    std::cout<<std::endl;

}

g++ -std=c++2a -pthread -fgnu-tm  -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp -lm  -latomic -lstdc++fs  && ./a.out
9 8 7 6 5 4 3 2 1 0 
0 1 2 3 4 5 6 7 8 9 
9 8 7 6 5 4 3 2 1 0 
0 1 2 3 4 5 6 7 8 9 

Tuesday, March 5, 2019

How to write a bash script that takes optional input arguments?


ref: 


You can set a default value for a variable like so:

somecommand.sh

#!/usr/bin/env bash

ARG1=${1:-foo}
ARG2=${2:-bar}
ARG3=${3:-1}
ARG4=${4:-$(date)}

echo "$ARG1"
echo "$ARG2"
echo "$ARG3"
echo "$ARG4"
Here are some examples of how this works:
$ ./somecommand.sh
foo
bar
1
Thu Mar 29 10:03:20 ADT 2018

$ ./somecommand.sh ez
ez
bar
1
Thu Mar 29 10:03:40 ADT 2018

$ ./somecommand.sh able was i
able
was
i
Thu Mar 29 10:03:54 ADT 2018

$ ./somecommand.sh "able was i"
able was i
bar
1
Thu Mar 29 10:04:01 ADT 2018

$ ./somecommand.sh "able was i" super
able was i
super
1
Thu Mar 29 10:04:10 ADT 2018

$ ./somecommand.sh "" "super duper"
foo
super duper
1
Thu Mar 29 10:05:04 ADT 2018

$ ./somecommand.sh "" "super duper" hi you
foo
super duper
hi
you

Sunday, February 3, 2019

西雅图生活十几年经验分享


  • 吃喝玩乐
川菜:川香园Szechuan Garden,沸腾鱼乡 Frying Fish,椒鱼 JoyFish
湘菜:十里香 Little Garden,洞庭春 Dong Ting Chun 北大华店
火锅:小肥羊, 沸点臭臭锅 Boiling Point
粤菜:君悦,鲤鱼门,翠苑
国家公园:Rainier,Mt St Helens, Cascade,Olympic


  • 户外活动
滑雪:Baker最好,Crystal其次,StevensPass和Snoqualmie适合学习,不怕远的开车去Whistler,甚至到处飞。

跑步:Seattle United Runners是本地华人跑群,定期有活动。 跑群有包括西雅图马拉松冠军在内的很多大牛,有利于初学者提高。

野外徒步: 一小时车程内有很多适合徒步的路线,记得去REI买好装备,去Mountaineers学习野外安全注意事项。


  • 职业发展
亚马逊,微软都是本地的大雇主。Google,Facebook等等也有很大的办公室。如果在这些公司工作,花时间去里面的华人员工协会去做志愿者,会对职业发展有帮助。

很多公司都在西雅图有研发中心:              https://www.geekwire.com/engineering-centers/

西雅图创业协会是本地最大的华人创业协会。十年前由一群企业家合伙创办,现在不仅帮助帮助打造创业生态圈,而且积极帮助华人在职场取得成功。

创业:Geekwire每年的年会值得一去。有一些孵化器可以考虑。WeWork是创业公司扎堆的地方,不差钱的话可以考虑到那里租一张桌子。


  • 校友会:
北航:北航北美总会设在西雅图,会长徐亚光,很多波音人士

  • 子女教育
翡翠城家长会是西雅图最大的华人家长会:http://www.emeraldparents.org/



  • 华人媒体:   
西雅图中文媒体:  https://chineseradioseattle.com/

Monday, January 7, 2019

Perl's file-test operators

The perlfunc documentation covers the long list of Perl's file-test operators that covers many situations you will encounter in practice.
Abstract:
-e: File exists.
-f: File is a plain file.
-d: File is a directory.
-z: File has zero size (is empty).
-s: File has nonzero size (returns size in bytes).

Details:
  • -r
    File is readable by effective uid/gid.
  • -w
    File is writable by effective uid/gid.
  • -x
    File is executable by effective uid/gid.
  • -o
    File is owned by effective uid.
  • -R
    File is readable by real uid/gid.
  • -W
    File is writable by real uid/gid.
  • -X
    File is executable by real uid/gid.
  • -O
    File is owned by real uid.
  • -e
    File exists.
  • -z
    File has zero size (is empty).
  • -s
    File has nonzero size (returns size in bytes).
  • -f
    File is a plain file.
  • -d
    File is a directory.
  • -l
    File is a symbolic link (false if symlinks aren’t supported by the file system).
  • -p
    File is a named pipe (FIFO), or Filehandle is a pipe.
  • -S
    File is a socket.
  • -b
    File is a block special file.
  • -c
    File is a character special file.
  • -t
    Filehandle is opened to a tty.
  • -u
    File has setuid bit set.
  • -g
    File has setgid bit set.
  • -k
    File has sticky bit set.
  • -T
    File is an ASCII or UTF-8 text file (heuristic guess).
  • -B
    File is a “binary” file (opposite of -T).
  • -M
    Script start time minus file modification time, in days.
  • -A
    Same for access time.
  • -C
    Same for inode change time (Unix, may differ for other platforms)