Mryqu's Notes


  • 首页

  • 搜索
close

MIUI12.5关闭充电提示音

时间: 2021-08-31   |   分类: Tool     |   阅读: 32 字 ~1分钟
自从手机升级到MIUI12.5,原来关闭提示音就又出现了。 在“设置-声音与振动-更多声音设置”里面关闭了所有提示音,可是充电提示音依旧存在。上网一查,原来充电提示音变成不可配置的了。 下载Android SDK Platform-Tools ,执行adb程序无法找到任何设备。 C:\temp\platform-tools_r31.0.3-windows\platform-tools>adb devices List of devices attached 在手机上执行如下操作: 设置—我的设备—全部参数—连续点击MIUI版本直至提示开发者模式已打开 设置-更多设置-开发者选项-激活USB调试、USB调试(安全设置) 重新执行adb程序: C:\temp\platform-tools_r31.0.3-windows\platform-tools>adb devices List of devices attached ******** device C:\temp\platform-tools_r31.0.3-windows\platform-tools>adb shell settings put global power_sounds_enabled 0 成功!

[GoLang] go get github.com/jessevdk/go-assets解决记录

时间: 2021-03-19   |   分类: Golang     |   阅读: 510 字 ~3分钟
在我的Cenos服务器上无法获取go-assets,结果如下: MRYQULAX> go get github.com/jessevdk/go-assets # cd .; git clone -- https://github.com/jessevdk/go-assets /users/mryqu/go/src/github.com/jessevdk/go-assets Cloning into '/users/mryqu/go/src/github.com/jessevdk/go-assets'... fatal: unable to access 'https://github.com/jessevdk/go-assets/': SSL connect error package github.com/jessevdk/go-assets: exit status 128 看了一下我的git版本是1.7.1,先升级一下试试吧。 export VER="2.31.0" wget https://github.com/git/git/archive/v${VER}.tar.gz tar -xvf v${VER}.tar.gz rm -f v${VER}.tar.gz cd git-* make configure sudo ./configure --prefix=/usr sudo make sudo make install 升级完成后,还是无法获取go-assets。 调试一下ssh方式: MRYQULAX> ssh -vT git@github.com OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 debug1: Reading configuration data /users/mryqu/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to github.
阅读全文 »

GoLang语言filepath.Clean功能在AIX脚本中的实现

时间: 2021-02-23   |   分类: Tool   Linux     |   阅读: 162 字 ~1分钟
GoLang语言filepath包Clean函数功能如下: Replace multiple Separator elements with a single one. Eliminate each . path name element (the current directory). Eliminate each inner .. path name element (the parent directory) along with the non-.. element that precedes it. Eliminate .. elements that begin a rooted path: that is, replace “/..” by “/” at the beginning of a path, assuming Separator is ‘/’. perl等价功能 File::Spec 模块的canonpath函数与GoLang语言filepath包Clean函数功能基本类似,都不进行文件系统物理检查仅完成路径逻辑清理。 No physical check on the filesystem, but a logical cleanup of a path.
阅读全文 »

在Centos上安装Perl LibXML库记录

时间: 2021-01-04   |   分类: Tool   Linux     |   阅读: 14882 字 ~70分钟
一开始使用cpan安装,揍是不成功。 [root@mryqulax ~]# perldoc -m XML::LibXML No module found for "XML::LibXML". [root@mryqulax ~]# perl -MCPAN -e shell Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan[1]> install XML::LibXML CPAN: Storable loaded ok (v2.20) Reading '/root/.cpan/Metadata' Database was generated on Sun, 24 Nov 2013 10:53:02 GMT CPAN: LWP::UserAgent loaded ok (v6.04) CPAN: Time::HiRes loaded ok (v1.9721) Fetching with LWP: ftp://cpan.cs.utah.edu/CPAN/authors/01mailrc.txt.gz Reading '/root/.
阅读全文 »

Shell之rev与tac

时间: 2020-12-29   |   分类: Tool   Linux     |   阅读: 19 字 ~1分钟
今天想把一个文件内容反序输出,就找到了rev与tac这两个命令。 rev是对每一行内容进行反序,行序不变 tac是对行序反序, 每一行内容不变 mryqulax> cat test.log whoami 123 mryqulax> rev test.log imaohw 321 mryqulax> tac test.log 123 whoami

AIX操作笔记

时间: 2020-12-23   |   分类: Tool   Linux     |   阅读: 2727 字 ~13分钟
查看版本 TL(Technical Level)指 AIX 操作系统的技术版本(以前称为 ML, Maintenance Level),包括硬件、软件的新功能和传统的补丁。 SP( Service Pack) 指服务补丁版本,包括一些不能等到下一个TL推出的关键的补丁及非常有限的新硬件驱动。 $ oslevel -s 7100-04-04-1717 上例中oslevel -s显示结果为7100-04-04-1717,头四位系统版本,接下来两位为技术版本,之后两位为补丁版本,最后4位,前2位标识年份,后2位表示周。 7100-04-04-1717表示AIX7.1 TL版本04,SP版本04,这个版本是在2017年第17周进行的更新。 安装软件 在ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/ 查找到所需软件的链接,然后通过rpm进行安装。例如: rpm -Uvh ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/curl/curl-7.9.3-2.aix4.3.ppc.rpm 查看系统指标 bindprocessor bindprocessor 用于将进程的内核线程绑定至处理器或取消绑定。 $ bindprocessor -q The available processors are: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 lparstat lparstat 报告逻辑分区(LPAR)相关信息和统计。
阅读全文 »

