Valar Morghulis


  • 首页

  • 分类

  • 归档

  • 标签

ARTS-week-06

发表于 2019-04-30 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

Example 1:

1
2
Input: "()"
Output: true

Example 2:

1
2
Input: "()[]{}"
Output: true

Example 3:

1
2
Input: "(]"
Output: false

Example 4:

1
2
Input: "([)]"
Output: false

Example 5:

1
2
Input: "{[]}"
Output: true

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
mapping = {
'(': ')',
'[': ']',
'{': '}'
}
stack = []
for c in s:
if c in mapping:
stack.append(c)
else:
if not stack or mapping[stack.pop()] != c:
return False
return False if stack else True

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

An Introduction to Big Data Concepts and Terminology

系统概述了大数据行业及解释了相关术语

https://www.digitalocean.com/community/tutorials/an-introduction-to-big-data-concepts-and-terminology

3.Tip

生活技巧,学习技巧、工具

如何让Markdown另起一页

  • Markdown支持HTML语法

    1
    <div style="page-break-after: always;"></div>

4.Share

ffmpeg简单使用(1)-转码、添加字幕

https://paranoid-kid.github.io/2019/04/30/ffmpeg简单使用-1/

ffmpeg简单使用(1)-转码、添加字幕

发表于 2019-04-30 | 分类于 Multimedia

h.264 转 h.265

1
$ ffmpeg -i source [H264video] -i -c:v libx265 [outputVideo]

e.g.

1
$ ffmpeg -i billions.s01e02.1080p.bluray.x264.mkv -c:v libx265 billions.s01e02.1080p.bluray.x265.mkv

添加字幕

1
$ ffmpeg -i source Video.mkv -i source Subtitle.srt -c copy outputVideo.mkv

e.g.

1
$ ffmpeg -i billions.s01e01.1080p.bluray.x265.mkv -i Billions.S01E01.Pilot.720p.BluRay.x264.srt -c copy billions.s01e01.1080p.bluray.x265-ch.en.mkv

批量处理

Mac & Linux下可以使用shell批量处理,Win下使用Python批量处理:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
video_format = '.mkv'
episode_num = 3
path = ‘C:\Billions.S01.1080p.BluRay.x264\srt'
file_list = os.listdir(path)
video_list = [file for file in file_list if file.endswith(video_format)]
print(video_list)
for num, video in enumerate(video_list, start=episode_num):
# print(num, video)
# command = 'ffmpeg -i {0} -i billions.s01e0{1}.srt -c copy billions.s01e0{1}.1080p.bluray.x264-ch.en.mkv'.format(video, num)
command = 'ffmpeg -i {0} -c:v libx265 billions.s01e0{1}.1080p.bluray.x265.ch.en.mkv'.format(video, num)
os.system(command)

转换文件编码格式(GBK -> UTF-8):

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import codecs
import chardet
def convert(file, in_enc="GBK", out_enc="UTF-8"):
"""
该程序用于将目录下的文件从指定格式转换到指定格式,默认的是GBK转到utf-8
:param file: 文件路径
:param in_enc: 输入文件格式
:param out_enc: 输出文件格式
:return:
"""
in_enc = in_enc.upper()
out_enc = out_enc.upper()
try:
print("convert [ " + file.split('\\')[-1] + " ].....From " + in_enc + " --> " + out_enc )
f = codecs.open(file, 'r', in_enc, errors='ignore')
new_content = f.read()
codecs.open(file, 'w', out_enc).write(new_content)
# print (f.read())
except IOError as err:
print("I/O error: {0}".format(err))
def list_folders_files(path):
"""
返回 "文件夹" 和 "文件" 名字
:param path: "文件夹"和"文件"所在的路径
:return: (list_folders, list_files)
:list_folders: 文件夹
:list_files: 文件
"""
list_folders = []
list_files = []
for item in os.listdir(path):
file_path = os.path.join(path, item)
if os.path.isdir(file_path):
list_folders.append(item)
else:
list_files.append(item)
return (list_folders, list_files)
#将路径下面的所有文件,从原来的格式变为UTF-8的格式
if __name__ == "__main__":
path = r'Z:\影音\剧\Billions.S01.1080p.BluRay.x264-ROVERS[rartv]\亿万1BD-DEMAND'
(list_folders, list_files) = list_folders_files(path)
print("Path: " + path)
for file_name in list_files:
file_path = os.path.join(path, file_name)
# filePath = path + '\\' + fileName
with open(file_path, "rb") as f:
data = f.read()
encoding_type = chardet.detect(data)['encoding']
convert(file_path, encoding_type, 'UTF-8') # GB18030

ARTS-Week-05

发表于 2019-04-30 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string "".

Example 1:

1
2
Input: ["flower","flow","flight"]
Output: "fl"

Example 2:

1
2
3
Input: ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.

Note:

All given inputs are in lowercase letters a-z.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ''
max_str = max(strs)
min_str = min(strs)
for index, value in enumerate(min_str):
if value != max_str[index]:
return min_str[:index]
return min_str

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

在Hexo博客里引用Jupyter notebook内容

较全面的介绍了如何在博客里显示Jupyter Notebook格式的内容。

https://medium.com/@juanx002/blogging-jupyter-notebooks-ipynb-with-hexo-on-github-7948b72636dc

3.Tip

生活技巧,学习技巧、工具

在线时区换算工具

  • 以后会考虑自己写一个转换脚本

地址:http://www.timebie.com/

4.Share

Numpy简单使用

https://paranoid-kid.github.io/2019/04/30/Numpy简单使用/

NumPy简单使用

发表于 2019-04-30 | 分类于 Python


ARTS-Week-04

发表于 2019-04-16 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Roman to Integer

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

1
2
3
4
5
6
7
8
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000

For example, two is written as II in Roman numeral, just two one’s added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II.

Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:

  • I can be placed before V (5) and X (10) to make 4 and 9.
  • X can be placed before L (50) and C (100) to make 40 and 90.
  • C can be placed before D (500) and M (1000) to make 400 and 900.

Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.

Example 1:

1
2
Input: "III"
Output: 3

Example 2:

1
2
Input: "IV"
Output: 4

Example 3:

1
2
Input: "IX"
Output: 9

Example 4:

1
2
3
Input: "LVIII"
Output: 58
Explanation: L = 50, V= 5, III = 3.

Example 5:

1
2
3
Input: "MCMXCIV"
Output: 1994
Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
mapping = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
}
total = 0
for i in range(len(s) - 1):
if mapping[s[i]] >= mapping[s[i + 1]]:
total += mapping[s[i]]
else:
total -= mapping[s[i]]
return total + mapping[s[-1]]

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

fWaf – Machine learning driven Web Application Firewall

http://web.archive.org/web/20170706222016/http://fsecurify.com/fwaf-machine-learning-driven-web-application-firewall/

[原创翻译] fWaf - 机器学习驱动的WAF

https://www.t00ls.net/thread-50819-1-1.html

3.Tip

生活技巧,学习技巧、工具

各种文件格式转换

  • PDF
  • Word
  • 电子书
  • 图片
  • 视频
  • 音频
  • 压缩

地址:https://www.aconvert.com/cn/

4.Share

[原创翻译] fWaf - 机器学习驱动的WAF

https://www.t00ls.net/thread-50819-1-1.html

ARTS-Week-03

发表于 2019-04-08 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.

Example 1:

1
2
Input: 121
Output: true

Example 2:

1
2
3
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

Example 3:

1
2
3
Input: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

Code

1
2
3
4
5
6
7
8
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
# 先转为String然后反转比较
return False if x < 0 else str(x) == str(x)[::-1]

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

Using Machine Learning to Detect Malicious URLs

http://web.archive.org/web/20170514093208/http://fsecurify.com/using-machine-learning-detect-malicious-urls/

[原创翻译] 使用机器学习方法检测恶意URL

https://www.t00ls.net/thread-50650-1-1.html

3.Tip

生活技巧,学习技巧、工具

使用Markdown排版微信公众号文章

wechat-format可转化 Markdown 到给微信特制的 HTML

项目地址:

https://github.com/lyricat/wechat-format

4.Share

[原创翻译] 使用机器学习方法检测恶意URL

https://www.t00ls.net/thread-50650-1-1.html

ARTS-Week-02

发表于 2019-04-03 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer.

Example 1:

1
2
Input: 123
Output: 321

Example 2:

1
2
Input: -123
Output: -321

Example 3:

1
2
Input: 120
Output: 21

Note:
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.

Code:

1
2
3
4
5
6
7
8
9
10
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
reversed_int = int(str(abs(x))[::-1])
if reversed_int >= 2 ** 31 - 1 or x == 0:
return 0
return reversed_int * -1 if x < 0 else reversed_int

Tips:

  • 将有符号数先取绝对值
  • 使用Python扩展切片反转字符串

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

Machine Learning based Password Strength Classification

http://web.archive.org/web/20170606022743/http://fsecurify.com/machine-learning-based-password-strength-checking/

【原创翻译】基于机器学习的密码强度检测

https://www.t00ls.net/viewthread.php?tid=50581

3.Tip

生活技巧,学习技巧、工具

Online Table Convert Tool

此网站可在线将各种格式的表格数据互相转换

支持导入格式:

  • Excel
  • URL
  • HTML
  • Markdown
  • CSV

支持导出的格式:

  • Excel
  • URL
  • HTML
  • JSON
  • XML
  • YAML
  • SQL
  • LaTeX
  • Markdown
  • CSV/TSV
  • Text

