JueLuo's Blog


  • Home

  • Categories

  • Archives

  • Tags

  • Search

Debian 安装 NTP 服务同步时间并修改时区

Posted on 2021-04-19 | In Linux , 树莓派

安装 NTP 服务的相关包

1
sudo apt-get install ntp

查看上游时间服务器及相关情况

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
 1.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
 2.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
 3.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.001
-ntp7.flashdance 192.36.143.153   2 u    4   64    3  283.451   26.549  13.112
-ntp1.ams1.nl.le 130.133.1.10     3 u    2   64    3  243.497    7.497  18.333
+ntp1.flashdance 192.36.143.130   2 u    -   64    3  258.727   17.178  18.617
*a.chl.la        131.188.3.222    2 u    3   64    3  191.407   13.202  18.098
-ntp5.flashdance 192.36.143.150   2 u    1   64    3  249.094   13.284  15.109
-ntp.xtom.nl     104.63.202.17    2 u    2   64    3  161.752   13.263  17.390
-time.cloudflare 10.71.14.51      3 u    -   64    3  206.584    8.819  16.999

将服务器修改为上海时区(CST 时间)

1
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

扩展

Linux 有两个时间来源,分别是硬件时间(CMOS 时间)和软件时间(操作系统时间),通常分别使用 hwclock 和 date 命令来访问

Read more »

在 Windows Terminal 中直接打开具有管理员权限的选项卡

Posted on 2021-04-16 | In Windows

思路

在 Linux 下可以使用 sudo 命令来直接提升权限,但是在 Windows 下却没有这样的命令行工具

故选择开源工具 gsudo 来实现类似功能

步骤

  1. 安装 gsudo 直接使用 PowerShell 进行安装

    1
    PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb <https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1> | iex"
    
  2. 根据自身需要选择是否将 sudo 作为别名 Snipaste_2021-04-16_13-27-31.png
  3. 打开 Windows Terminal 设置页面,点击左侧“新增”,右侧内容如图填写 Snipaste_2021-04-16_13-51-39.png
  4. 尝试新建选项卡,已可创建具有管理员权限的 PowerShell 选项卡

缺点

以此法创建的新选项卡仍然会有 UAC 弹框,但双手不用离开键盘即可继续操作

参考

  1. https://github.com/gerardog/gsudo
  2. https://blog.poychang.net/run-windows-terminal-as-administrator-with-elevated-admin-permissions/
Read more »

让非 root 用户使用 docker

Posted on 2021-03-23 | In Linux , Docker

将当前用户加入 docker 组

1
sudo gpasswd -a ${USER} docker

重新启动 docker 服务

1
sudo systemctl restart docker

重新登录该用户即可使用

Read more »

无线路由器当无线 AP 使用的方法(TP-LINK)

Posted on 2021-02-15 | In 网络
  1. 登录路由器
  2. 配置好无线信号
  3. 关闭 DHCP 服务
  4. 修改管理地址(LAN 口的 IP 地址)
  5. 将前端路由器的与该路由器的 LAN 口连接

参考资料(来自官网): https://service.tp-link.com.cn/detail_article_336.html

Read more »

一个冷知识:PPT里的所有纸张尺寸都是错的

Posted on 2020-12-17 | In MicrosoftOffice

比如 A4 不是真的 A4 大小,A3 也不是真的 A3

而且不是等比缩放,而是连比例都不对

010.jpg 011.jpg

参考: https://weibo.com/1757693565/JyJgS5l0y

Read more »

VS Code 启用用 Ctrl + 滚轮 进行字体大小调整

Posted on 2020-12-17 | In VS Code

设置项位置如下:

File -> Preferences -> Settings -> Text Editor -> Mouse Wheel Zoom

亦可直接在设置内搜索 editor.mouseWheelZoom

Read more »

树莓派安装 Resilio Sync

Posted on 2020-11-16 | In 树莓派

注册 Resilio 存储库

创建文件 /etc/apt/sources.list.d/resilio-sync.list 并写入下面内容来注册 Resilio 存储库:

1
echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list

添加公钥

下载 Resilio 软件源公钥并添加到 apt 信任列表:

1
curl -LO http://linux-packages.resilio.com/resilio-sync/key.asc && sudo apt-key add ./key.asc

安装 Resilio Sync 套件

使用下面命令安装:

1
2
sudo apt-get update 
sudo apt-get install resilio-sync

使用方法

输入 sudo service resilio-sync start 启动 Resilio Sync

浏览器使用 IP 加端口号即可进入管理页面,默认端口号为 8888

开机启动

使用 sudo systemctl enable resilio-sync 即可

参考资料

官方手册:https://help.resilio.com/hc/en-us/articles/204762449-Guide-to-Linux

Read more »

树莓派禁用 IPv6(Debian8 适用)

Posted on 2020-11-16 | In Linux , 树莓派
  1. 使用 ifconfig 命令查看是否拥有 IPv6 地址,inet6 addr 开头的这一行即为 IPv6 地址

    1
    2
    3
    4
    Link encap: Ethernet Hwaddr a4: 17:31:f5:24:C4
    inet addr: 192.168.1.101 Bcast: 192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80: :a617:31ff:fef5:24C4/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1
    
  2. 编辑 /etc/sysctl.conf 文件(需要 root 权限),添加如下内容

    1
    2
    3
    4
    # disable IPv6
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    
  3. 重新加载 /etc/sysctl.conf 配置文件

    1
    sudo sysctl -p
    
  4. 再次使用 ifconfig 命令检查 IPv6,可以看到已经没有 IPv6 地址

Read more »

几个 Windows 使用小技巧

Posted on 2020-11-03 | In Windows

快速访问文件资源管理器

Win + E ,文件管理器的选项里可以调整“快速访问”和“默认打开位置”

多用户自动登录

  1. 打开“运行”(Win + R)
  2. 输入 control userpasswords2 ,弹出“用户账户”对话框
  3. 在“用户”的选项卡里面的“本机用户”点击想要指定自动登录的用户
  4. 取消勾选“要使用本机,用户必须输入用户名和密码”
  5. 点击“应用”,弹出要求输入密码的对话框,输入密码,确定
Read more »

IDEA 快速生成 UML 类图

Posted on 2020-10-17 | In Java
  1. 打开设置 File -> Setting (Windows 下按 Ctrl + Alt + S)
  2. 在搜索框中输入 Diagram
  3. 勾选所需的项目image.png
  4. 选择需要生成类图的类文件,在编辑器中打开它
  5. Windows 下按 Ctrl + Shift + Alt + U ,即可生成类图
Read more »
1 … 3 4 5 … 7
JueLuo

JueLuo

The better we get at getting better, the faster we will get better.

65 posts
21 categories
86 tags
GitHub Weibo Steam
© 2015 - 2024 JueLuo
Powered by Jekyll
Theme - NexT.Pisces