2021年3月7日 星期日

install cuda -- turn off Nouveau

 before install cuda,Nouveau need to be turned off

create a new text file

$ sudo nano /etc/modprobe.d/blacklist-nouveau.conf

in blacklist-nouveau.conf

 

blacklist nouveau
options nouveau modeset=0
 
then, rebuild kernel and reboot
$ sudo update-initramfs -u
$ sudo reboot 

after reboot make sure Nouveau have been shut down
$ lsmod | grep nouveau

install cuda -- turn off Nouveau

[pre noted] 將linux移到其他硬碟

 因為公司筆電的ssd很小(128G)上面大只夠run一個linux

  1. Create an ext4 partition and a swap partition on the new drive.

  2. Boot from LiveUSB.

  3. Mount the old Ubuntu partition to some directory, mount the new one to some other directory.

  4. Copy all files from the old one to the new one using cp -a command.

  5. Install grub to the new drive.

  6. Update /etc/fstab with new UUIDs.

[pre noted] 將linux移到其他硬碟

在已有ubuntu的狀況下免cd/usb安裝其他inux

用 grml-rescueboot套件

$ sudo apt-get install grml-rescueboot

安裝完成後會產生

/boot/grml資料夾

將iso移動到 /boot/grml

$ sudo mv <.iso> /boot/grml

更新grub

$ update-grub

重開機
$ reboot
這時候grub menu中就會多一個 grml-rescueboot 的選項

但這樣做會有個問題就是installer無法在已掛載的磁碟上做改變分割磁區的動作,如果只有一個實體磁碟的話會需要先割好再安裝

在已有ubuntu的狀況下免cd/usb安裝其他inux

bazel geetting sart

 最近因為用到Nv 的 Isaac, 他用的是bazel這個編譯器

之前沒接觸過,查了一下發現他原本是google內部用的編譯器,後來release出來產生的

但從他的官網進去要getting start卻一直是404找不到網頁

一直以為是有捨麼梗

後來檢查URL才發現他連結的URL是

https://docs.bazel.build/guide.html/getting-started.html

但應該要連到

https://docs.bazel.build/getting-started.html

才對...orz

bazel geetting sart

2021年2月25日 星期四

ubuntu+win10安裝

 如果裝ubuntu + win10 一般先裝完 win10再裝ubuntu

如果都用預設的裝完,ubuntu的grub會蓋掉win10的boot loader導致如果移除ubuntu,win10也開不起來

所以在裝ubuntu的時候

分割磁區,掛載目錄的地方

"Device for boot loader"要選dev/sda1(ubuntu所在的sda<N>,N是數字)而不是dev/sd<A>,A是英文

不然後面可能就需要去用window開機碟去修bootloader了(改天搞掛再來試)

ubuntu+win10安裝

Win10 開機相關

 最近享用AOMEI 將一個windows的備份復原到另一個分割

但復原後卻遇到還原的win10無法啟動的問題

目前的一些research 結果

system information

用system information查看目前的BIOS用的是UEFI還是Legacy boot device

diskpart

>diskpart

list volume

list disk

computer management

Disk Management

Actions > more actions > button  > volume view

check disk is UEFI /BIOS

MBR2GPT

EasyBCD

bcdedit

in admin's cmd
>bcdedit

Win10 開機相關

2021年2月19日 星期五

ubuntu screen

 好用的插件

基本上功能都是ctrl+a,<key>

說明: <key> = ?

detach <key> = ctrl+D

關閉目前的section

$ exit

開啟screen

$ screen

看有哪些screen section

$ screen -ls

回到之前的section

$ screen -r

殺掉所有screen section

$ killall screen

ubuntu screen

linux 結束程序

 查看目前所有程序

$ top

$ ps -aHj 

看terminal擁有的程序

$ jobs -l

結束程序

$ kill  -<signal number> <process Id>

查看signal number

$ kill -l

常用的是 -6,-9

-6 process 可能會忽略

-9 強制結束

結束程序與子程序

$ killall

 

linux 結束程序

ubuntu 在shell的背景執行

