今年末尾去了不少地方
不错不错
原作者:雨鸦(UID:52036)
原视频地址:https://www.bilibili.com/video/av212109/
原视频发布时间:2012/02/07 02:17
原版简介:“原创,哲♂学版Pump♂it. 视频偷懒。没听过BGM的请移步av160014。P.S.周日和某基友碰头的时候,他说在Arlington见到了酷似比利的男♂人。。”
我谨在此备个份。十周年刚过去。
测试测试要多久才会被Google收录
发现国家授时中心终于有NTP域名了
就是 ntp.ntsc.ac.cn
A ntp server from National Time Service Center, Chinese Academy of Science.
Cuz I use GPG a lot on Win10 to prevent cloud storage service provider analysis my files, the super slow encryption speed bugs me a lot. I tried to use it on an Ubuntu inside a VM, it is fast, but I have to move the file around, cumbersome.
On my i5-6200u @ 2.40Ghz (AES-NI disabled by Lenovo BIOS), SDD, 16G ram, gpg4win only achieves around 15mB/s. I suspect being a GNU software, some users might still using Pentium 3, hence gpg4win might be compiled without any CPU specified optimization flag, so I need to recompile it myself with some flags.
Without further ado, let’s get started. I just assume people go this deep have a sense of things going well or not, so I won’t give examples of correct output. Please utilize google first when you met errors.
First we need tools
1 |
sudo apt install mingw-w64-tools gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gettext |
Then get source code for each following step from gnupg.org and zlib.net
Before building GnuPG, we have to had Libgpg-error, Libgcrypt, Libksba, Libassuan, ntbTLS, and nPth ready.
I work on the home folder. Make a build folder:
1 |
mkdir build |
To get Libgpg-error:
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2 :~$tar xf libgpg-error-1.27.tar.bz2 :~$cd libgpg-error-1.27 :~/libgpg-error-1.27$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-s -static' --host=x86_64-w64-mingw32 --enable-threads=windows --prefix=/home/chl/build/ :~/libgpg-error-1.27$ make -j4 :~/libgpg-error-1.27$ make install |
Libgcrypt:
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.1.tar.bz2 :~$tar xf libgcrypt-1.8.1.tar.bz2 :~$cd libgcrypt-1.8.1 :~/libgcrypt-1.8.1$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-s -static' --host=x86_64-w64-mingw32 --enable-m-guard --with-gpg-error-prefix=/home/chl/build/ --prefix=/home/chl/build/ :~/libgcrypt-1.8.1$ make -j4 :~/libgcrypt-1.8.1$ make install |
Btw, I use “make -j4” because mine has 4 threads.
Libksba:
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2 :~$tar xf libksba-1.3.5.tar.bz2 :~$cd libksba-1.3.5 :~/libksba-1.3.5$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-s -static' --host=x86_64-w64-mingw32 --with-gpg-error-prefix=/home/chl/build/ --prefix=/home/chl/build/ :~/libksba-1.3.5$ make -j4 :~/libksba-1.3.5$ make install |
Libassuan:
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.4.3.tar.bz2 :~$tar xf libassuan-2.4.3.tar.bz2 :~$cd libassuan-2.4.3 :~/libassuan-2.4.3$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-s -static' --host=x86_64-w64-mingw32 --with-gpg-error-prefix=/home/chl/build/ --prefix=/home/chl/build/ :~/libassuan-2.4.3$ make -j4 :~/libassuan-2.4.3$ make install |
ntbTLS:
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2 :~$tar xf ntbtls-0.1.2.tar.bz2 :~$cd ntbtls-0.1.2 :~/ntbtls-0.1.2$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-s -static' --host=x86_64-w64-mingw32 --with-libgcrypt-prefix=/home/chl/build/ --with-ksba-prefix=/home/chl/build/ --with-gpg-error-prefix=/home/chl/build/ --prefix=/home/chl/build/ :~/ntbtls-0.1.2$ make -j4 :~/ntbtls-0.1.2$ make install |
Somehow when I compiled nPth, it complains it cannot find zlib.h, so I also compile zlib, it might not be necessary.
zlib:
1 2 3 |
:~$wget https://zlib.net/zlib-1.2.11.tar.gz :~$tar xf zlib-1.2.11.tar.gz :~$cd zlib-1.2.11 |
as stated in here, the configure of zlib is broken by the time I wrote this post, so we need to manually compile zlib:
1 2 3 4 5 6 |
:~/zlib-1.2.11$ sed -e s/"PREFIX ="/"PREFIX = x86_64-w64-mingw32-"/ -i win32/Makefile.gcc # automatic replacement :~/zlib-1.2.11$ make -f win32/Makefile.gcc :~/zlib-1.2.11$ sudo BINARY_PATH=/usr/x86_64-w64-mingw32/bin \ INCLUDE_PATH=/usr/x86_64-w64-mingw32/include \ LIBRARY_PATH=/usr/x86_64-w64-mingw32/lib \ make -f win32/Makefile.gcc install |
nPth: (I don’t even know is -lws2_32 necessary or not, it was added after I met some problem when compiling the main gnupg, so I just leave it here)
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/npth/npth-1.5.tar.bz2 :~$tar xf npth-1.5.tar.bz2 :~$cd npth-1.5 :~/npth-1.5$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-L/usr/x86_64-w64-mingw32/lib/ -lws2_32 -s -static' --host=x86_64-w64-mingw32 --prefix=/home/chl/build/ :~/npth-1.5$ make -j4 :~/npth-1.5$ make install |
Finally, gnupg
1 2 3 4 5 6 |
:~$wget https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.1.tar.bz2 :~$tar xf gnupg-2.2.1.tar.bz2 :~$cd gnupg-2.2.1 :~/gnupg-2.2.1$ ./configure CFLAGS='-O3 -m64 -mtune=native -march=native' LDFLAGS='-L/home/chl/build/ -s -static' --host=x86_64-w64-mingw32 --disable-dirmngr --disable-gpgsm --disable-scdaemon --disable-doc --disable-gpgtar --with-libgcrypt-prefix=/home/chl/build/ --with-ksba-prefix=/home/chl/build/ --with-gpg-error-prefix=/home/chl/build/ --with-libassuan-prefix=/home/chl/build/ --with-npth-prefix=/home/chl/build/ --with-ntbtls-prefix=/home/chl/build/ --prefix=/home/chl/build/ :~/gnupg-2.2.1$ make -j4 :~/gnupg-2.2.1$ make install |
Linker kept throwing errors when I have all the default stuff enabled, since all I want is the gpg.exe, I disabled many components. Then it works.
the gpg.exe can be found by:
1 2 |
:~$ sudo updatedb :~$ locate gpg.exe |
The performance gain is significant, encrypt speed jump to around 60mB/s from 15mB/s. And the file remains the same after encrypt and decrypt. Good deal.
Ref:
https://gist.github.com/ePirat/0fd2c714dea2748cca98cf2096faa574
The handwriting of CA license plate is not made some computer font. I believe it is just someone’s handwriting.
1 |
sudo apt-get install liblapacke-dev libblas-dev liblapack-dev |
First thing first, install lapack, lapacke(C wrapper for lapack), and blas.
Let’s use the demo code from http://www.netlib.org/lapack/lapacke.html, save it as test.cpp
1 |
g++ -o run test.cpp -llapacke -llapack -lblas -lgfortran |
That’s all I need to let it compile.
To run it, you just need to
1 |
./run |
Done. Thanks. Period.