2021年10月13日 星期三

[Raspbian]搜尋隱藏ssid

Raspbian用GUI看不到隱藏的ssid,也沒地方可以輸入

如果要連隱藏的ssid需要編輯

/etc/wpa_supplicant/wpa_supplicant.conf 檔案


>sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

 檔案大概長這樣


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=TW

network={
        ssid="mySSID"
        scan_ssid=1
        psk="PW"
        key_mgmt=WPA-PSK
}

將network={}的內容改成欲連線的SSID

要注意要有 scan_ssid=1才會去連隱藏的SSID

我自己測的時候network={}只能有一組,因此需要先將原本的network={}刪除,否則重開機後新增的SSID會不見

完成之後存檔重開機

[Raspbian]搜尋隱藏ssid

2021年9月13日 星期一

Regular express正規化表示法好用網站

移動式冷氣使用心得,如何吹得涼,吹整晚耗電量

 先說結論,在特定的條件下,移動式冷氣確實可以吹得涼,耗電量也可以接受。當住的地方無法安裝一般冷氣,不失為一個度過炎炎夏日,讓你一夜好眠的選擇。


今年夏天因為住的地方沒裝冷氣,所以就研究了一下移動冷氣。

移動式冷氣使用心得,如何吹得涼,吹整晚耗電量

Netflix集數卡住

 最近在看斯卡羅,但不知怎麼搞得,明明更新到第十集了,我的Netflix卻停留在第二集

是可以繼續往下看,但要一集一集往下跳,好麻煩..

後來在Dcard上看到,原來只要登出在登入就能解決了!

實測成功!

Netflix集數卡住

2021年8月23日 星期一

中華電信光世代HN密碼去哪找?

測試日期: 2021/08/23

因為工作要用到關係,申請Hinet光世代


記得以前裝機完都會給一張帳號密碼小卡,這次沒注意到沒給,剛剛要繳第一個月帳單,發現中華電信APP需要用HN帳密去綁

中華電信光世代HN密碼去哪找?

2021年8月4日 星期三

resize /home without live CD / USB 重新分割 /home

OS: Ubuntu 18.04

前提 / 跟 /home(目標partition) 在不同partition

因為電腦一開始swap割太小,想重新分割/home,分點給swap

但電腦因為某些原因不能使用USB/CD boot...

看有個說法是可以用fdisk去割,但感覺毛毛的,之前割另一台raspberry pi,用fdisk割完就整台掛了..

想說還是GPart安全,但gpart會有/home沒卸載不能割的狀況

1. 建立新的 user gp

sudo useradd -s /bin/bash -d /gpHome -m -G sudo gp

2. 登出目前user,以新user登入

3. 卸載 /home 

若嘗試
sudo umount /home
會得到 umount: /home: target is busy. 這時候可以用
sudo fuser -m /home
查看誰鎖住了 /home 再用
sudo kill -9 pid
去殺,或
sudo fuser -mvik /home
再
sudo umount /home

4. gpart

gpart

resize /home without live CD / USB 重新分割 /home

2021年7月24日 星期六

c++ const method

 一個method被標記為const 表示他不會改變所屬class的member,function若能被標記為const應盡量這麼做

class A{
  int b;
  void c(){
      b = 0; // compiling error
  };
};

c++ const method

pixel 3a navigation button die

 I found sometimes my pixel 3a's navigation buttons die, sometimes include lower part of the keyboard, which is really annoying, make me can't go back to last page / home or typing.

Recently I found out it's cause by high temperature (but not extremely high, hence I'm still holding it by my hand), putting a usb fan behind it could release the situation.

pixel 3a 的鍵盤下半部(導航鍵與鍵盤下半部,包含倒退鍵) 有時候會失去作用或變得很遲鈍,最近發現是溫度造成的,將風扇在手機背面,一切就會復原了。但其實也不是多高溫,因為還能用手拿著..

pixel 3a navigation button die

2021年7月23日 星期五

Lowe's Ratio Test排除易混淆特徵點對應

 再做特徵點對應的時候,若有重複的圖形,用local資訊提取的特徵很容易有錯誤的對應