將程式送到背景執行並暫停

ctrl + z

接著用

$ bg %<jobsId>

來將背景暫停程式繼續執行

或在開始執行時

$ <command> &

但這麼做stdout仍然會導到treminal,可以將stdout重新導到 /dev/null

$ <command> > /dev/null &

查看正在執行的程式,-l列出process Id

$ jobs -l

將程式送到前景,如果有多隻成是在背景,用x指定

$ fg <X>

殺掉背景執行程式

$ kill -9 <process Id>


ubuntu 在shell的背景執行

2021年2月14日 星期日

Ubuntu 改游標顏色跟大小

 安裝 gnome-tweaks

$ sudo apt install gnome-tweaks

在 gnome-tweaks:Appearance>Themes>Cursor 可以改為紅色Cursor

gnome-tweaks:Keyboard&Mouse>Mouse>Pointer Location 可以開啟按ctrl找游標的功能

在Setting:Universal Access>Cursor Size 可以改游標的大小

Windows10想改游標可以參考前篇

Ubuntu 改游標顏色跟大小

VS code debug時 cout 沒有顯示

 在vscode debug時,如果沒有在launch.json中設定externalterminal=true, cout會顯示在Terminal這個Tab中(如果不見可以按ctrl + J)

另一點要注意的是,目前C++的cout需要下

cout.flush();

才會把前面cout的內容印出來

VS code debug時 cout 沒有顯示

2021年2月13日 星期六

Grub2 .efi檔案選擇

 因為手殘不小心刪除了boot menu的開機選項,需要手動找回來

 路徑在/boot/efi/EFI/BOOT/grubx64.efi

在bios(Dell Inspiron 15)中看起來的路徑會是

EFI/BOOT/grubx64.efi

Grub2 .efi檔案選擇

[Ubuntu 18.04] 每次開機都掛載(Mount)裝置

Who should read this:
  • 如果 Ubuntu中磁區mount上去之後權限(permission)有問題
  • 想要透過GUI設定開機就mount特定磁區

開機掛載

因為要跟windows share data的關係,我弄了一個FAT32的分割區,但每次開機都要用

sudo mount /dev/sdb1 /mnt/shareData -o uid=${myUid}

掛載有點麻煩

有個透過GUI達成每次掛載的方式

開啟Disk,找到想掛載的分割區


掛載選項

預設的mount option可能是像上面那樣,但這樣mount上去的所有權是root,一般的user只能read 跟 x,不能write

將mount option 改成

defaults,umask=0002,dmask=0002,gid=1000

這樣gid=1000 (可以用 $ id 去確認目前user的gid) 的使用者就有r/w權限

另外也可以查看 /etc/fstab

$ cat /etc/fstab | grep "/mnt/myMountPoint" 確認mount option有沒有什麼奇怪的設定

[Ubuntu 18.04] 每次開機都掛載(Mount)裝置

2021年2月12日 星期五

Geo照片與gpx整合

 用Oruxpmap紀錄軌跡之後如果想跟這段期間拍的照片做整合

在Android上可以用GPX photo search這個App,

他可以利用載入的gpx檔案搜尋跟這段路徑相關的照片並匯出成kmz(google earth)檔

但有個小問題是在GE中照片的縮圖在地圖上會顯示成一個大頭釘的圖示,而不是縮圖



在Windows PC上可以用GeoSetter

他是一套免費軟體,可以將有Geo的照片(或是只有時間的照片只要時間是準的,也可以跟gpx檔案做貼合!)存成kmz,之後用GE開啟就會有縮圖Icon




另外有一套TopoFusion感覺也不錯用,產生的縮圖地圖Icon size夠大(GE只有32x32附近)還有html格式的,可惜他是付費軟體,價格也不低




Geo照片與gpx整合

2021年2月7日 星期日

YUMI開機碟無法開機

 用YUMI可以用一隻隨身碟來安裝多種OS非常方便,尤其工作上常常需要測試多種作業系統的相容性的時候。

