星期一, 3月 27, 2023

Cursor 試用心得

利用時間試用了一下 Cursor(https://www.cursor.so/),使用的是最近開發BLE專案用到的開源代碼 pc-ble-driver-py (https://github.com/NordicSemiconductor/pc-ble-driver-py)

pc-ble-driver-py主要是拿來 nrf Connect for Desktop 做不到的功能,開發客製DFU升級工具程式。

心得: 

測試一: prompt: provide the caller & callee relation chart

感覺是有產生出物件的說明

The code does not include a caller and callee relation chart. However, we can infer the relationship between the various classes and objects based on their usage in the code. The BSCollector class is the main class that manages the BLE driver and adapter, and is responsible for calling methods on the other classes and objects as needed. The BLEDriverObserver and BLEAdapterObserver classes are used to observe events from the BLE driver and adapter, respectively, and are called by the BSCollector class. The `BLEGapScanParams`, `BLEGapSecParams`, `BLEGapSecKDist`, and BLEUUID classes are used to define various parameters for the BLE connection, and are used by the BSCollector class when scanning for devices and connecting to them. The EvtSync class is used to synchronize events between the BLE driver and adapter, and is used by the BSCollector class to wait for events from the device. Finally, the Queue class is used to manage a queue of connections to the device, and is used by the BSCollector class to store connections to the device.

測試二:

prompt: if i need to add disconnect handle, how to do it?

第一感覺被嚇到,這麼聰明嗎? 但,搜尋了一下代碼,發現這是原本就有的參考範例。

測試三:

試著用 Attempt Change 套用到我的測試代碼裡,發現就給些很無用的建議了

感想:

從無到有的生成,其實已經相對成熟。 但如果要在已經既有的代碼專案裡面,給修改指導,其實還在很初階的階段。

星期一, 11月 28, 2022

GCP ACE認證資料參考

 GCP ACE認證


https://zhuanlan.zhihu.com/p/478981425


https://liuyuchen777.github.io/2022/02/20/ACE-Prepare-Note/


https://github.com/kibablu/associate-cloud-engineer


https://ravikirans.com/gcp-associate-cloud-engineer-exam-study-guide/

線上課程
https://www.udemy.com/course/google-cloud-certification-associate-cloud-engineer/

https://www.udemy.com/course/google-certified-associate-cloud-engineer-2019-prep-course/

星期四, 6月 23, 2022

Build openwert in docker

 Build openwert in docker


docker run -itd \

    --name lede-build \

    -h r6525 \

    -p 10022:22 \

    -v ~/firefly_openwrt:/home/user/firefly_openwrt \

    p3terx/openwrt-build-env:18.04


docker exec -it lede-build zsh


missing apps

    sudo apt install repo

    sudo apt install bison

    sudo apt install bc

    sudo apt install liblz4-tool

    sudo apt install time


星期二, 6月 07, 2022

How can I tell Ubuntu to do nothing when I close my laptop lid?

 

Ubuntu  21.10

/etc/systemd/logind.conf
    HandleLidSwitch=ignore
    sudo systemctl restart systemd-logind

Ubuntu 20.04

/etc/UPower/UPower.conf

   IgnoreLid=true

    sudo systemctl restart upower

星期日, 6月 05, 2022

HOW TO MOVE DOCKER DATA DIRECTORY TO ANOTHER LOCATION ON UBUNTU

https://www.guguweb.com/2019/02/07/how-to-move-docker-data-directory-to-another-location-on-ubuntu/

星期三, 4月 06, 2022

 

Installing Nextcloud on a Raspberry Pi with docker


I found a good reference on https://github.com/chrisbeardy/nextcloud-docker-raspberrypi-tutorial

星期四, 12月 27, 2018

Prevent .vmem file created

VMWare guest on SSD, prevent .vmem files created

prefvmx.minVmMemPct = "100"
MemTrimRate = "0"
mainMem.useNamedFile = "FALSE"
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"

星期四, 11月 12, 2015

CR-7 3DP enlargement & improvment

The note for CR-7 modification.

https://www.facebook.com/groups/CR7.3Dprinter/permalink/1694600304104248/


https://www.facebook.com/groups/CR7.3Dprinter/permalink/1707951899435755/


https://www.facebook.com/groups/CR7.3Dprinter/permalink/1712531022311176/


1. Base

acrylic 6mm
Y axis M4 x 4, X axis M4 x 3,Z axis M5 x 3
https://www.facebook.com/groups/CR7.3Dprinter/1713610108869934/

2. Slide plate (4 wheels)

acrylic 6mm
https://www.facebook.com/groups/CR7.3Dprinter/1712531438977801/

3. Printing Base (with 4 magnet)

acrylic 6mm
https://www.facebook.com/groups/CR7.3Dprinter/1712531222311156/

4. 3mm 210x210mm glass (with 4 magnet)


5. V-Slot aluminum extrusion

2040 370mm x 1 (Z axis)
2040 340mm x 1 (Y axis)
2020 295mm x 1 (X axis)
2020 140mm x 1 (X axis)

6. T8-Lead Screw holder

https://www.facebook.com/groups/CR7.3Dprinter/1702000616697550/

7. T8 Lead Screw

8. Beam Coupling (5mm to 8mm)

9. belt 2M


10. PTFE tube (4*2mm) 400mm


11. opto limit for Z asix


12. Slide nut M4 x 13 M5 x 1 (optional)


星期五, 7月 04, 2014

Savageboard Dual/Solo with BCM43241 in Yocto

Yocto image for Savageboard Dual/Solo with BCM43241

This image includes:
1.   opencv library (for more information: this link is helpful: http://imxcv.blogspot.tw/2014/02/building-opencv-24x-for-freescales-imx6.html )
2.   gstermer for fsl
3.   opengles demo with 3D acceleration

To test WiFi & BT:
1.   WIFI (modify /etc/wpa_supplicant.conf for your WiFi environment. Using wpa_passphrase ssid key to generate the key)
modprobe bcmdhd (insert wifi driver)
ifup wlan0 (bring up wifi & wpa_supplicant, then udhcpc will try to get IP address from WiFi AP)
PS: Please unpluging ethernet cable beforce wifi testing, due to udhcpc may not get DNS setting at ethernet cable plugged.
2.   BT
rfkill unblock wimax
brcm_patchram_plus --no2bytes --baudrate 3000000 --use_baudrate_for_download --patchram /etc/wifi/bcm4324.hcd /dev/ttymxc2
hciattach -s 3000000 /dev/ttymxc2 any 3000000 flow
rfkill unblock bluetooth
hciconfig hci0 up

hcitool scan (will show BT devices nearby)

To test OpenCV:
Ex: DISPLAY=:0 ./camera_test

To test Gstermer:
  gst-launch filesrc location=1080p.mp4 typefind=true ! aiurdemux ! queue ! vpudec ! mfw_v4lsink

  PS: If getting “gst-launch-0.10: page allocation failure: order:11, mode:0xd1”, please free more system memory by “echo 3 > /proc/sys/vm/drop_caches”

星期五, 12月 27, 2013

add exist git repo up to github

Take uboot_savage_mx6 as example.

1. git remote add pb https://github.com/allencyhsu/uboot_savage_mx6.git

2. git remote -v
origin  git://git.freescale.com/imx/uboot-imx.git (fetch)
origin  git://git.freescale.com/imx/uboot-imx.git (push)
pb  https://github.com/allencyhsu/uboot_savage_mx6.git (fetch)
pb  https://github.com/allencyhsu/uboot_savage_mx6.git (push)

3. git push pb savage-jb
   answer the id & pass question.

4. wait couple minutes to complete upload.

5. go to github to check the code uploaded.

星期二, 9月 17, 2013

Add a project on exist AOSP repository


Add a project on exist AOSP repository (ex: realtek android driver)


  • Make a git repository & add/commit files
    cd /hardware/realtek/wlan
    git init
    git add *
    git commit -m "1st release" -a


  • Create .repo/projects
    cd .git
    mkdir -p ../../../../.repo/projects/hardware/realtek/wlan.git
    cp -a * ../../../../.repo/projects/hardware/realtek/wlan.git/

  • Remove local git files & make link to .repo/projects
    rm -rf branches/ config description hooks/ info/ logs/ objects/ refs/
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/branches .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/config .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/description .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/hooks .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/info .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/logs .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/objects .
    ln -s ../../../../.repo/projects/hardware/realtek/wlan.git/refs .


  • Edit project.list and manifest.xml

    vi .repo/project.list
- add
 hardware/realtek/wlan
    vi .repo/manifest.xml 
- add
         

星期一, 4月 15, 2013

Ubuntu pptp server

1. install pptpd service
sudo apt-get install pptpd

2. iptables rules
-A INPUT -i xyz0 -p tcp -m state --state NEW --dport 1723 -j ACCEPT

-A INPUT -i xyz0 -p gre -j ACCEPT
-A OUTPUT -i xyz0 -p gre -j ACCEPT
-A INPUT -i xyz0 -p tcp --sport 1723 -s xxx.xxx.xxx.xxx -j ACCEPT
-A OUTPUT -i xyz0 -p tcp --dport 1723 -d xxx.xxx.xxx.xxx -j ACCEPT

xyz0 is the out interface.
xxx.xxx.xxx.xxx is the pptp server address

3. /etc/pptpd.conf
modify localip & remoteip

localip xxx.xxx.xxx.xxx
remoteip 192.168.x.51-59

xxx.xxx.xxx.xxx is the pptp server address

4. /etc/ppp/chap-secrets
add one entry for pptpd

# client server secret IP addresses
"user" pptpd "password" *

5. start pptpd service

星期二, 3月 12, 2013

Use tmpfs in Ubuntu to speed up

Why? Sometime, you will use USB stick to boot up to another testing Ubuntu distribution, but the USB stick as main disk is really slow. So, I choose to use Linux tmpfs to avoid un-necessary access.

/etc/fstab
tmpfs           /tmp            tmpfs   defaults,noatime,mode=1777      0       0

tmpfs           /var/spool      tmpfs   defaults,noatime,mode=1777      0       0
tmpfs           /var/tmp        tmpfs   defaults,noatime,mode=1777      0       0

星期五, 3月 08, 2013

Install Android JB build environment on Ubuntu precise x64


Install Oracle JDK :
go to "https://raw.github.com/flexiondotorg/oab-java6/" get oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh
after oab-jave.sh finished.
sudo apt-get install sun-java6-jdk

sudo update-alternatives --config java
choose "java-6-sun"

Install Android build necessary package Ubuntu 12.04 x64:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos  python-markdown libxml2-utils xsltproc zlib1g-dev:i386 uboot-mkimage

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

星期日, 10月 21, 2012

Pandaboard mldonkey server

1. the original mldonkey with precise has bug.
https://bugs.launchpad.net/ubuntu/+source/mldonkey/+bug/1060007

2. try to build for my own.
   - get mldonkey-3.1.3.tar.bz2 from official site
   - extract & get build depend package
     apt-get install build-essential checkinstall ocaml-nox ocaml-native-compilers zlib1g-dev
   - change CXXFLAGS -O2 to -Os
   - ./configure --disable-multinet
   - make -j2
   - copy ./mlnet to /usr/bin/mlnet (to replace the old one)

3. regarding the password for remote user.
    - telnet 127.0.0.1 4000
    - useradd admin xxxx (xxxx is password you want)

Ref: https://help.ubuntu.com/community/MLDonkey
       http://mldonkey.sourceforge.net/Quickstart_guide
       http://mldonkey.sourceforge.net/CompilationProblems

Pandaboard - fix smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped

1. add smsc95xx.turbo_mode=N in /boot/boot.script

2.  /etc/sysctl.conf
    - vm.min_free_kbytes = 16384 32768
    - vm.vfs_cache_pressure = 200  300

3.  update systcl
    - sudo sysctl -p

lsmod result in Ubuntu precise on Pandaboard


ppp_deflate             4867  0
zlib_deflate           21306  1 ppp_deflate
bsd_comp                5569  0
ppp_async               7602  1
crc_ccitt               1628  1 ppp_async
xt_tcpudp               2573  29
xt_state                1384  1
iptable_filter          1733  1
ipt_MASQUERADE          1954  1
iptable_nat             4528  1
nf_nat                 19315  2 ipt_MASQUERADE,iptable_nat
nf_conntrack_ipv4      14233  4 iptable_nat,nf_nat
nf_conntrack           85255  5 xt_state,ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4
nf_defrag_ipv4          1594  1 nf_conntrack_ipv4
ip_tables              13212  2 iptable_filter,iptable_nat
x_tables               19387  6 xt_tcpudp,xt_state,iptable_filter,ipt_MASQUERADE,iptable_nat,ip_tables
dm_crypt               18016  0
wl12xx                174783  0
mac80211              490889  1 wl12xx
cfg80211              203992  2 wl12xx,mac80211
wl12xx_sdio             3829  0
compat                  3663  4 wl12xx,mac80211,cfg80211,wl12xx_sdio
gpio_keys               9031  0
leds_gpio               3788  0

Pandaboard disable ondemand cpu governor

1. sudo update-rc.d ondemand disable

2. modify rc.local
# By default this script does nothing.
#set scaling_governor to userspace
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo userspace > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# set cpufreq to 800Mhz
echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo 800000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed

Android keylayout support

1. kernel add gpio key support
2. choose the right .kl & .kcm
it should be the same with the gpio key driver name(ex: gpio-keys.xx)

Openbravo POS note in Lucid (ARMv7)

RXTX could use the repo's package

but, RXTXComm.jar need to be put in /usr/lib/jvm/java-6-openjdk/jre/lib/ext

librxtxParallel.so, librxtxSerial.so need to be put in /usr/lib/jvm/java-6-openjdk/jre/lib/arm

Use TestSerialPort to do the test.
1. javac *.java
2. java ListCommPorts (check result)

Ubuntu ttySx default only root & dialout have permission to use.
so, the openbravo user need to join dialout group.

for autologon & auto-launch openbravo-pos
/etc/lxdm/lxdm.conf need to be modified
[base]
autologin=opos
session=/opt/openbravopos-2.30/start.sh