所以可以用 Lowe's Ratio Test 排除易混淆的對應,意義上來說是如果有相近的對應就將該組對應排除

這個方法很簡單, Lowe在SIFT原始論文就有提出這個方法, 在7.1

https://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf

L1,L2 是最相近的對應特徵點與二相近的對應特徵點對應分數

L2/L1 = RoD (ration of distance)

原始論文中建議設為0.8, 但可能做3D重建更介意false positive,設為0.5

Lowe's Ratio Test排除易混淆特徵點對應

Bag of visual words,TF-IDF

Bag of visual words (BOVW)是把影像用特徵來描述

譬如說用SIFT提取特徵,之後一張影像就用這些特徵來表示,並且也只保留這些特徵,

這可以用在影像特徵的萃取與比對

一張影像可以提取出許多字彙,直接用每個字彙出現的數量來描述影像是一種方式

而應用TF-IDF (Term freq. inverse document frequency )的技術,在此描述中加上字彙的稀有程度這項因素

t = (nid/nd) log(N/ni) 

nid:字彙i出現在目標影像中的次數

nd :目標影像總字數

N:總影像數

ni:含有字彙i的影像數

(nid/nd)這項表示若這張影像的字彙數越少,每個字彙的權重越高

(log(N/ni))這項表示若這字彙越稀有,則這個字彙權重越高

接著再計算影像之間的cosine distance, 

ref :  https://www.youtube.com/watch?v=a4cFONdc6nc

ref :https://github.com/ovysotska/in_simple_english

Bag of visual words,TF-IDF

2021年7月22日 星期四

Ubuntu suspend problem

 When using Ubuntu 18.04, there's always buggy blank screen / suspend action that force me to reboot my PC

The easiest one is blank the screen, than unplug your second screen, boom your PC die..

so I just change to xscreensaver

$ sudo apt-get install xscreensaver xscreensaver-gl-extra xscreensaver-data-extra

then remove buggy gnome -screensaver

$ sudo apt-get remove gnome-screensaver

then search for startup and add an entry

Ubuntu suspend problem

Git traped?

 I've a file in a Git control project that I've do some local change, and don't want it to be overwrite.

so I use

$ git update-index --skip-worktree <file-list>

to avoid the over write

but strange thing happen today when I'm trying to checkout another branch, Git ask me to commit / stash local change, but when I stash local change

git> No local change to save

but when I checkout

git > please commit your changes or stash them before you switch branches

my Git version is 2.30.2

so I can only 

$ git update-index --no-skip-worktree <file-list>

then 

$ git stash

$ git checkout

Git traped?

2021年5月28日 星期五

power point 調整圖片透明

Power point沒辦法直接調整圖片透明度,but有個work around
1.插入圖形方塊
*不是直接插入圖片喔
2.將方塊的線條調整成無線條
3.將方塊的背景填滿改成以圖形填滿,再去選擇要插入的圖片,這時候就可以調整透明度囉

測試office版本2019

power point 調整圖片透明

2021年5月27日 星期四

MPV ubuntu 下好用的播放器 video player


本來是用VLC player,但因為有些影片只有部份是有效資訊,vlc的放大跟平移又是世界難用,所以找到了MPV
mpv 基本用法是
$ mpv 要播放的檔名

舊版本自訂熱鍵

用Ubuntu 18.04內建的reopsitry抓到的是有點舊的版本 雖然是可以透過自訂熱鍵達成zoom跟pan,
方法是:
在 ~/.config/mpv/ 中新增 input.conf 內容是
Alt+- add video-zoom -0.25
Alt+= add video-zoom 0.25
Alt+h add video-pan-x 0.05
Alt+l add video-pan-x -0.05
Alt+k add video-pan-y 0.05
Alt+j add video-pan-y -0.05

自行compile

但要是抓新版的就不用這麻煩了
本來想說要去github抓下來自己build,但過程中一直缺fribidi這個套件,
但其中遇到一些問題 
0. 可以先做這步,git 的readme有提到,但我之前沒看到
$ apt-get install devscripts equivs
$ mk-build-deps -s sudo -i
$ dpkg-buildpackage -uc -us -b -j4
完成之後mpv_<version>_<architecture>.deb會在上層目錄被產生,用下面指令安裝
$ sudo dpkg -i ../mpv_<version>_<architecture>.deb
1.需要 fribidi
其實是需要 fribidi-dev 
2.yasm太舊
$ sudo apt-get install yasm 