第一次用YUMI的時候很順利的就做好,但第二次不知怎麼的,用一樣牌子一樣型號(ADATA UV128/32GB)隨身碟做好之後無法開機,懷疑映像檔或YUMI檔案破損重新下載都無效

後來Google之後猜應該是隨身碟要用GPT的方式分割磁區,用ubuntu的Disk工具查看,果然是MBR分割。用disk中的 Format Disk, Partition選 GPT(預設是MBR)Format之後建立兩個分割區(Google看到的方式,沒這麼作用YUMI製作完後partition又會變回MBR),兩個分割區都用FAT格式。最後製作 YUMI的時候不要Wipe隨身碟

YUMI開機碟無法開機

在ubuntu中安裝新酷注音

新酷注音還蠻好用的會自動選字~

 sudo apt install ibus-chewing

安裝完成後重新啟動ibus(不須登出或reboot)

ibus restart

安裝完成後到Setting > Region & Language去新增

+ > Chinese (Taiwan)>Chinese (Chewing)

在ubuntu中安裝新酷注音

2021年2月5日 星期五

Ubuntu插件

新酷注音

sudo apt install ibus-chewing

window排列

gtile

office

WPS office

統計所有目錄的檔案大小

apt-get install ncdu

Ubuntu插件

求職查詢

做業務的時候老闆有教一件事情,在接觸客戶前要先上工商查詢網頁去查詢要接洽公司的背景,包括資本額,負責人跟可能的關係企業(以免競爭者跑來打聽消息,花資源幫對手做功課),最近因為公司誇口沒告過員工,Google了一下,發現之前確有告過,只是不起訴處分。想說來看一下來龍去脈,找了一下發現這個系統

裁判書查詢

但研究一下之後發現,這個東西查不到不起訴處分的紀錄,但用於評估公司的狀況是一個不錯的參考

求職查詢

2021年2月4日 星期四

code prettify 在blogger中加入code block

code prettify test
ref: https://github.com/googlearchive/code-prettify
the service side has been updated, need to change some code in 






sample coode:
<pre class="prettyprint linenums lang-sh">$ sudo apt install smbclient
$ sudo smbclient -L $IP -W $domainName -U $userName
</pre>
  • use <xmp> </xmp> to escape html code
  • lang-* is optional, may auto detect
  • linenums:x shows the line numbers, x is the starting line
class Voila {
public:
  // Voila
  static const string VOILA = "Voila";

  // will not interfere with embedded tags.
}
by <pre> ...</pre>
int main()
{
    int a = 0;
    return 0;
} 
by <code> .... </code>
int main()
{
    int a = 0;
    return 0;
}

用法
<pre class="prettyprint lang-cpp linenums">...</pre>
或
<code class="prettyprint">...</code>
用 <pre> 在html中直接換行輸出的結果就會有換行的效果,在<code>中則需要用<br />之類的方式換行
如果再compose mode中打好了code, 可以切到HTMLmode後直接加上 <code></code>較容易

支援的語言
lang-*: "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java","js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml","xsl".

code prettify 在blogger中加入code block

2021年2月3日 星期三

ubuntu connect to windows file share

Trying to link to a Git repo on NAS folder, where I have no authority to run a Git server.

first, init a bare Git repo on server,

for windows, there's no problem that a can mount the folder on NAS and clone the Git repo. (need some Git config tweak to push)

But I encounter a problem that I can't directly write to the path where I mount the smb:\\ on Ubuntu, which make Git clone failed.

here's how I solves it


install cifs-utils

$ sudo apt install cifs-utils
$ sudo mount.cifs //$IP/$Resource /mnt/samba -o user=$username,domain=$domainName

you can use smbclient to check samba connection and resource first

$ sudo apt install smbclient
$ sudo smbclient -L $IP -W $domainName -U $userName


在ubuntu上git push到NAS上的資料夾會因為權限問題push不上去 

嘗試著用 chmod 更改權限失敗
目前work around 是用
$ sudo git push 
在掛載時加入dir_mode=0777,file_mode=0777設定權限
或加入noperm參數(ref)

ubuntu connect to windows file share