發表文章

目前顯示的是 1月, 2018的文章

github delete remote branch/tag

https://help.github.com/articles/pushing-to-a-remote/ delete remote branch git push <REMOTENAME> : <BRANCHNAME>   However, here, you're telling Git to push nothing into BRANCHNAME on REMOTENAME . Because of this, git push deletes the branch on the remote repository.        delete remote tag https://stackoverflow.com/questions/5480258/how-to-delete-a-git-remote-tag github的tag一定是 create time,無法push過去的tag

github co-authors

https://help.github.com/articles/creating-a-commit-with-multiple-authors/ commit message中空兩行 Co-authored-by: Joel Califa <602352+califa@users.noreply.github.com> Co-authored-by: Matt Clark <44023+mclark@users.noreply.github.com>

無失真數位音樂比實體DVD光碟還要好, loseless digital music is better than DVD audio disk

蘿莉控丹談到他買了很多DVD音樂,好奇之下我去查詢DVD音樂的格式,才發現這件事 DVD上保存的音樂格式是 CDDA(CD-DA) https://en.wikipedia.org/wiki/Compact_Disc_Digital_Audio 這是以前CD音樂時用的格式 (1980發明,現行版本1992年的) The audio contained in a CD-DA consists of two-channel signed 16- bit Linear PCM sampled at 44,100 Hz . 對現在的設備過時了,可以使用更好的音質 大概又是商業因素,搞不定標準吧 (曾經出現過的規格都消失了),就一直沿用了 如果沒對實體片子有堅持的話,建議買無失真數位音樂格式 (FLAC, ALAC...etc) 保存上方便,不用單子片子損壞,品質又比較高 隨便google的某個音樂使用 96kHz/24bit Sample Rate 96k/44.1k = 2.17687074829932 倍 24bit表示聲音的精準度會比16bit高 如果把片子轉成數位檔,要注意不要把音質設定條超過CDDA規格,只是浪費空間而已 也許程式比較聰明會自動判斷來源品質,根本不用操心? 在意音質的話,可轉無失真格式 (品質和從光碟聽相同),和轉成wav檔同音質但容量較小

OBS使用案例 聽自己的歌+開放點歌, don't output audio to stream

某蘿莉控丹問我的問題 想要某些聲音不被OBS抓到,必須要有至少兩個聲音輸出裝置 (OBS和其他程式用不同的) 如果沒有實體裝置的情況下,可以用軟體虛擬 比較有名的是 Virtual Audio Cable (要錢) 可以用 Virtual Audio Cable alternative 去google找其他方案 (有免費的) 如果程式無法指定輸出裝置的情況,可以用其他程式把輸出重新導向 Audio Router https://github.com/audiorouterdev/audio-router 資料來源 https://superuser.com/a/1183002/861086 不想裝軟體,在程式啟動前就調整預設輸出裝置再啟動程式 如果程式只會抓一次輸出裝置的情況下 藉此可達到不同程式不同輸出也是有可能辦到的 (很麻煩,不一定有效) 如果是只想放給觀眾,可以在系統音量把程式的聲音關掉 (不是軟體內) 這樣做OBS還是會抓到聲音 (可以看OBS音量條確認)

Qt debug

CDE install from windows sdk (no option in visualstudio2017 installer, 2018/1/23) https://developercommunity.visualstudio.com/content/problem/127056/cdb-in-visual-studio-build-tools.html https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/ Qt defines QT_NO_DEBUG for release builds. Otherwise QT_DEBUG is defined.

How to get Twitter gif source?

圖片
Someone asks me how to get Twitter gif source. Take this for example https://twitter.com/paint002/status/916984184035360768 I use Firefox, press F12 to open tools below web page. 1. click there to start picking an element 2. click on gif to pick it 3. find source in src attribute (It is a .mp4 video in this example) Another method install this userscript, you can open original pictures (not embedded in web page) https://greasyfork.org/en/scripts/15271-extract-images-for-twitter

瀏覽器的選擇 Firefox or Chrome?

圖片
My preference: Firefox > Edge > Chrome Chrome is faster but consumes more memory. (1+ process per tab) Firefox concerns your privacy, Chrome wants your privacy for advertising. https://www.mozilla.org/en-US/firefox/all/#product-desktop-release Firefox is a bit slower than chrome but less memory usage. Chrome creates one process for every tab. Every extension uses more memory in Chrome than Firefox. https://craftwarblog.blogspot.com/2017/11/firefoxchrome-extension-youtube.html uses 23xxK in Chrome, 4xxK in Firefox. Firefox Quantum (Firefox 57 later) is getting faster and better responsive. Firefox is closing the gap to Chrome speed. You should try it if you don't have enough memory. You should use Firefox if you are lolicon.

Don't use WinCDEmu anymore

sysprogs doesn't maintain it any more. Program can't be built from source. Program doesn't work in some image format. (mds) And this issue https://github.com/sysprogs/WinCDEmu/issues/16 maybe use this? ImDisk (open source solution) http://www.ltr-data.se/opencode.html/#ImDisk

