PERFECT BLUE

Essays


  • 首頁

  • 關於

  • 標籤

  • 分類

  • 歸檔

  • 站點地圖

  • 檢索

收藏夹

發表於 2020-06-21 | 分類於 收藏夹 |
字數統計: 66 | 閱讀時長 ≈ 1
  • Comparison Sort: Quick Sort(快速排序法)
  • 乱码恢复
  • The Missing Semester of Your CS Education 中文版
教程
  • How I Got My Mom to Play Through Plants vs. Zombies(中文版:游戏教程设计 与 现实中的教学 学习)
其他
  • 上海交通大学生存手册

今日.gitignore不生效?

發表於 2023-03-21 | 分類於 Git |
字數統計: 687 | 閱讀時長 ≈ 4

今天为一个旧的git repository添加了“.gitignore”,但发现gitignore看起来没有生效?然后就必应,然后复制粘贴,有了下面这么一大段。

TL;DR

Step 1. Type the following command and hit Enter to execute it. This command will unstage and remove the path to your files from the Git index.

1
git rm -r --cached .

Step 2. Execute the following command. It will re-add all your files back and only the correct files will be updated.

1
git add .

Step 3. Execute the following command to commit all your files back into the Git index.

1
git commit -m ".gitignore is now working"

After that, you can test the files and see if the git ignore not working issue is fixed or not.

閱讀全文 »

Use Ole DB Providers to talk to Excel 97-2003 Workbook

發表於 2023-03-21 | 分類於 OleDB , C# |
字數統計: 1.6k | 閱讀時長 ≈ 7

施工中……

工事中

好久,好久,好久没有写东西了,见谅。

Outline

  1. Jet and ACE

    1.1. connectionString

  2. XLS query string

    2.1. <> is not null

    2.2. carriage

    2.3. AS

    2.4. SheetName$A1:F(0)

    2.5. select ‘’2022”

    2.6. F1,F2

    2.7. LIKE %

  3. 运行速度/性能问题?

  4. C# DataTable

    4.1. LINQ Cartesian Product

    4.2. Merge DataTable with same column number but different column name

閱讀全文 »

【转载】C# Process运行程序时Console Output的中文乱码

發表於 2022-07-16 | 分類於 Program |
字數統計: 358 | 閱讀時長 ≈ 1

在听 - 周杰倫 蒲公英的约定

最近睡眠质量不是很好,晚上23点困得不行,经常会怀念之前的时光,说话常常词不达意……大概是上了年纪吧。

Jay Chou发新专了,不是很对我的胃口。点开油管,他的老歌倒是很动听,今晚油管还推了杨丞琳和张韶涵的歌,emmm……是心动的感觉。

啊这,怎么这个点了,Lycoris和白皇都更新了……

嘛,赶紧复制黏贴完,洗洗上床看Lycoris,反正这篇的情况和我的一模一样。

閱讀全文 »

日区iOS账号使用腾讯会议

發表於 2022-05-28 | 分類於 iOS , 腾讯会议 |
字數統計: 204 | 閱讀時長 ≈ 1

辣鸡腾讯会议没有在App Store日区商店上架,使用Wechat小程序進入會議的話無法自由收發訊息。艸了,開個會還得想個法子……

閱讀全文 »

VLC同时显示两条Subtitle

發表於 2022-05-14 |
字數統計: 1.6k | 閱讀時長 ≈ 7

这一篇很早之前就应该写好的,结果从5月拖到了7月……原因是!Lockdown!

这次Lockdown真的要把吾辈搞疯了,5月的时候吾辈感觉上还没什么问题。当时把这篇blog所需的材料都找齐后,然后就是例行拖延症……结果拖了一阵子后,发现整个人做什么事情都提不起兴趣,Switch都没有兴趣碰了。那阵子吾辈整天干的事情就是睡觉,和看Youtube木棉花TW的无限《ワンパンマン》马拉松……

最近作息稍稍恢复了点,虽然身体和心理状态没有恢复到Lockdown之前的状态,但好歹是能写一些字了。

其实今天吾辈会又想起要补上这篇是有个契机的。吾辈在写这些文字的时候其实已经是7/18了,昨天干了件很蠢的事情:本来想用~/来写winston的transports路径的,结果没得到想要的效果,看了眼结果在Source目录下新建了一个~目录;当时没动脑子,直接rm -rf ~ Enter一气呵成,结果执行了几秒发现还没结束,当时就发现不对了,赶紧Control+C……

