ubuntu修改grub引导菜单

先运行update-grub命令生成一次grub配置,顺便查看一下识别出来的引导菜单内容 root@alairpc:~# update-grub Generating grub configuration file ... Found linux images: /boot/vmlinuz-4.4.0-21-generic Found initrd images: /boot/initrd.img-4.4.0-21-generic Found memtest86+ images: /boot/memtest86+.elf Found memtest86+ images: /boot/memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done root@alairpc:~# 注意看,以上共有5个菜单项,最后一个是windows7 接下来我们来看看gurb配置文件/etc/default/grub root@alairpc:~# cat /etc/default/grub # If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT=4 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=3 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX="locale=zh_CN" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' #GRUB_GFXMODE=640x480 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1" 其中GRUB_DEFAULT就是默认引导项,这里设置为4,对应的为windows7,说明一下,这个引导序列号是从0开始排的,所以第五项window7的序列号应为为4 ...

2016年6月27日 · jqx

Let's encrypt 证书快速生成脚本

网站的Let’s encrypt证书快到期了,看了官方的续期方法比较繁琐,于是在网上找了找简单方便做法,结果找到了墓地小企鹅写的一个脚本(shell script),使用这个脚本可以方便的生成以及更新Let’s encrypt 证书。 脚本地址 https://github.com/xdtianyu/scripts/tree/master/lets-encrypt 下载脚本 wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.conf wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.sh 配置 root@rnse:~/lesh# cat letsencrypt.conf # only modify the values, key files will be generated automaticly. ACCOUNT_KEY="letsencrypt-account.key" DOMAIN_KEY="alair.key" DOMAIN_DIR="/data/wwwroot/alair.cn/compiled" DOMAINS="DNS:alair.cn,DNS:www.alair.cn" #ECC=TRUE #LIGHTTPD=TRUE 按照需要自定义DOMAIN_KEY、DOMAIN_DIR、DOMAINS三部分。 生成证书 root@rnse:~/lesh#chmod +x letsencrypt.sh root@rnse:~/lesh# ./letsencrypt.sh letsencrypt.conf Generate account key... Generating RSA private key, 4096 bit long modulus ..............................++ ....++ e is 65537 (0x10001) Generate domain key... Generating RSA private key, 2048 bit long modulus ...............................................................+++ ..........................+++ e is 65537 (0x10001) Generate CSR...alair.csr Parsing account key... Parsing CSR... Registering account... Registered! Verifying www.alair.cn... www.alair.cn verified! Verifying alair.cn... alair.cn verified! Signing certificate... Certificate signed! New cert: alair.chained.crt has been generated 生成后的目录文件如下: ...

2016年5月9日 · jqx

使用Syncthing在多个设备之间同步文件

Syncthing是一款开源的多平台同步软件,使用他可以在多个设备间进行文件同步,并且带有版本控制功能。 Syncthing官网地址 **https://syncthing.net/**Github地址 https://github.com/syncthing/syncthing 安装Syncthing Syncthing官网提供多平台安装包,下载地址为 https://github.com/syncthing/syncthing/releases/ 并且针对Debian/Ubuntu平台,官方提供了apt-get安装方法 # Add the release PGP keys: curl -s https://syncthing.net/release-key.txt | sudo apt-key add - # Add the "release" channel to your APT sources: echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list # Update and install syncthing: sudo apt-get update sudo apt-get install syncthing 运行Syncthing Linux下直接使用syncthing命令运行 syncthing & Windows下直接打开下载的syncthing.exe文件,而后浏览器自动打开http://127.0.0.1:8384进行设置管理。 管理Syncthing 如果是在VPS上安装Syncthing ,运行syncthing后,只能通过http://127.0.0.1:8384进行管理,我们可以通过以下方法在本地管理。 ssl -L 9891:localhost:8384 root@ip 输入root密码登录成功后,即可本地浏览http://127.0.0.1:9891对VPS上的Synchting进行管理。 添加设备 每个设备均有一个设备标识,可以通过操作->显示设备标识来查看。 不同的设备之间进行链接,就是通过添加对方的设备标志来实现。 ...

2016年5月6日 · jqx

树莓派可用的PCD8544库

Nokia 3310/5110显示器基于PCD8544,在此分享一个树莓派可用的PCD8544库 使用该库之前,需要安装wiringPi,安装方法可参考树莓派连接DHT11采集温度与湿度 项目地址:https://github.com/binerry/RaspberryPi/tree/master/libraries/c/PCD8544 可通过github download直接下载,不能访问github的,用以下连接下载 http://0x8.net/res/Raspberry.Pi_PCD8544.Library.zip 解压后,可得到一个c源码和一个h头文件 PCD8544.c PCD8544.h 以及samples文件夹下的三个示例 pcd8544_rpi.c pcd8544_test.c pcd8544_test2.c 按照下图所示连接好树莓派和显示器 RST —— 复位 接GPIO 0 CE —— 片选 接GPIO 1 或 不接 DC —— 数据/指令选择 接GPIO 2 DIN —— 串行数据线 接GPIO 3 CLK —— 串行时钟线 接GPIO 5 (因为我的GPIO 4已经接了一个DHT11传感器) VCC —— 电源输入 接3.3v BL —— 背光控制端 接3.3v GND —— 地线 接地 编译三个示例程序 cc -o pcd8544_test pcd8544_test.c ../PCD8544.c -L/usr/local/lib -lwiringPi cc -o pcd8544_test2 pcd8544_test2.c ../PCD8544.c -L/usr/local/lib -lwiringPi cc -o pcd8544_rpi pcd8544_rpi.c ../PCD8544.c -L/usr/local/lib -lwiringPi 然后运行 ...

2016年4月18日 · bbq

使用OptiPNG优化压缩图片

因工作需要,得处理一张7872x5904体积为178MB的图片,格式为TIFF。 网上搜了半天,找到一个名为OptiPNG的软件,主要为PNG优化,但也支持TIFF格式。 下面是OptiPNG的官方介绍 OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections. OptiPNG可以将PNG文件重新压缩,压缩后体积变得更小,并且不会丢失任何信息。同时optipng还支持其他格式的图片,如BMP、GIF、PNM和TIFF。 至于OptiPNG的威力如何,请看本次实例,下载 optipng-0.7.8.tar.gz,密码3705。 root@raspi:~# ls -lh huxian.tif -rw-r--r-- 1 root root 178M Apr 4 16:54 huxian.tif //原始文件178MB root@raspi:~# optipng huxian.tif ** Processing: huxian.tif Importing TIFF 7872x5904 pixels, 4x8 bits/pixel, RGB+alpha //分辨率7872x5904 Reducing image to 3x8 bits/pixel, RGB Input file size = 186000368 bytes Trying: zc = 9 zm = 8 zs = 0 f = 0 IDAT size = 4273133 Selecting parameters: zc = 9 zm = 8 zs = 0 f = 0 IDAT size = 4273133 Output file: huxian.png Output IDAT size = 4273133 bytes Output file size = 4273190 bytes (181727178 bytes = 97.70% decrease) root@raspi:~# ls -lh huxian* -rw-r--r-- 1 root root 4.1M Apr 4 17:02 huxian.png //压缩结果4.1MB -rw-r--r-- 1 root root 178M Apr 4 16:54 huxian.tif 看来OptiPNG还是很牛的嘛!!! ...

2016年4月3日 · jqx