直接用第三方repository安裝

$ sudo add-apt-repository ppa:mc3man/mpv-tests
$ sudo apt-get install mpv

Hotkeys

alt+方向鍵: pan
alt++/-: zoom

MPV ubuntu 下好用的播放器 video player

2021年5月20日 星期四

[Ubuntu] Silver Searcher , a fast code searching tool

The Silver Searcher 

A code searching tool similar to ack, with a focus on speed.

github

install on ubuntu

sudo apt-get install silversearcher-ag

usage

search i_am_sample_code in /

sudo ag --silent i_am_sample_code /

[Ubuntu] Silver Searcher , a fast code searching tool

2021年5月19日 星期三

Install Bash 5.1 on ubuntu 18.04

在看bash reference manual的時候發現一些功能不能用,懷疑是18.04的bash版本太舊想說更新看看
需要自己build bash
sudo apt-get install build-essential

clone the source 

https://github.com/bminor/bash

cd to the code directory
./configure
make
sudo make install
sh

完成之後,bash會被放到/usr/local/bin/bash
接著如果要指定成預設的shell,要編輯 /etc/shells 將 /usr/local/bin/bash加入
之後再
$ chsh
輸入密碼之後
/usr/local/bin/bash
之後重新登入

Install Bash 5.1 on ubuntu 18.04

cherrytree on ubuntu 18.04

it's hard to install the latest (0.99.36) cherrytree on ubuntu 18.04
I think the easiest way is install the flatpak package
0.99.36 have improved a lot from the default 0.39.4 version, it's worth for update

cherrytree on ubuntu 18.04

2021年5月8日 星期六

[linux] 用sed將文件中的換行換成空白

最近因為需要翻譯(用google translate)一些文件,但那些文件因為排版需要,有很多不必要的換行,擔心會影響到翻譯品質
但有個好處是,他真的要換行的地方連續換行兩次

如果在windows中有msWord,可以用搜尋找出連續換行,取代成特殊符號,再取代獨立的換行
linux中邏輯也類似,但用sed這套很強的搜尋取代程式來做到

除此之外順便把他弄成script,以後要使用比較方便 

$1是來源檔案$2是目標檔案
#!/bin/bash
# remove $1's single \n and save to $2
sed ':a;N;$!ba;s/\n\{2\}/%@%/g;s/\n/ /g; s/%@%/\n/g' $1 > $2

將上面這段存成 fixNl.sh再用
$fixNl.sh source dest

就會將source中了內容轉換dest了

source sample:
1
2
3

4
5
6

7
8
9

dest sample:
1 2 3
4 5 6
7 8 9

[linux] 用sed將文件中的換行換成空白

2021年5月6日 星期四

[C++] && rvalue 暫時存在的Object

 ref

myClass f() {...};
myClass X,Y; 
myClass A(X);        // 1.
myClass B(X+Y);      // 2.
myClass C(f());      // 3.
在三種狀況中 2,3 與 1是不一樣的﹔
 2,3 中的 X+Y與f(X) 都會產生一個暫時性的Object,在執行完該行後消失。
 因此C++ 11為這種狀況搞了個rvalue, 2,3就屬於rvalue
相對於rvalue的就是lvalue
lvalue: locator value: an object that occupies some identifable location in memory: 在記憶體上佔有一定空間的物件 

在 C++ 中有兩種constructor

//copy constructor
myClass(myClass const& other){} 
//move constructor
myClass(myClass&& other){}
其中move constructor就是當傳入的是rvalue (myClass&&)的時候可以做一些特殊處理
譬如說,可以把rvalue的記憶體拿來使用,因為這行程式結束之後rvalue也不不存在了

[C++] && rvalue 暫時存在的Object

[c++] method()=delete

C++11的新功能
這是 suppressing operation
當寫 method()=delete的時候,呼叫method()是被compiler禁止的

[c++] method()=delete