地址:https://tableconvert.com/

4.Share

【原创翻译】基于机器学习的密码强度检测

https://www.t00ls.net/viewthread.php?tid=50581

ARTS-Week-01

发表于 2019-04-03 | 分类于 ARTS

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:

1
2
3
4
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
d = {}
for i, num in enumerate(nums):
# check if num is in the hash map
if num in d:
return [d[num], i]
# (target - num) means what number I want to be added to get the target
d[target - num] = i

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

Using sk-learn to analyze SQL Injection

http://nbviewer.ipython.org/url/raw.github.com/ClickSecurity/data_hacking/master/sql_injection/sql_injection.ipynb

[原创翻译] 使用机器学习方法分析SQL注入

https://www.t00ls.net/thread-50411-1-1.html

3.Tip

生活技巧,学习技巧、工具

Tex & Markdown

如何在Markdown中插入数学公式

Markdown支持Tex语法插入数学公式

  • 行内公式 $ ... $
  • 行间公式 $$ ... $$

常用Command:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\(空格) 词间空格
\sum_{i=0}^{n} 求和符号
^{上标}
_{下标}
\frac{x+y}{2} 分式
\alpha
\\ 换行
\times 乘号
矩阵
\left[
\begin{matrix}
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & w & 0 & 0
\end{matrix}
\right]

更多:

http://docs.mathjax.org/en/latest/tex.html#supported-latex-commands

4.Share

[原创翻译] 使用机器学习方法分析SQL注入

https://www.t00ls.net/thread-50411-1-1.html

Mint基本配置

发表于 2017-11-05 | 分类于 Linux

1.解决上网问题

1.1下载相关软件

1
2
3
4
$ sudo add-apt-repository ppa:hzwhuang/ss-qt5
$ sudo apt update
$ sudo apt install shadowsocks-qt5
$ sudo apt install proxychains

1.2更改 proxychains 文件

将 /etc/proxychains.conf 最后面 sock4 改为 sock5

1.3安装相关软件

