Tuesday, December 15, 2020

compiling on macbook - xcrun error

error:

xcrun: error: invalid active developer path

solution:

1. install xcode

2. xcode-select --install

Thursday, November 19, 2020

* The long retry limit - default 4: applies to frames longer than the RTS threshold.

        A frame requiring RTS/CTS clearing is retransmitted four times before it is discarded and reported to higher-level protocols.

* The short retry limit - default 7: applies to frames shorter than the RTS threshold.


Thursday, October 29, 2020

Adding a dummy monitor

 

sudo apt-get install xserver-xorg-video-dummy


sudo vi /etc/X11/xorg.conf


Section "Device"

    Identifier  "Configured Video Device"

    Driver      "dummy"

EndSection


Section "Monitor"

    Identifier  "Configured Monitor"

    HorizSync 31.5-48.5

    VertRefresh 50-70

EndSection


Section "Screen"

    Identifier  "Default Screen"

    Monitor     "Configured Monitor"

    Device      "Configured Video Device"

    DefaultDepth 24

    SubSection "Display"

    Depth 24

    Modes "1024x800"

    EndSubSection

EndSection

Tuesday, October 20, 2020

Disabling DHCP and DNS role - OpenWrt

uci set dhcp.lan.ignore="1"

uci set dhcp.@dnsmasq[0].port="0"

uci commit dhcp

/etc/init.d/dnsmasq restart

/etc/init.d/odhcpd restart

Thursday, July 30, 2020

Thursday, April 16, 2020

ifdef if defined if !defined

#if defined(LINUX) || defined(ANDROID)

#if !defined(MANUF) || !defined(SERIAL) || !defined(MODEL)

#if defined(LINUX) && !defined(MODEL)

#endif

Friday, March 20, 2020

shell if statement



reference: https://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php

if [ <some test> ]
then
<commands>
fi

================== compare number ================
#!/bin/bash
# Basic if statement
if [ $1 -gt 100 ]
then
    echo Hey that\'s a large number.
    pwd
fi
================== compare string ================
#!/bin/sh
if [ -z $1 ]
then
   echo "no input string given"
   return
fi
==============================================




  • Operator Description
    ! EXPRESSION The EXPRESSION is false.
    -n STRING The length of STRING is greater than zero.
    -z STRING The lengh of STRING is zero (ie it is empty).
    STRING1 = STRING2 STRING1 is equal to STRING2
    STRING1 != STRING2 STRING1 is not equal to STRING2
    INTEGER1 -eq INTEGER2 INTEGER1 is numerically equal to INTEGER2
    INTEGER1 -gt INTEGER2 INTEGER1 is numerically greater than INTEGER2
    INTEGER1 -lt INTEGER2 INTEGER1 is numerically less than INTEGER2
    -d FILE FILE exists and is a directory.
    -e FILE FILE exists.
    -r FILE FILE exists and the read permission is granted.
    -s FILE FILE exists and it's size is greater than zero (ie. it is not empty).
    -w FILE FILE exists and the write permission is granted.
    -x FILE FILE exists and the execute permission is granted.



  • = is slightly different to -eq. [ 001 = 1 ] will return false as = does a string comparison (ie. character for character the same) whereas -eq does a numerical comparison meaning [ 001 -eq 1 ] will return true.
  • When we refer to FILE above we are actually meaning a path. Remember that a path may be absolute or relative and may refer to a file or a directory.



  • bash> test 001 = 1
  • bash> echo $?
  • bash> 1
  • bash> test 001 -eq 1
  • bash> echo $?
  • bash> 0
  • bash> touch myfile
  • bash> test -s myfile
  • bash> echo $?
  • bash> 1
  • bash> ls /etc > myfile
  • bash> test -s myfile
  • bash> echo $?
  • bash> 0
  • Tuesday, February 11, 2020

    How to configure routing between LAN and WAN



    https://monoinfinito.wordpress.com/series/setting-up-a-linux-gatewayrouter-a-guide-for-non-network-admins/

    Monday, February 10, 2020

    dhcp perf tools


    1. How to install
        kea-admin contains perfdhcp binary

    $ sudo apt install kea-admin

    $ sudo perfdhcp -p 60 -r 100 -d 5 -R 50 192.168.1.1

    2. User manual
    https://users.isc.org/~tomasz/perfdhcp/dhcp-perf-guide.html#perfdhcp-commandline-examples
    - adding delayed-ack 32 that allows packets to queue before send
    - max-ack-delay that increase time to fsync
    - ping-check false
    - dont-use-fsync to true

    3. Build your own
        build/install from source

    $ sudo apt -y install automake libtool pkg-config build-essential ccache

    $ sudo apt -y install libboost-dev libboost-system-dev liblog4cplus-dev libssl-dev

    $ git clone https://gitlab.isc.org/isc-projects/kea.git

    $ cd kea

    $ autoreconf --install

    $ ./configure [your additional options here]

    $ make -j4

    $ sudo make install

    $ echo "/usr/local/lib/hooks" > /etc/ld.so.conf.d/kea.conf

    $ ldconfig

    Wednesday, February 5, 2020

    git submodule



    *** sync submodule
    $ git checkout master
    M meta-openembedded
    M poky
    $ git submodule update

    git submodule add https://git.kernel.org/pub/scm/linux/kernel src/linux

    git config examples)
    .git/config
    [submodule "linux"]
    url = https://git.kernel.org/pub/scm/linux/kernel

    .gitmodules
    [submodule "linux-msm"]
    path = src/linux
    url = https://git.kernel.org/pub/scm/linux/kernel
    rev = b27efee486f8a24682f36908fb2693a7b310303b

    git clone --recurse-submodules --branch <branch name> <git url>

    git clone --single-branch --recurse-submodules --branch <branch name> <git url>

    git submodule sync
        Synchronizing submodule url for 'xxx'
        fatal: no submodule mapping found in .gitmodules for path 'yyy'
    git rm -r yyy --cached

    trouble shootings)
    git rm --cached src/linux
    rm -rf src/linux
    rm -rf .git/modules/src/linux



    git submodule [--quiet] add [-b branch] [-f|--force]
          [--reference <repository>] [--] <repository> [<path>]
    git submodule [--quiet] status [--cached] [--recursive] [--] [<path>…​]
    git submodule [--quiet] init [--] [<path>…​]
    git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase]
          [--reference <repository>] [--merge] [--recursive] [--] [<path>…​]
    git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>…​]
    git submodule [--quiet] foreach [--recursive] <command>
    git submodule [--quiet] sync [--] [<path>…​]


    *** Update git submodule to their remote origin

    # Get the submodule initially
    git submodule add ssh://bla submodule_dir
    git submodule init

    # Time passes, submodule upstream is updated
    # and you now want to update

    # Change to the submodule directory
    cd submodule_dir

    # Checkout desired branch
    git checkout master

    # Update
    git pull

    # Get back to your project root
    cd ..

    # Now the submodules are in the state you want, so
    git commit -am "Pulled down update to submodule_dir"


    git submodule foreach git pull origin master





    Thursday, January 23, 2020

    Tuesday, January 14, 2020

    apt clean



    sudo rm /var/lib/apt/lists/*
    sudo rm /var/cache/apt/*.bin
    
    
    sudo apt update

    Monday, January 13, 2020

    VirtualBox clone / resize



    /Users/peteroh/VirtualBox VMs/Ubuntu-16.04/Ubuntu-16.04.vdi

    VBoxManage clonehd Ubuntu-16.04.vdi Ubuntu-16.04-2.vdi --format VDI --variant Standard

    VBoxManage modifyhd Ubuntu-16.04.vdi --resize 50000