windows 升級的注意事項, win10

如果你想要把舊系統的程式保留使用,必須選擇升級系統,選安裝新系統必須重裝 我會選擇安裝成新系統,比較乾淨不會有問題 為了簡化/避免重新安裝程式,可以做的事 備份registry (HKCU/HKLM), %userprofile% , 其他資料 裝完系統後再依程式取出備份中相應的部分 安裝完後,因為新系統的使用者帳號SID和舊系統的不同 權限上會有問題,需要修正,把新系統以外檔案系統的擁有者都拿回來就好了 https://support.microsoft.com/en-us/help/4043454/windows-10-windows-server-update-history

Javascript test sites

code snippets benchmark https://jsperf.com/

OBS: capture Twitch chat from Chatty 擷取Chatty聊天室文字

圖片
If you don't use Chatty, you should use browser source to render Twitch chat. (Sine OBS Studio add hardware acceleration to browser source) If you have mutiple monitor or enough space. You can try streamchat function in Chatty. (no example now) First Add a window capture to Chatty. No picture this step, I think you have no problem here. Click Filters to add filter to Chatty window capture.   Add "Color Key", set Key Color to Chatty background color. (black #000000 in my case) Adjust Opacity to see what's changed and pick one value.   Edit Transform(Ctrl+E) to crop Chatty  window capture. (capture part of Chatty window) I can't tell you which size is better. Just try and see what's changed.

Sandboxie

https://www.sandboxie.com/ API level virtualization, less cost than virtual machine. recommend use this to run programs you don't trust. (ex: most China software)

找出 Windows 熱鍵被誰用掉, who uses my hotkey

https://superuser.com/a/1204019/861086 spy++ 原來還能這樣用 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\spyxx_amd64.exe

OBS development note

圖片
Jim說他想保持OBS簡單一點,不希望一堆niche被加入,這樣會讓其他人後續維護量增加 所以我改的冷門功能,官方也不會採用 API https://obsproject.com/docs/index.html Contributing https://github.com/jp9000/obs-studio/blob/master/CONTRIBUTING.rst Translation https://obsproject.com/forum/threads/how-to-contribute-translations-for-obs.16327/ scripting use the same api as C/C++ (python, lua) C++17會讓amd-amf error,要開的話這個plugin要拔掉 (19/2/12) 加密client_id的原因,youtube要求保密 基本上這種加密也沒啥用,因為有source code,而且OBS又有pdb deobfuscate_str() 給twitchclient_id (去twitch註冊,url放OBS內寫的) hash是uint_64 source plugin create new source的時候 get_properties is called before update other notes obs-text scene沒切到還是一直在跑,設定file或抓歌的情況,就會一直在背景scan 要研究才知道是obs設計,還是plugin原本沒寫好 沒在用就把file/song都不勾吧 參考window-capture.c的tick,修完了w 不是active scene的情況,直接return (只有修正我改的版本,官方版沒有) create內constructor會直接call obs_source_update,會去跑Update Update內的東西大多不需要先放在new_內,都直接再assign給沒new_版本的變數 windows file lastwrite time的精準度相關問題 (只有寫入disk才更新) https://github.com/obsproject/obs-studi

目前玩出的VS2017 15.5 bug

圖片
中文在utf-8 encoding,VS2017還是叫我轉編碼不然會損失資料 從M$人員的留言得知,M$也會偷修bug,小bug修正就不列,只列大的 所以評價M$產品比OpenSource少bug,是一點也不可靠 .c檔改成compile成C++也是不能用C++的功能

OBS 功能/設定筆記 各種紀錄 note

圖片
紀錄神秘的新功能? 和一些使用上的問題,有興趣自己研究,我不一定會寫說明 可能只在開發版有,或是提出還未審核通過 (請自行確認狀態)   https://github.com/obsproject/obs-studio/pull/3263 RNNoise 25.0.x? https://github.com/obsproject/obs-studio/pull/3202 UI: Add ability to make screenshots 抓圖功能 25.0 https://github.com/obsproject/obs-studio/pull/2208 Win10某版的新功能,新的視窗擷取,可以擷取到更多視窗,chrome也不用關硬體加速 https://github.com/obsproject/obs-studio/pull/2156 Vulkan Game Capture https://github.com/obsproject/obs-studio/pull/1956 advanced scene collection importer 可以從不同實況軟體匯入的東西 24.0 ? https://github.com/obsproject/obs-studio/pull/2015 windows audio ducking 猜測是和Mic使用時把其他聲音降低,windows內好像也有類似的設定 我沒用Mic就關掉了 可能相關的東西 https://obsproject.com/forum/threads/audio-ducking.26604/ https://msdn.microsoft.com/en-us/library/windows/desktop/dd940391(v=vs.85).aspx https://github.com/jp9000/obs-studio/wiki/Understanding-the-Mixer OBS新的音量條 OBS 18.0加的功能 Audio monitoring 我也看不懂 ,不要問我是啥,大概跟混音有關? Added audio monitoring on Windows/OSX. Audio monitoring allo

