2024年7月4日 星期四

Tmux設定檔

In file ".tmux.conf":
set-option -g default-terminal "screen-256color"
set-option -g mouse on
set-option -g history-limit 102400
set-option -g base-index 1
set-option -g renumber-windows on
bind-key '"' split-window -v -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'
bind-key c new-window -c '#{pane_current_path}'

In file ".vimrc":
set bg=dark (避免vim的顯示顏色在開啟tmux時有差異)


2024年4月11日 星期四

在Ubuntu中查看heic格式照片

讓Image Viewer可查看heic檔

 sudo apt update

sudo apt install heif-gdk-pixbuf

完成後右鍵點選圖片,以Image Viewer應用程式開啟即可


在檔案瀏覽器中可顯示縮圖

sudo apt install heif-thumbnailer


2023年9月23日 星期六

透過pytube下載YouTube影音檔

 下載mp4視訊

from pytube import YouTube

with open('list.txt', 'r') as f:

    for url in f:

        if url.strip(' \t\n\r') != '':

            print('Downloading {}'.format(url))

            yt = YouTube(url)

            yt.streams.filter().get_highest_resolution().download(filename=yt.title+".mp4")

下載mp3音訊

from pytube import YouTube

from pydub import AudioSegment

with open('list.txt', 'r') as f:

    for url in f:

        if url.strip(' \t\n\r') != '':

            print('Downloading {}'.format(url))

            yt = YouTube(url)

            yt.streams.filter().get_audio_only().download(filename=yt.title+".mp4")

            print('Converting {}'.format(url))

            AudioSegment.from_file(yt.title+".mp4").export(yt.title+".mp3", format="mp3")


2023年9月15日 星期五

Virtualenv使用方式

 安裝

pip install virtualenv

pip list

建立virtualenv

mkdir test

cd test

virtualenv [-p path/to/python] myenv01

(path/to/python可用which python進行查詢)

啟用virtualenv

source myenv01/bin/activate

pip list

離開virtualenv

deactivate

2023年8月2日 星期三

透過Python進行音訊轉檔

Step 1: 在 Ubuntu 上安裝 ffmpeg

sudo apt update
sudo apt install ffmpeg

Step 2: 為 Python 安裝 ffmpeg package

pip install ffmpeg

Step 3: 為Python 安裝 pydub package

pip install pydub

Step 4: Python程式碼如下

from pydub import AudioSegment

wav_file = "filename.wav"
mp3_file = "filename.mp3"

# Read wav file to an audio segment
print("Reading wav file...")
sound = AudioSegment.from_wav(wav_file)

# Export audio segment to mp3
print("Exporting mp3 file...")
sound.export(mp3_file, format="mp3")

2023年7月22日 星期六

如何透過藍牙使用iPhone的行動網路

 Step 1: 在地球圖案上按滑鼠右鍵

Step 2: 點擊「變更介面卡選項」

Step 3: 點擊藍牙網路連線

Step 4: 滑鼠右鍵點選iPhone -> 選擇連線 -> 存取點


2023年4月11日 星期二

Vim設定檔

 "In ~/.vimrc
set bg=dark
set number
set backspace=2
set hlsearch
set autoindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set mouse=a
set breakindent
set linebreak
set showbreak=>>
set belloff=all
set clipboard=unnamedplus
"set clipboard=unnamed
syntax on
filetype on
filetype plugin on
filetype indent on
colorscheme default
nnoremap <C-g> 1<C-g>