星期一, 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

Pandaboard Ubuntu 12.04 precise note

My goal is make an device that be my wireless access point, transmission daemon, mldonkey daemon & samba server in my home.

1. first I take a look the following info as reference.
    http://drizztcp.wordpress.com/category/pandaboard/

2. Grab the Ubuntu 12.04 image from http://cdimage.ubuntu.com/releases/12.04/release/. I choose http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-preinstalled-server-armhf+omap4.img.gz for  my Pandaboard A2.

3. Make bootable SDCard & following the install instruction. https://wiki.ubuntu.com/ARM/OmapDesktopInstall

4. Now, I have an bootable Panda.

5. Configuration the hostapd.  I don't want just take my panda as AP only. So, I decide to run dhcpd on wlan0.
  5.1 dhcp-server part:
     5.1.1. apt-get install isc-dhcp-server
     5.1.2 modify /etc/default/isc-dhcp-server
        - INTERFACES="wlan0"
     5.1.3 modify /etc/dhcp/dhcpd.conf
        - option domain-name "myhome.net";
        - option domain-name-servers 168.95.192.1, 168.95.1.1; (for my Hinet DNS)
        - subnet 192.168.0.0 netmask 255.255.255.0 {
              range 192.168.0.100 192.168.0.150;
              option subnet-mask 255.255.255.0;
              option broadcast-address 192.168.0.255;
              option routers 192.168.0.254;
            }
  5.2 hostapd part:
    5.2.1 /etc/network/interfaces We need wlan0 has static ip to be the rule of dhcp-server.
       - auto wlan0
          iface wlan0 inet static
          address 192.168.0.254
          netmask 255.255.255.0
          network 192.168.0.0
          broadcast 192.168.0.255
    5.2.2 /etc/hostapd/hostapd.conf
        - interface=wlan0
          driver=nl80211
          ssid=panda-wifi
          hw_mode=g
          ieee80211n=1  # enable 802.11n support.
          wmm_enabled=1
          #ht_capab=[HT40-][HT40+] #Ti wl1271 only up to 65Mbps. HT40 will cause module hang.
          channel=5
          macaddr_acl=0
          #0 is allow all connection, 1 is deny all connect, only accept in hostspd.accept
          accept_mac_file=/etc/hostapd/hostapd.accept
          deny_mac_file=/etc/hostapd/hostapd.deny
          auth_algs=1
          ignore_broadcast_ssid=0
          wpa=2
          wpa_passphrase=xxxxxx #choose the password you want.
          wpa_key_mgmt=WPA-PSK
          wpa_pairwise=TKIP
          rsn_pairwise=CCMP
    5.2.3 touch /etc/hostapd/hostapd.accept & /etc/hostapd/hostapd.deny to let hostapd daemon running.
  OK, we have wlan0 & hostapd work now. Next, I want the pppoe work. Zyxel P874 seems performance is not good enough for P2P.
6. PPPoE on eth0
  6.1 install ppp, pppoe support
       - apt-get install ppp pppconfig pppoe pppoeconf
  6.2 /etc/ppp/peers/dsl-provider
       - pty "/usr/sbin/pppoe -I eth0 -T 80 -m 1452"
         noipdefault
         usepeerdns
         defaultroute         
         user "????????@ip.hinet.net"
  6.3 /etc/ppp/chap-secrets, /etc/ppp/pap-secrets
       - "????????@ip.hinet.net" * "??????"
  6.4 /etc/network/interfaces
       - add dsl-provider section
          auto dsl-provider
          iface dsl-provider inet ppp
          provider dsl-provider
    6.5 PPPoE keepalive.sh (for auto-reconnect)
#!/bin/sh

# keepalive.sh

# This is a keepalive script for the Casema cable modems. This script was
# lifted from the /usr/doc/HOWTO/unmaintained/mini/Dynamic-IP-Hacks
# document. There should be an entry in your crontab looking like:
# */2 * * * * /etc/ppp/keepalive.sh
# to run this script every 2 minutes to see if your connection is still
# up, if not, gracefully kill the pppd process and remake it.
# Modify paths as necessary.


if [ -f /var/run/ppp0.pid ]; then
testing=$(ping -c4 -l4 168.95.192.1 2>&1 | grep "0 packets")
if [ "$testing" != "" ]; then
        /usr/bin/poff -a
        sleep 10
        /usr/bin/pon dsl-provider
fi
else
        /usr/bin/pon dsl-provider
fi
    6.6 /etc/crontab
        - */2 *    * * *   root    /etc/ppp/keepalive.sh  (for auto-reconnect)

7. To be an Wireless router
    7.1 /etc/sysctl.conf
       - enable IPv4 forward
          net.ipv4.ip_forward=1
    7.2 add iptable rule.
       - wlan0 as LAN (192.168.0.xxx/24) , ppp0 as Internet connection
       7.2.1 /etc/firewall-rules
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i wlan0 -s 127.0.0.1/8 -j DROP
-A OUTPUT -o wlan0 -d 127.0.0.1/8 -j DROP
-A INPUT -i ppp0 -s 127.0.0.1/8 -j DROP
-A OUTPUT -o ppp0 -d 127.0.0.1/8 -j DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 22 -j ACCEPT
#for transmission package
-A INPUT -i ppp0 -p tcp -m tcp --dport 9091 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 51413 -j ACCEPT
#for FTP
-A INPUT -i wlan0 -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 21 -j ACCEPT
# for SSH
-A INPUT -i wlan0 -p tcp -m tcp --dport 22 -j ACCEPT
#for SMB/CIFS
-A INPUT -i wlan0 -p tcp -m tcp --dport 139 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 445 -j ACCEPT
#for transmission package
-A INPUT -i wlan0 -p tcp -m tcp --dport 4001 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 9091 -j ACCEPT
#for SMB/CIFS
-A INPUT -i wlan0 -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -i wlan0 -p udp -m udp --dport 138 -j ACCEPT
#deny hacker scan
-A INPUT -p tcp --tcp-flags ALL NONE -j DROP
-A FORWARD -p tcp --tcp-flags ALL NONE -j DROP
-A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
-A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
-A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
-A FORWARD -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
-A INPUT -p tcp --tcp-flags ACK,FIN FIN -j DROP
-A FORWARD -p tcp --tcp-flags ACK,FIN FIN -j DROP
-A INPUT -p tcp --tcp-flags ACK,URG URG -j DROP
-A FORWARD -p tcp --tcp-flags ACK,URG URG -j DROP
# icmp allow list
-A INPUT -p icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp --icmp-type 3/4 -j ACCEPT
-A INPUT -p icmp --icmp-type 4 -j ACCEPT
-A INPUT -p icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp --icmp-type 12 -j ACCEPT
-A INPUT -p icmp --icmp-type 14 -j ACCEPT
-A INPUT -p icmp --icmp-type 16 -j ACCEPT
-A INPUT -p icmp --icmp-type 18 -j ACCEPT
COMMIT
     7.2.2 /etc/network/interfaces
        - modify dsl-provider section.
           auto dsl-provider
           iface dsl-provider inet ppp
           pre-up iptables-restore < /etc/firewall-rules
           provider dsl-provider

8. install transmission daemon & do basic setting.

BTW, I upgrade the kernel to 3.4.0 (from PPA) & upgrade the tiwlan-wl12xx-dkms, tiwlan-wl12xx-firmware to help wl1271 more stable.

Done...