Javascript get element in iframe

https://stackoverflow.com/questions/1088544/get-element-from-within-an-iframe var iframe = document.getElementById('iframeId'); var innerDoc = iframe.contentDocument || iframe.contentWindow.document; IMPORTANT : Make sure that the iframe is on the same domain, otherwise you can't get access to its internals. That would be cross-site scripting.

OBS plugin obs-text 顯示播放中音樂, display playing music

圖片
English | 正體中文 只適用Microsoft Windows 透過修改的OBS內建plugin obs-text來達成,替換掉我改過的檔案就能用了 (OBS版本差異過大時,只換檔案會無法使用) 或是用我做的OBS,整個OBS(含plugin)都換我改的 (公開程式碼,無添加惡意程式碼) https://craftwarblog.blogspot.com/2017/09/obs-studioby-craftwar.html 使用方法 obs-text設定中選歌名模式,其他我新增的功能請參考相關文章 支援的播放器  1.瀏覽器上的 驗證可用: Firefox, Chrome, Edge(新版用Chromium做的,logo像Firefox的) 播歌的網頁必須是現在分頁 (開一個獨立視窗只開一個分頁也可以) 除了youtube以外,都需要再安裝對應的 使用者腳本(userscript)才能抓到 點進對應的usercript後,會打開github,下面有兩個站選一個你喜歡的去裝 不會用userscript的,先看 https://craftwarblog.blogspot.com/2017/11/userscript-install.html YouTube YouTube Music https://github.com/craftwar/userscript/tree/master/Youtube-Music-song-name-helper Spotify https://github.com/craftwar/userscript/tree/master/Spotify-song-name-helper ニコニコ動画 (Niconico) https://github.com/craftwar/userscript/tree/master/Niconico-song-na

M$的中國客服品質不太好...

我超想問M$中國客服,你到底有沒有試過 還是直接敷衍我隨便打一串字出來,根本沒解決問題 不用試,用看的就知道已經設定的東西,你叫我做,來試著修正? 最好笑的是,有一個解法,是我標題問的問題 貼圖也不會用繁中版,用簡體版的畫面是怎樣? https://answers.microsoft.com/zh-hant/windows/forum/windows_10-other_settings/win10-%e7%b3%bb%e7%b5%b1non/f09de7b4-c2ca-460f-ae66-1c62b4c99017 visual studio那邊英文客服的處理就好多了

Git 筆記 note

找戰犯指令,看是誰改了某個檔案 (可指定行數) git blame -L 5,10 index.html git我想用加入某個branch中某個commit,要怎麼做 git cherry-pick  問完就想到keyword了w git commit message的寫法,可以參考OBS, x264 OBS有說明格式 git push origin test:master https://git-scm.com/docs/git-rebase 看ref git reflog git show-ref git rm -cached  只從git內砍掉,保留檔案 --cached     Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. 更新submodule,如果不下--remote,會用本地的sha checkout git submodule update --init --recursive --remote tag只是pointer to hash類似branch的概念,但不一定要在branch上 這樣可以只推tag出去 git tag -a tagname -m 'tagmessage' commithash git push --tags git rebase -root 可以從branch最初的紀錄開始w 使用者資訊 For just one repo: git config user.name "Your Name Here" git config user.email your@email.com For (global) default email (which is configured in your ~/.gitconfig): git config --global user.name "Your Name Here" git config --global user.email your@em

M$ 相關支援頁面

https://www.visualstudio.com/zh-hant/vs/support/ vs_installer.exe --locale english vs_installer.exe update spy++ is here (but no shortcut...) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools

Twitch Bot (song request and more)

NightBot 完全免費功能無限制 有url fetch MooBot 某些功能有限制要訂閱 某些功能有數量上限(可買) 指定的彈性比NightBot大 沒有url fetch的功能 Streamlabs Chatbot   (以前叫Ankhbot) 在本機執行 (不會有連不上的問題,除非你網路有問題) need python to run support python script support,大概是自訂功能最強? OpenSource DJBot PhantomBot

Win10 登入自動執行 (autorun after login) startup folder

Win+R, shell:startup put shortcut in there

App is is preventing Windows shutdown (PCMan shutdown fix)

https://stackoverflow.com/questions/40825747/close-my-program-before-windows-shutdown https://github.com/pcman-bbs/pcman-windows/pull/30 對 WM_QUERYENDSESSION return 1 讓他可以terminate程式就ok了,猜測是Windows SDK版本改變,行為改變

安卓擋廣告 Android adblock

擋廣告主機 https://craftwarblog.blogspot.com/2019/01/block-advertisement-host.html Content level AdGuard https://github.com/chiehmin/MinMinGuard