顯示具有 ubuntu 標籤的文章。 顯示所有文章
顯示具有 ubuntu 標籤的文章。 顯示所有文章

2024年3月4日 星期一

在Ubuntu桌面載入後自動執行程式

在 <home>/.config 新增 autostart 目錄

touch <home>/.config/autostart/<program name>.desktop

在<program name>.desktop加入以下內容

[Desktop Entry]

Name=<program name>

Exec=<path to>/<your program execuable>

Type=application

 就可以了

RaspberryPi也一樣可以這樣處理

2024年2月17日 星期六

在AWS EC2上安裝WordPress

環境: Ubuntu 18.04 Server

第一次登入EC2後

  1. sudo apt update
  2. sudo apt install apache2
  3. sudo add-apt-repository ppa:ondrej/php
  4. sudo apt update
  5. sudo apt install php7.4
  6. sudo apt install mysql-server
  7. sudo apt install php7.4-mysql

以上完成wordpress需要的軟體。

在使用mysql server前先進行初始化。

  1. mysql_secure_installation
  2. 設定root密碼及刪除不必要的使用者帳號
  3. sudo mysql
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';

將原本root的登入方式(auth_socket)改為mysql_native_password

mysql> CREATE DATABASE new_db;
mysql> CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON new_db.* TO 'new_user'@'localhost';

建立wordpress的資料庫(new_db)並設定資料庫權限給新建的使用者帳戶(new_user),之後wordpress安裝時需要輸入此使用者帳戶及密碼。

接下來到wordpress.org下載最新版本(目前為5.5.1)的wordpress

% cd /var/www/html
% sudo unzip wordpress-5.5.1.zip
% sudo chown -R www-data. wordpress/

最後打開AWS EC2的security group的port 80

連入網站即可開始進行wordpress的最後設定。

Linux Read-only file system

 常用的解決方法

sudo mount -o remount,rw /

在respberry pi如果出現PARTUUID=xxx Error
可以將指令改成
sudo mount -o remount,rw /dev/mmcblk0p2 /

Ubuntu install RTL8188 Wifi Usb Adapter Driver

 Download driver from:

https://github.com/ulli-kroll/rtl8188fu

After ‘make’:

sudo modprobe cfg80211
sudo insmod rtl8188fu.ko

Connect to AP:
nmcli r wifi on
nmcli d wifi list
nmcli d wifi connect “ssid” password “pw”

2013年11月14日 星期四

Build WebM for Android on Ubuntu

 本文參考自 http://code.google.com/p/webm/ 中的 README.android
並加入一些操作細節, 以解決 build error

1. Create Android application project

2. Create <project>/jni

3. Change current directory to <project>/jni

4. git clone http://git.chromium.org/webm/bindings.git

5. git clone http://git.chromium.org/webm/libvpx.git

6. ./libvpx/configure --target=armv7-android-gcc --disable-examples -disable-neon --sdk-path=<full path to ndk>

7. Change current directory to <project>/jni/bindings/JNI

8. git clone http://git.chromium.org/webm/libwebm.git

9. Download ogg library from http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz, extract to bindings/JNI

10. cd llibogg-1.3.0 && ./configure && cd..

11. Download libvorbis from http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz

12. svn checkout http://libyuv.googlecode.com/svn/trunk libyuv-read-only

這時你的 bindings/JNI 目錄下會有以下目錄
libogg-1.3.0/
libvorbis-1.3.3/
libvpx/
libwebm/

13. Change current directory to <project>/jni

14. Create Application.mk with the data below

APP_ABI := armeabi-v7a
APP_OPTIM := release
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti


15. Create Android.mk with the data below

WORKING_DIR := $(call my-dir)
BINDINGS_DIR := $(WORKING_DIR)/bindings/JNI
include $(BINDINGS_DIR)/Android.mk


16. ndk-build -C <path to project>

大功告成, 你會在你的<project>/lib/armeabi-v7a 下看到  libvpx.so 等檔案
如何測試 build 出來的 .so 可以用呢? 在 README.android 裡也有介紹
在 MainActivity onCreate 加入以下的 code 就可以了

int[] major = new int[2];
int[] minor = new int[2];
int[] build = new int[2];
int[] revision = new int[2];
MkvMuxer.getVersion(major, minor, build, revision);
String outStr = "libwebm:" + Integer.toString(major[0]) + "." +
                        Integer.toString(minor[0]) + "." + Integer.toString(build[0]) + "." +
                        Integer.toString(revision[0]);
TextView tv = new TextView(this);tv.setText(outStr);
setContentView(tv);

FPGA/STM32 SPI 實驗

本實驗中,Nucleo H753ZI 當作 SPI Master,PYNQ-Z2 當作 SPI Slave。 使用SPI通訊協定傳送及接收8 Bytes。 腳位設定如下: Nucleo H753ZI 功能 PYNZ-Z2 PD14 CS W9 PA5 SCLK...