AslroNx's World

wsl2启用

2020-11-28 aslronx

安装 Linux 的时候默认启用 WSL2:
wsl --set-default-version 2

查看当前的版本:
wsl -l -v

切换版本:
wsl --set-version Ubuntu 2

删除:

wslconfig /u OSNAME

标签: 操作系统 WSL

评论(0) 浏览(545)

Ubuntu apt-get 说明

2020-11-28 aslronx

sudo apt-get update  更新源
sudo apt-get install package 安装包
sudo apt-get remove package 删除包
sudo apt-cache search package 搜索软件包
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
sudo apt-get install package --reinstall  重新安装包
sudo apt-get -f install  修复安装
sudo apt-get remove package --purge 删除包,包括配置文件等
sudo apt-get build-dep package 安装相关的编译环境
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-cache depends package 了解使用该包依赖那些包
sudo apt-cache rdepends package 查看该包被哪些包依赖
sudo apt-get source package  下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖

标签: Linux 操作系统 Ubuntu

评论(0) 浏览(488)

Ubuntu 国内镜像-清华大学开源软件镜像站

2020-11-28 aslronx

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/


20.04 LTS


# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse  

标签: Linux 操作系统 Ubuntu

评论(0) 浏览(462)

数组转JSON 保持格式化

2020-11-20 aslronx

$json = json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);

标签: PHP

评论(0) 浏览(474)

Git远程仓库地址变更

2020-9-30 aslronx

来源:https://www.cnblogs.com/vickystudy/p/11505936.html

git remote set-url origin NEW_ORIGIN

标签: Git

评论(0) 浏览(623)

清除 git 版本控制

2020-5-19 aslronx

find . -name ".git" | xargs rm -Rf

标签: Git

评论(0) 浏览(936)

PHP机器学习库php-ml的简单测试和使用

2020-5-11 aslronx

来源:https://www.cnblogs.com/zhnblog/p/7163061.html

标签: PHP 机器学习

评论(0) 浏览(1527)

php将数组或对象原样写入或保存到文件有三种方法可以实现

2020-5-8 aslronx

来源 :https://www.cnblogs.com/ryanzheng/p/9086115.html

第一种方法是使用serialize,

第二种方法是使用print_r,

第三种方法是使用var_export,

本文章向大家介绍这三种方法是如何将数组写入到文件的,需要的朋友可以参考一下。

第一:serialize方法

使用 serialize 将数组序列化,存储在文件中;调用时,再使用 unserialize 还原。

$file = './cache/phone.php';
$array = array(
    'color' => array('blue', 'red', 'green'),
    'size' => array('small', 'medium', 'large')
);
//缓存
if (false !== fopen($file, 'w+')) {
    file_put_contents($file, serialize($array));
    //写入缓存
}
//读出缓存
$handle = fopen($file, 'r');
$cacheArray = unserialize(fread($handle, filesize($file))); 



第二:print_r方法

用print_r 将数组打印到txt文件中。

$b = array('m' => 'monkey',
    'foo' => 'bar',
    'x' => array('x', 'y', 'z'));
$results = print_r($b, true);
file_put_contents('filename.txt', print_r($b, true));


第三:var_export方法

用var_export 直接将数组以完整数组的形式存储到文件中。

$file = './cache/phone.php';
$array = array(
    'color' => array('blue', 'red', 'green'),
    'size' => array('small', 'medium', 'large')
);
//缓存
$text = '<?php $rows=' . var_export($array, true) . ';';
if (false !== fopen($file, 'w+')) {
    file_put_contents($file, $text);
} else {
    echo '创建失败';
}



将对象完整的存储并追加到文件末尾

$file = "notic_" . date("Ymd") . ".log";
$ct = date("Y-m-d H:i:s", time());

file_put_contents($file, var_export($object,true)."\r\n", FILE_APPEND);

 

ps: 正常情况下输出到网页的数组会有限制,

php var_dump函数对数组进行打印时,对多维数组中数组的层级越多越深层,子数组会不显示,只用省略号代替。这样一来不便于程序的调试

php的var_dump函数是php模块中xdebug模块所支持的,所以接下来我们需要配置这个xdebug即可。

修改 php.ini

复制代码
;设置显示最大的子节点数
xdebug.var_display_max_children=128 ;设置显示最大的字节数
xdebug.var_display_max_data=512 ;设置显示最大得层级(深度)
xdebug.var_display_max_depth=15
复制代码

 

然后重启 php 服务

systemctl reload php-fpm nginx

标签: PHP

评论(0) 浏览(616)

未来,轮回,超脱

2020-5-6 aslronx

未来是已经发生过的,我们一直都在重复。 如何跳出轮回。 我想到了一件事,曼德拉效应。 应该不是已经发生过的事,被遗忘了。 可能是预见了未来。 也可能是上个轮回的记忆残留。 如何跳出轮回。 还有个词更恰当。 超脱。 未来一定是已经发生过的。 过去是我们都一遍一遍的重复经历的。 超脱很难。 我们被规则束缚。 超脱很难定义。 也许表面超脱了。 可能我们还在更大的轮回里。 这段文字,可能我已经写了无数遍了。

评论(0) 浏览(569)