离线手动安装vscode server

偶尔碰到vscode server不能自动安装的问题,这个时候可以通过手动安装的方式来解决

step1: 通过迅雷下载对应commit id的vscode压缩包

step2: 复制压缩包到远程主机的 ~/.vscode-server/bin/ 目录

step3: 执行:tar xzvf [commit id].tar.gz 解压缩

step4: 确认vscode server的路径符合: ~/.vscode-server/bin/[commit id]/server.sh

all done

Ubuntu20.04如何安装python3.6

更新apt源配置,安装python3.6

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.6 python3.6-distutils

安装适配python3.6的pip

wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
python3.6 get-pip.py

如何编译系统签名的APK

在github上下载工具:

 https://github.com/getfatday/keytool-importkeypair

从安卓源代码中复制必要的文件:

文件路径:build/target/product/security
platform.pk8
platform.x509.pem

把上面这2个文件和工具放在同一个目录下,执行下面的命令:

sh keytool-importkeypair -k ./platform.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform

-p: 密码,上面的例子使用了android

-alias: 别名,签名的时候需要,上面的例子使用了platform

修改AndroidManifest.xml文件,添加下面的内容之一:

  • android:sharedUserId=”android.uid.system
  • android:sharedUserId=”android.uid.shared”
  • android:sharedUserId=”android.media”

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.njduck.demoapp"
    android:sharedUserId="android.uid.system">

ubuntu编译AOSP

系统环境: ubuntu 20.04 LTS

安装必要工具:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip openjdk-8-jdk libtinfo-dev libncurses-dev libncurses5 libssl-dev

修改BaseTools路径:

cd bootable/bootloader/edk2
rm -rf Conf/BuildEnv.sh
unset EDK_TOOLS_PATH
./edksetup.sh BaseTools
cd -

开始编译吧:

source build/envsetup.sh
lunch xxx
make -j40

等等……

需要LLVM?

sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 

如何新建自签名SSL证书

  1. 准备工作:
mkdir ca
cd ca
mkdir demoCA
mkdir demoCA/newcerts
touch demoCA/index.txt
echo "01" > demoCA/serial

2. 生成CA证书

openssl genrsa -des3 -out ca.key 2048

3. 生成CA公钥

openssl req -new -x509 -days 7305 -key ca.key -out ca.crt

4. 生成域名证书私钥

openssl genrsa -des3 -out *.njduck.com.pem 1024

5. 将域名私钥解密生成key

openssl rsa -in *.njduck.com.pem -out *.njduck.com.key

6. 生成证书请求

openssl req -new -key *.njduck.com.pem -out *.njduck.com.csr

7. 证书签名

openssl ca -policy policy_anything -days 1460 -cert ca.crt -keyfile ca.key\
    -in *.njduck.com.csr -out *.njduck.com.crt

CA证书生成后可以直接从第4步开始给其他域名生成证书

Excel小技巧

=IF(EXACT(WEEKDAY(A10,2),"1"),"一",IF(EXACT(WEEKDAY(A10,2),"2"),"二",IF(EXACT(WEEKDAY(A10,2),"3"),"三",IF(EXACT(WEEKDAY(A10,2),"4"),"四",IF(EXACT(WEEKDAY(A10,2),"5"),"五",IF(EXACT(WEEKDAY(A10,2),"6"),"六",IF(EXACT(WEEKDAY(A10,2),"7"),"日","")))))))

配置HBase单机版

  • 配置JAVA_HOME

编辑conf/hbase-env.sh,指定包含/bin/java的路径为JAVA_HOME

export JAVA_HOME=/usr
  • 编辑HBase主配置文件

conf/hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/ubuntu/hbase/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/ubuntu/hbase/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>
</configuration>
  • 启动HBase

执行bin/start-hbase.sh