Shell读取文件修改时间并格式化输出

时间: 2020-12-23   |   分类: Tool   Linux     |   阅读: 388 字 ~2分钟
最近有一些golang代码实现的功能需要移植到用于低版本AIX的korn shell上去。其中碰到了文件修改时间格式化问题。 通过下面的golang示例代码可知最后需要的是本地时间而不是UTC时间。 package main import ( "fmt" "log" "os" "path/filepath" "time" ) // Infrastructrue var basedir string func init() { exe, err := os.Executable() if err != nil { os.Exit(1) } basedir = filepath.Dir(exe) } func main() { fmt.Printf("now=%s\n", time.Now().Format("02Jan06:15:04:05")) fmt.Printf("now.UTC()=%s\n", time.Now().UTC().Format("02Jan06:15:04:05")) fmt.Printf("now.Local()=%s\n", time.Now().Local().Format("02Jan06:15:04:05")) f, ferr := os.Lstat(basedir) if ferr != nil { fmt.Printf("Unable to access %s. Skipping...\n", basedir) os.Exit(1) } mode := f.Mode() if mode&os.ModeSymlink != 0 { fmt.
阅读全文 »

Shell逐行读取、解析并export变量实践

时间: 2020-12-15   |   分类: Tool   Linux     |   阅读: 96 字 ~1分钟
setenv.yaml示例 MY_HOME: /local/install/myhome MY_JAVA_HOME: $MY_HOME/jre/bin test.ksh示例 #!/bin/ksh getCustEnv() { # 除了while read 也可以使用for var,但是需要更改IFS为换行符 cat setenv.yaml | while read line; do line=$(echo $line | grep -v "^\s*#" | grep ":") if [ ! -z $line ]; then key=$(echo $line | cut -d: -f1 | sed -e 's/^\s*//' -e 's/\s*$//') val=$(echo $line | cut -d: -f2 | sed -e 's/^\s*//' -e 's/\s*$//') echo "line=$line" echo "key=$key" echo "val=$val" if [ ! -z $key ]; then echo "export $key=$val" # 不可以直接执行export,否则变量值还是字符串,例如MY_JAVA_HOME变量值仍为$MY_HOME/jre/bin,而不是/local/install/myhome/jre/bin eval export $key=$val # 变量的二次引用 这里${!
阅读全文 »

sed正则表达式捕获组实践

时间: 2020-12-04   |   分类: Tool   Linux     |   阅读: 62 字 ~1分钟
mryqu> cat test.txt Hello from="Beijing" via="Nanjing" to="Shanghai". test 123 mryqu> sed -e 's/^Hello.*from="[^"]\+".*$/abc/g' test.txt abc test 123 mryqu> sed -e 's/^Hello.*from="\([^"]\+\)".*$/\1/g' test.txt Beijing test 123 mryqu> sed -e 's/^\(Hello.*from="\)\([^"]\+\)\(".*\)$/\1********\3/g' test.txt Hello from="********" via="Nanjing" to="Shanghai". test 123 mryqu> sed -e 's/^\(Hello.*from="\)\([^"]\+\)\(".*\)$/\1********\3/g' -e 's/^\(Hello.*to="\)\([^"]\+\)\(".*\)$/\1********\3/g' test.txt Hello from="********" via="Nanjing" to="********". test 123 mryqu> 注:sed不支持非贪婪模式。 参考 Sed教程-正则表达式 grep、sed、awk、perl等对正则表达式的支持的差别 How to output only captured groups with sed?

Shell显示彩色文字

时间: 2020-11-26   |   分类: Tool   Linux     |   阅读: 189 字 ~1分钟
昨天学习一下如何使用shell在屏幕显示彩色文字。解决方案有两种:1. 转义字符 2. tput设置文本颜色。 在Linux上这两种方式都正常工作,在FreeBSD上第二种方式不起作用。 代码如下: #!/bin/ksh println() { printf "%s\n" $* } ########################## # Solution 1 ########################## colorsEnabled() { if [ $TERM == 'TERM' ] then return 0 fi return 1 } printlnColor() { c=$1 shift msg=$*; colorsEnabled if [ $? == 1 ] then printf "\033[0;%dm%s\033[0m\n" $c "$msg" else printf "%s\n" "$msg" fi } # Success printlnSuccess() { printlnColor 32 $* } # Warning printlnWarning() { printlnColor 33 $* } # Failure printlnFailure() { printlnColor 31 $* } # Verbose printlnVerbose() { printlnColor 35 $* } # Emphasis printlnEmphasis() { printlnColor 36 $* } # Note printlnNote() { printlnColor 37 $* } ########################## # Solution 2 ########################## println_color() { c=$1 shift msg=$*; tput setaf $c printf "%s\n" "$msg" tput sgr0 } # Success println_success() { println_color 2 $* } # Warning println_warning() { println_color 3 $* } # Failure println_failure() { println_color 1 $* } # Verbose println_verbose() { println_color 5 $* } # Emphasis println_emphasis() { println_color 6 $* } # Note println_note() { println_color 7 $* } printlnEmphasis hahaha 123 echo "=====================" println_emphasis hahaha 123 参考 ANSI Escape sequences Git shell coloring · GitHub tput
1 2 3 4 5 6 7 8

Programmer & Architect

662 日志
27 分类
1472 标签
RSS 订阅
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%