find . -name "FILE-TO-FIND" -exec rm -rf {} \;
Thursday, August 5, 2021
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
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
#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. |
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
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
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
Thursday, December 12, 2019
FCC Telecommunication Ref
https://www.ecfr.gov/cgi-bin/text-idx?SID=42a02d0348e514926b26630eb40d4777&mc=true&tpl=/ecfrbrowse/Title47/47tab_02.tpl
https://apps.fcc.gov/oetcf/eas/reports/GenericSearchResult.cfm?RequestTimeout=500
https://apps.fcc.gov/oetcf/kdb/index.cfm
https://apps.fcc.gov/oetcf/kdb/forms/FTSSearchResultPage.cfm?id=240776&switch=P
https://apps.fcc.gov/oetcf/eas/reports/GenericSearchResult.cfm?RequestTimeout=500
https://apps.fcc.gov/oetcf/kdb/index.cfm
https://apps.fcc.gov/oetcf/kdb/forms/FTSSearchResultPage.cfm?id=240776&switch=P
Monday, December 9, 2019
Friday, December 6, 2019
linux kernel scheduling class
ps -deo pid,cls,cmd | grep -e RR -e FF
cls CLS scheduling class of the process. (alias policy, class).
Field's possible values are:
- not reported
TS SCHED_OTHER
FF SCHED_FIFO
RR SCHED_RR
B SCHED_BATCH
ISO SCHED_ISO
IDL SCHED_IDLE
? unknown value
root@:/proc/sys/kernel# cat sched_rt_period_us 1000000 root@:/proc/sys/kernel# cat sched_rt_runtime_us 950000
Friday, November 22, 2019
kernel abort
arch/arm/mm/fsr-2level.c , fsr-3level.c
static struct fsr_info fsr_info[] = {
/*
* The following are the standard ARMv3 and ARMv4 aborts. ARMv5
* defines these to be "precise" aborts.
*/
{ do_bad, SIGSEGV, 0, "vector exception" },
{ do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGKILL, 0, "terminal exception" },
{ do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
/*
* The following are "imprecise" aborts, which are signalled by bit
* 10 of the FSR, and may not be recoverable. These are only
* supported if the CPU abort handler supports bit 10.
*/
{ do_bad, SIGBUS, 0, "unknown 16" },
{ do_bad, SIGBUS, 0, "unknown 17" },
{ do_bad, SIGBUS, 0, "unknown 18" },
{ do_bad, SIGBUS, 0, "unknown 19" },
{ do_bad, SIGBUS, 0, "lock abort" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 21" },
{ do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 23" },
{ do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 25" },
{ do_bad, SIGBUS, 0, "unknown 26" },
{ do_bad, SIGBUS, 0, "unknown 27" },
{ do_bad, SIGBUS, 0, "unknown 28" },
{ do_bad, SIGBUS, 0, "unknown 29" },
{ do_bad, SIGBUS, 0, "unknown 30" },
{ do_bad, SIGBUS, 0, "unknown 31" },
};
static struct fsr_info ifsr_info[] = {
{ do_bad, SIGBUS, 0, "unknown 0" },
{ do_bad, SIGBUS, 0, "unknown 1" },
{ do_bad, SIGBUS, 0, "debug event" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section access flag fault" },
{ do_bad, SIGBUS, 0, "unknown 4" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page access flag fault" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
{ do_bad, SIGBUS, 0, "unknown 10" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
{ do_bad, SIGBUS, 0, "unknown 16" },
{ do_bad, SIGBUS, 0, "unknown 17" },
{ do_bad, SIGBUS, 0, "unknown 18" },
{ do_bad, SIGBUS, 0, "unknown 19" },
{ do_bad, SIGBUS, 0, "unknown 20" },
{ do_bad, SIGBUS, 0, "unknown 21" },
{ do_bad, SIGBUS, 0, "unknown 22" },
{ do_bad, SIGBUS, 0, "unknown 23" },
{ do_bad, SIGBUS, 0, "unknown 24" },
{ do_bad, SIGBUS, 0, "unknown 25" },
{ do_bad, SIGBUS, 0, "unknown 26" },
{ do_bad, SIGBUS, 0, "unknown 27" },
{ do_bad, SIGBUS, 0, "unknown 28" },
{ do_bad, SIGBUS, 0, "unknown 29" },
{ do_bad, SIGBUS, 0, "unknown 30" },
{ do_bad, SIGBUS, 0, "unknown 31" },
};
static struct fsr_info fsr_info[] = {
/*
* The following are the standard ARMv3 and ARMv4 aborts. ARMv5
* defines these to be "precise" aborts.
*/
{ do_bad, SIGSEGV, 0, "vector exception" },
{ do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGKILL, 0, "terminal exception" },
{ do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
/*
* The following are "imprecise" aborts, which are signalled by bit
* 10 of the FSR, and may not be recoverable. These are only
* supported if the CPU abort handler supports bit 10.
*/
{ do_bad, SIGBUS, 0, "unknown 16" },
{ do_bad, SIGBUS, 0, "unknown 17" },
{ do_bad, SIGBUS, 0, "unknown 18" },
{ do_bad, SIGBUS, 0, "unknown 19" },
{ do_bad, SIGBUS, 0, "lock abort" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 21" },
{ do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 23" },
{ do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */
{ do_bad, SIGBUS, 0, "unknown 25" },
{ do_bad, SIGBUS, 0, "unknown 26" },
{ do_bad, SIGBUS, 0, "unknown 27" },
{ do_bad, SIGBUS, 0, "unknown 28" },
{ do_bad, SIGBUS, 0, "unknown 29" },
{ do_bad, SIGBUS, 0, "unknown 30" },
{ do_bad, SIGBUS, 0, "unknown 31" },
};
static struct fsr_info ifsr_info[] = {
{ do_bad, SIGBUS, 0, "unknown 0" },
{ do_bad, SIGBUS, 0, "unknown 1" },
{ do_bad, SIGBUS, 0, "debug event" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section access flag fault" },
{ do_bad, SIGBUS, 0, "unknown 4" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page access flag fault" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
{ do_bad, SIGBUS, 0, "external abort on non-linefetch" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
{ do_bad, SIGBUS, 0, "unknown 10" },
{ do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
{ do_bad, SIGBUS, 0, "external abort on translation" },
{ do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
{ do_bad, SIGBUS, 0, "unknown 16" },
{ do_bad, SIGBUS, 0, "unknown 17" },
{ do_bad, SIGBUS, 0, "unknown 18" },
{ do_bad, SIGBUS, 0, "unknown 19" },
{ do_bad, SIGBUS, 0, "unknown 20" },
{ do_bad, SIGBUS, 0, "unknown 21" },
{ do_bad, SIGBUS, 0, "unknown 22" },
{ do_bad, SIGBUS, 0, "unknown 23" },
{ do_bad, SIGBUS, 0, "unknown 24" },
{ do_bad, SIGBUS, 0, "unknown 25" },
{ do_bad, SIGBUS, 0, "unknown 26" },
{ do_bad, SIGBUS, 0, "unknown 27" },
{ do_bad, SIGBUS, 0, "unknown 28" },
{ do_bad, SIGBUS, 0, "unknown 29" },
{ do_bad, SIGBUS, 0, "unknown 30" },
{ do_bad, SIGBUS, 0, "unknown 31" },
};
Wednesday, November 20, 2019
How to get different colors in terminal
- set the
LSCOLORS environment variable
- create
an alias for ls
so that it shows colors by default
In
your ~/.bash_profile add the following:
#export LSCOLORS="EHfxcxdxBxegecabagacad"
export LSCOLORS="exfxcxdxbxegedabagacad"
alias ls='ls -lGH'
alias ls='ls -lGH'
alias
ls='ls -lGH' <-----This shows in
list format, follow symlinks colorized
The
the colors are set by each bit above; the first being foreground and the second
being background. The first two characters refer to directories having a bold
blue foreground and a light grey background.
However,
there's a great online utility to see what each of the colors mean and look
like in real time. It will even generate the "code" for you. (I am
not affiliated with this at all). It will work in both MacOS/FreeBSD and Linux.
Make sure you select the BSD option for macOS.
The
order of the attributes are as follows:
1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky
bit
11. directory writable to others, without sticky
The
color designators are as follows:
a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background
Wednesday, October 16, 2019
Subscribe to:
Posts (Atom)