--unsafe-perm 各种技巧

就是说 npm 出于安全考虑不支持以 root 用户运行,即使你用 root 用户身份运行了,npm 会自动转成一个叫 nobody 的用户来运行,而这个用户几乎没有任何权限。这样的话如果你脚本里有一些需要权限的操作,比如写文件(尤其是写 /root/.node-gyp),就会崩掉了。

为了避免这种情况,要么按照 npm 的规矩来,专门建一个用于运行 npm 的高权限用户;要么加 --unsafe-perm 参数,这样就不会切换到 nobody 上,运行时是哪个用户就是哪个用户,即使是 root。

https://docs.npmjs.com/misc/config#unsafe-perm

标签: npm

new 发布于 2019-11-20 02:48

cp8700环境安装 各种技巧

1.修改代理文件,/etc/dnf/dnf.conf

2.替换阿里源

cd /etc/yum.repos.d/
mv fedora.repo fedora.repo.backup
mv fedora-updates.repo fedora-updates.repo.backup
wget -O /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.repo
wget -O /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.repo
dnf clean all
dnf makecache

3.安装gcc,gcc-c++,python

4.安装C库:sudo dnf install glibc-devel.i686

5.安装node X86 32位版本

6.npm淘宝源:npm config set registry https://registry.npm.taobao.org

7.electron:https://npm.taobao.org/mirrors/electron/4.2.12/

electron V4.2.12 64位(2.x版本不支持webm视频播放,5+版本运行失败)


new 发布于 2019-9-29 06:39

Android 对apk进行重签名和查看签名(window 和mac)及生成签名 安卓应用开发

生成签名文件

keytool -genkey -alias xxxx.keystore -keyalg RSA -validity 2000 -keystore newandroid.keystore

PS:-alias后面跟着的是别名(android.keystore) -keystore后面跟着的是具体的签名文件(及签名文件的命名–newandroid.keystore)


查看签名和重签名:

使用JDK下keytool


keytool -list -v -keystore xxxx.keystore

查看apk的签名信息:

第一步:将apk解压

第二步:找到META-INF 下的.RSA文件

第三步:在mac终端或者window控制器上输入命令:

keytool -printcert -file xxx.RSA回车,即可查看签名信息(MD5)



new 发布于 2019-9-25 01:06

node-ffi安装 各种技巧

准备

1.node

版本:v8。(v10,v12测试不通过)

最好是:https://npm.taobao.org/mirrors/node/v8.12.0/node-v8.12.0-linux-x86.tar.gz

2.node-gyp(node依赖库)

3.python 2.7 (python3不支持)


注意:32位dll/so需要32位nodejs

安装方法

1.安装python,node,node-gyp

2.设置npm


npm config set python /path/to/executable/python2.7

一、编译源码安装



$ git clone git://github.com/node-ffi/node-ffi.git
$ cd node-ffi
$ node-gyp rebuild

二、使用cnpm安装,npm安装测试不通过


标签: node-ffi c

new 发布于 2019-9-19 02:24

linux时间变慢问题 各种技巧

当Linux启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。

时间同步服务目前有两种:

1.ntpd

2.chronyd


new 发布于 2019-7-11 02:32

new 发布于 2019-5-7 02:42

Ubuntu 12 nfs mount 各种技巧

#sudo apt-get install nfs-kernel-server

ubuntu12.04中的已经是最新版本了,无需安装

打开/etc/exports文件,在末尾加入:

/home/kevin *(rw,sync,no_root_squash)

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/home/kevin:要共享的目录

* :允许所有的网段访问

rw :读写权限

sync:资料同步写入内在和硬盘

no_root_squash:nfs客户端共享目录使用者权限

重启服务:
#sudo /etc/init.d/portmap restart                  <---重启portmap,
#sudo /etc/init.d/nfs-kernel-server restart      <---重启nfs服务
#showmount -e                                          <---显示共享出的目录

注:nfs是一个RPC程序,使用它前,需要映射好端口,通过portmap设定

命令执行情况如下:

kevin@ubuntu:~$sudo /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process 474


kevin@ubuntu:~$sudo /etc/init.d/nfs-kernel-server restart
 * Stopping NFS kernel daemon                                              [ OK ] 
 * Unexporting directories for NFS kernel daemon...                   [ OK ] 
 * Exporting directories for NFS kernel daemon...     

  exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/home/xgc".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x
                                                                                 [ OK ]
 * Starting NFS kernel daemon                                       [ OK ]

kevin@ubuntu:~$showmount -e
Export list for xgc-VirtualBox:
/home/kevin *

 

现在可以在本机上试一下:
#sudo mount -t nfs localhost:/home/kevin /mnt

注:localhost为本机linux的IP地址

这样就把共享目录挂到了/mnt目录,取消挂载用:
#sudo umount /mnt

如果用在嵌入式设备上挂载,要加上参数-o nolock

我在开发板上使用的挂载命令:

mount -t nfs -o nolock 192.168.1.8:/home/kevin /mnt


new 发布于 2019-4-4 02:38

post gbk 游戏服务器

function gbkEncodeURIComponent(str){
var chinese = new RegExp(/[^\x00-\xff]/g);
var gbkBuffer = null;
var i = 0;
var tempStr = '';
if (chinese.test(str)){//
gbkBuffer = iconv.encode(str,'gbk');
for (i;i<gbkbuffer.length;i++){ tempstr="" +="%" gbkbuffer[i].tostring(16);="" };="" return="" tempstr;="" }else{="" str;="" qs.escape(str);="" }="" const="" postdata="qs.stringify(data,null," null,="" {="" encodeuricomponent:="" gbkencodeuricomponent="" })="" axios.post(url,="" postdata,{responsetype:="" "arraybuffer",})="" .then(res=""> {
let str = iconv.decode(res.data, 'gbk');
console.log("receive-----------"+str.toString())
}).catch(err => console.log(err))</gbkbuffer.length;i++){>


new 发布于 2019-1-14 15:59

如何去解决fatal: refusing to merge unrelated histories 各种技巧

我在Github新建一个仓库,写了readme.md,然后把本地一个写了很久仓库上传。





先pull,因为两个仓库不同,发现refusing to merge unrelated histories,无法pull





因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,在git pull,

这句代码是在git 2.9.2版本发生的,最新的版本需要添加--allow-unrelated-histories

git pull origin master --allow-unrelated-histories


new 发布于 2018-11-7 06:33