rm执行了大概8s,还是删了不少东西的,由于没有日志,具体损失不明[爆哭],案发现场如下图:

经此一役,吾辈立下几个flag:

  1. 从今以后再敲rm -rf 剁手
  2. 从今以后出门一定穿袜子(MD,吾辈今天出门因为懒没穿袜子,脚又被磨破了)

好吧,第二条和上面说的事完全无关。

虽然这次误删的东西应该不涉及吾辈的生命财产安全,但是以防万一,还是有必要清理一下历史遗产。

好!开始说正题!

之前脑子抽风,想要看双语对照字幕,就像《丸子与银河龙》提供的那样,这就是本文的起源。

这次搞到的视频文件内嵌了多语字幕,原材料是不用再去找了,剩下的全是加工的问题了,本文分两步走:提取内嵌字幕、在VLC中显示两条字幕。

本文唯一指定播放器:VLC media player

提取内嵌字幕

啊,时间有点久了,我记得应该是这样吧:

1
2
3
4
5
6
7
ffmpeg -i Movie.mkv -map 0:s:0 subs.srt

# -i: Input file URL/path.
# -map: Designate one or more input streams as a source for the output file.
# s:0: Select the subtitle stream.
# This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.
# To extract more subtitles at once you have to duplicate the -map parameters for each file. Also include -c copy so that it just extracts the file without trying to process it: ffmpeg -i Movie.mkv -c copy -map 0:s:0 subs.01.srt -c copy -map 0:s:1 subs.02.srt. Anyway it will take long time because ffmpeg must read whole video file to find all parts of the subtitle streams.

如果还有问题请参考下面的Reference,当时这条解决了我的问题。

Reference

  1. How to extract subtitle from video using ffmpeg?

字幕插件:Subtitler lite mod

Source & Manual: Subtitler lite mod v1.3

从上面的链接下载Subtitler lite mod,并放到指定位置:

1
2
3
4
5
6
7
8
9
10
INSTALLATION:
- extract (unzip) the .lua file and put it in the VLC subdir /lua/extensions, by default:
* Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\extensions\
* Windows (current user): %APPDATA%\VLC\lua\extensions\
* Linux (all users): /usr/lib/vlc/lua/extensions/
* Linux (current user): ~/.local/share/vlc/lua/extensions/
* Mac OS X (all users): /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
* Mac OS X (current user): /Users/%your_name%/Library/Application Support/org.videolan.vlc/lua/extensions/
(create directories if they don't exist)
- Restart VLC or just reload extensions (Tools > Plugins and extensions > Active Extensions tab: Reload extensions button).

至此,Subtitler lite mod安装完毕,使用方法如下:

1
2
3
4
5
Then you simply start the extension in VLC menu "View" or "Vlc > Extensions" on Mac OS.

The extension will try to load SRT subtitle file of the same name and location as a playing media ("d:\films\film.avi" --> "d:\films\film.srt").

Then you need to keep pressing the [Refresh] button in the dialog box.

如果插件显示的文字是乱码的话,用户需要根据需求改一下插件的lua脚本。脚本开头定义了编码格式参数,默认应该是Windows-1250。

但是,一直按「Refresh」也太蠢了吧!

所以,插件的Description中,作者贴心地提供了各种系统下的Key Sender:

1
2
3
4
5
6
7
8
9
You rather use some button presser / key sender. Following ones are included in the package:
- "keypresser(Windows).vbs", a simple VBScript for Windows users;
- "buttonpresser(Mac).applescript", a simple AppleScript for Mac OS X users
http://addons.videolan.org/content/show.php?content=152364&forumpage=1#c473169
- "keeping-press-enter(Linux).sh" - Linux, xdotool - A shell script:
http://wikiwiki.jp/disklessfun/?misc1#e976f4fa
"sleep 0.1" or "usleep 100000" instead of "sleep 1"?
- "subtitlerlite.ahk" - AutoHotkey script for Windows:
https://forum.videolan.org/viewtopic.php?f=29&t=97791&start=40#p407054

下面讲一下Linux下的操作。

作者提供的Linux下的脚本:

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
#!/bin/sh
TITLE="Subtitler \(lite\) mod"
MSG="Pressing Enter key"
FLG=true

zenity --progress --pulsate --no-cancel --text="${MSG}" \
--title="${MSG}" &
SPID=$!

while true
do

if test `ps --pid ${SPID}|wc -l` -le 1; then
break
fi

xdotool search --name "${TITLE}" windowactivate
if test $? -eq 0 && $FLG; then
xdotool getactivewindow windowmove 0 0
FLG=false
fi

xdotool search --name "${TITLE}" key "Return"
if test $? -ne 0; then
kill ${SPID} 2>/dev/null
break
fi

sleep 1
done

将脚本下载到任意位置(因为以后也不会直接运行这个脚本,Manjaro下直接在Terminal运行这个脚本的话,Terminal会不停地变成最前面的窗口,这还怎么看视频?),并为这个脚本创建launcher。

Create *.desktop file, location depends on if it is for personal use or all users. If these directories do not exist, create them.

For personal use, ~/.local/share/applications

1
gedit ~/.local/share/applications/subtitler.desktop

然后编辑该文件,贴上以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
[Desktop Entry]
Categories=AudioVideo;Player;Recorder;
Comment=Use with Subtitler (lite) mod. Keep pressing the [Refresh] button in the dialog box.
Exec=~/Desktop/subtitler-keeping-press-enter.sh
GenericName=Use with Subtitler (lite) mod. Keep pressing the [Refresh] button in the dialog box.
Icon=map-globe
Keywords=Player;Subtitle;
Name=Subtitler Press
StartupNotify=true
Terminal=false
Type=Application
Version=1.0

Edit Icon= and Exec=
Exec填上刚刚脚本下载到的路径;Icon嘛,有兴趣的话选上自己喜欢的Icon,其实也可以不填。

至此,大功告成!

然后就可以愉快的打开视频,在VLC内选好第一条与视频文件名不一样的字幕,打开Subtitler lite mod,再打开刚才创建的launcher,再次愉快的看视频了(原谅吾辈的辞藻匮乏,用了两次愉快……)

Reference

  1. A shell script for Subtitler (lite) mod (VLC 2.1+ extention)
  2. How to add a shell script to launcher as shortcut

hexo_配置sitemap

發表於 2022-04-06 |
字數統計: 0 | 閱讀時長 ≈ 1

Hexo配置Google Analytics

發表於 2022-04-03 | 分類於 Google Analytics , Hexo |
字數統計: 365 | 閱讀時長 ≈ 1

最近心血来潮,又想配置一下Google Analytics,这次终于配成功了。

其实配这个本身很简单,在config文件预留的地方加上追踪 ID 就OK了,

1
2
3
4
5
### As follows is part of the NexT config file

# Google Analytics
google_analytics:
tracking_id: UA-XXXXXXXX-X

但是NexT主题需要 UA 开头的追踪 ID ,我之前一直卡在了这一步(因为网上的教程都略过了讲如何获取UA开头的追踪 ID,连NexT官方文档都说Google track ID always starts with UA-,真是令人智熄……)。

嘛,不过Universal Analytics properties will stop processing data on July 1, 2023……

閱讀全文 »

导入微信透明贴图

發表於 2022-03-23 | 分類於 贴图 , 微信 |
字數統計: 269 | 閱讀時長 ≈ 1

微信的贴图与直接传送图片不同,可以做到不显示透明的背景,而直接传送有透明背景的PNG或是WEBP则会有白色或者黑色的背景,来看看怎么做吧。(题外话:QQ在聊天界面会把PNG的透明背景显示为白色)

閱讀全文 »

LINE贴图与APNG

發表於 2022-03-21 | 分類於 APNG , LINE贴图 |
字數統計: 599 | 閱讀時長 ≈ 2

找贴图!找会动的贴图!找可爱的贴图!

又心血来潮开始找贴图了,过年的时候用的WhatSticker,这次又上去逛了一圈,感觉没有什么有新意的贴图。想了想,还是到LINE上去找找吧。

上次去LINE上找贴图感觉已经是好久之前的事情了,只模糊的记得要先提取一个贴图包的ID,然后拼出一个下载网址,然后就可以下到贴图了。这次Google了一下如何提取LINE贴图,感觉相关的教程比之前难检索了……

不过,搜了一晚上,总算是有点成果,在此全部搬运到这儿,以备不时之需。
(其实全是根据参考链接四里找到的)

閱讀全文 »
12…15

Kronos

148 文章
165 分類
82 標籤
RSS
© 2019 — 2023 Kronos
由 Hexo 強力驅動
|
主題 — NexT.Gemini v5.1.4