1
2
$ sudo -s
$ proxychains bash <(curl -L -s https://install.direct/go.sh)

相关路径:

1
2
/etc/v2ray/config.json
/usr/bin/v2ray/v2ray

× vim 下 快速清空文件:
首先,使用 gg 调整光标到首行,然后使用 dG 命令即可。

2.安装常用开发环境

2.1 配置 Java 环境

2.1.1 apt 安装

1
2
3
4
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt update
$ sudo apt install oracle-java8-installer
$ sudo apt install oracle-java8-set-default

2.1.2 手动安装

1
2
3
$ gunzip jdk-9u90-linux-x64.gz
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk-9u90-linux-x64 /usr/lib/jvm/jdk8

2.1.3 设置 JAVA_HOME

1
2
3
4
5
6
$ vim /etc/profile
添加如下两条
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
export PATH=$JAVA_HOME/bin:$PATH
保存,更新
$ source /etc/profile

2.2 配置 Pycharm / IDEA 快捷方式

创建 Pycharm.desktop 桌面快捷方式:

1
2
3
4
5
6
7
8
9
10
!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Name=Pycharm
GenericName=Pycharm3
Comment=Pycharm3:The Python IDE
Exec=/opt/pycharm-2017.2.3/bin/pycharm.sh
Icon=/opt/pycharm-2017.2.3/bin/pycharm.png
Terminal=pycharm
Categories=Pycharm;

软链接

1
$ sudo ln -s /opt/pycharm-4.0.1/bin/pycharm.sh /usr/bin/pycharm

*IDEA 同理


附:Pycharm安装文档

https://confluence.jetbrains.com/display/PYH/Installing+PyCharm+on+Linux+according+to+FHS

3.其他配置

3.1搜狗输入法

安装完后重启,在 Fcitx 配置里添加即可

将输入法顺序改为:

1
2
3
键盘 - 英语
搜狗拼音
键盘 - 汉语

此时第一个输入法作为非激活状态, Shift 就会在这两个激活的汉字与拼音输入法之间切换。而 Ctrl + Space 则会在非激活与激活的输入法即中文与英文之间切换。

3.2 Conky 配置

主题包 Deluxe_Conky_Theme_Pack.cmtp.7z 下载地址:

http://download1475.mediafire.com/5enbc84w1i5g/5yb5ambg6h4jack/Deluxe_Conky_Theme_Pack.cmtp.7z

导入完成后解决不固定在桌面的问题:

在配置文件里写入:own_window_type desktop

此时 Win + D 就不会让 Conky 消失了

3.3 安装 Windows 字体

可以直接拷贝已有 Windows 系统的字体。

Windows 的字体文件在 C:\Windows\Fonts 里,新建 /usr/share/fonts/WindowsFonts 目录并把字体文件拷贝到其中。

然后更改字体文件的权限:

1
$ sudo chmod 755 /usr/share/fonts/WindowsFonts/*

最后更新字体缓存:

1
$ sudo mkfontscale && mkfontdir && fc-cache -fv

× Linux 自带 Noto Sans Mono CJK 思源黑体等宽也不错

3.4 更改目录为英文

1
2
3
$ export LANG=en_US
$ xdg-user-dirs-gtk-update
$ export LANG=zh_CN

注销或重启后生效。

3.5 Sublime Text 不能使用搜狗输入法解决办法

首先检查是否安装GTK库

1
2
3
4
pkg-config --modversion gtk+ (查看1.2.x版本)
pkg-config --modversion gtk+-2.0 (查看 2.x 版本)
pkg-config --version (查看pkg-config的版本)
pkg-config --list-all grep gtk (查看是否安装了gtk)

如没有的话需要安装

1
$ sudo apt-get install libgtk2.0-dev

然后编译动态库

保存以下代码到 sublime_text.c

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
32
33
34
35
36
37
38
39
/**********************************************************
> File Name: sublime_imfix.c
> Author: GatieMe
> Mail: gatieme@163.com
> Created Time: 2015年04月04日 星期六 20时20分12秒
**********************************************************/
#include <gtk/gtkimcontext.h>
void
gtk_im_context_set_client_window (
GtkIMContext *context,
GdkWindow *window)
{
GtkIMContextClass *klass;
g_return_if_fail (GTK_IS_IM_CONTEXT (context));
klass = GTK_IM_CONTEXT_GET_CLASS (context);
if (klass->set_client_window)
{
klass->set_client_window (context, window);
}
g_object_set_data(G_OBJECT(context),"window",window);
if(!GDK_IS_WINDOW (window))
{
return;
}
int width = gdk_window_get_width(window);
int height = gdk_window_get_height(window);
if(width != 0 && height !=0)
{
}
gtk_im_context_focus_in(context);
}

编译:

1
$ gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC

然后将其拷贝到 /opt/sublime_text 目录下

1
$ sudo cp libsublime-imfix.so /opt/sublime_text/libsublime-imfix.so

修改sublime-text.desktop

1
$ sudo vim /usr/share/applications/sublime_text.desktop

参照如下信息进行修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/usr/bin/subl %F #这里修改执行路径为/usr/bin/subl
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/usr/bin/subl -n #这里修改执行路径为/usr/bin/subl
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/usr/bin/subl new_file #这里修改执行路径为/usr/bin/subl,subl
OnlyShowIn=Unity;

保存后重启软件即可。

Ubuntu折腾日记(2)

发表于 2017-06-06 | 分类于 Linux

Ubuntu折腾日记(2)

1.双系统下无法挂载 NTFS 分区问题

  • 报错:Unable to access “新加卷”
  • 原因:可能是 Win 未正常关机所造成
  • 解决:使用ntfsfix工具
1
sudo ntfsfix /dev/sda1 # /dev/sdaX X 为分区编号

2. 安装 WPS 出现系统缺失字体

  • 原因: WPS for Linux没有自带windows的字体,只要在Linux系统中加载字体即可。
  • 解决:

首先下载缺失的字体文件

地址:https://pan.baidu.com/s/1eS6xIzo

下载完成后,解压并进入目录中,继续执行:

1
sudo cp * /usr/share/fonts
  1. 执行以下命令,生成字体的索引信息

    1
    sudo mkfontscale
    1
    sudo mkfontdir
  2. 运行 fc-cache 命令更新字体缓存

    1
    sudo fc-cache
  3. 重启WPS即可,字体缺失的提示不再出现。

  • WPS 卸载: sudo apt-get remove wps-office

3. 画面撕裂

解决:

1
sudo vim /usr/share/X11/xorg.conf.d/20-intel.conf

创建新文件,写入选项:

1
2
3
4
5
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection

重启后就可以了,至于 NV 显卡是不是有用,不确定

4.查看网络使用情况

使用 nethogs 工具

1
2
sudo apt install nethogs
sudo nethogs

5.rar 文件的批量解压

安装:

1
2
sudo apt-get install rar
sudo ln -fs /usr/bin/rar /usr/bin/unrar

Python脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def getFiles():
return os.popen('ls *.rar').readlines()
def unrarFile(filename):
print ("Processing File " + filename)
print(os.popen('unrar x ' + filename))
def unrarFiles(filenames):
for filename in filenames:
unrarFile(filename.strip())
unrarFiles(getFiles())
-------------------------------------------
$ ./unrar.py
12
小明

小明

微信公众号:一杯过往

15 日志
4 分类
7 标签
RSS
GitHub 博客园 WordPress Email
© 2017 - 2019 小明
0%