Skip to content

Commit 0c151eb

Browse files
committed
updated kb-dev-setup-notes.md
1 parent 4f32082 commit 0c151eb

3 files changed

Lines changed: 81 additions & 6 deletions

File tree

demo/java-history.png

845 KB
Loading

demo/kb-dev-setup-notes.md

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Keyboard shortcuts](#keyboard-shortcuts)
1717
- [Install Apps](#install-apps)
1818
* [Software and Tools on Windows](#software-windows)
19+
* [VirtualBox Setup and Network](#vbox-setup)
1920
* [Online Tools](#online-tools)
2021

2122

@@ -81,8 +82,7 @@
8182
uname -a
8283
system_profiler SPSoftwareDataType
8384
system_profiler -detailLevel full # -xml output to XML
84-
cat /proc/cpuinfo # for processor info
85-
cat /proc/meminfo # for RAM status
85+
/usr/sbin/sysctl -a machdep.cpu
8686
```
8787

8888
* Arrange windows / menu bar / finder / mission control
@@ -101,6 +101,8 @@
101101
* moving cursor to beginning and end of line (Terminal)
102102
- `Fn+←`: `Home`, Send Text: `\001` (no modifier)
103103
- `Fn+→`: `End`, Send Text: `\005` (no modifier)
104+
* clear current command line during input
105+
- `ESC` or `Cmd+L`: Send Hex `0x05 0x15` (moving to end and delete line)
104106
* screenshot:
105107
- `Cmd+Shift+3`: copy screen to file;
106108
- `Cmd+Shift+Alt+3`: copy screen to clipboard.
@@ -325,6 +327,13 @@
325327
rm -rf **/*.pyc
326328
```
327329
330+
* Disable `.DS_Store`
331+
332+
```
333+
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
334+
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool TRUE
335+
```
336+
328337
* Disable Airplay
329338
330339
```bash
@@ -837,9 +846,10 @@
837846
- [Xtreme](https://sourceforge.net/projects/xdman/)
838847
839848
* Free VPN with kill switch
840-
- Free [TunnelBear](https://www.tunnelbear.com/)
841-
- [Hotspot Shield](https://apps.apple.com/us/app/vpn-hotspot-shield-super-vpn/id443369807)
842849
- [ProtonVPN](https://protonvpn.com/)
850+
- [Hotspot Shield](https://apps.apple.com/us/app/vpn-hotspot-shield-super-vpn/id443369807)
851+
- Free [TunnelBear](https://www.tunnelbear.com/)
852+
- [Windscribe](https://windscribe.com/)
843853
844854
* Homebrew [brew.sh](http://brew.sh/)
845855
@@ -850,6 +860,29 @@
850860
brew install tree
851861
```
852862
863+
* Java
864+
- [Basic guide](https://www.freecodecamp.org/news/how-to-set-up-java-development-environment-a-comprehensive-guide/)
865+
- see [versions history](java-history.png) | [wiki](https://en.wikipedia.org/wiki/Java_version_history)
866+
- [Jabba](https://github.com/shyiko/jabba) - a lightweight version manager
867+
868+
```
869+
brew install jabba
870+
jabba ls-remote
871+
jabba install <version> # ~/.jabba/jdk/
872+
jabba use <version>
873+
```
874+
875+
- [SDKMAN](https://sdkman.io/) - a dev kit manager
876+
877+
```
878+
curl -s "https://get.sdkman.io" | bash
879+
source "$HOME/.sdkman/bin/sdkman-init.sh"
880+
sdk list java
881+
sdk install java 17.0.1-open # sdk install java <version> at ~/.sdkman/candidates/java/
882+
sdk use java 17.0.1-open
883+
java -version
884+
```
885+
853886
* MongoDB
854887
855888
- install
@@ -967,6 +1000,7 @@
9671000
- [tmate](https://tmate.io/): `brew install tmate`
9681001
- [Tunnelblick](https://tunnelblick.net/)
9691002
- [Unarchiver](http://wakaba.c3.cx/s/apps/unarchiver.html)
1003+
- Oracle [VirtualBox](https://www.virtualbox.org/)
9701004
- [VMware Fusion for Mac](https://www.vmware.com/products/fusion.html)
9711005
- [Wine](https://www.winehq.org/)
9721006
- [PlayOnMac](https://www.playonmac.com)
@@ -1246,6 +1280,13 @@
12461280
<br/><a name="command-lines"></a>
12471281
### Command lines
12481282
1283+
- basic info
1284+
1285+
```
1286+
cat /proc/cpuinfo # for processor info
1287+
cat /proc/meminfo # for RAM status
1288+
```
1289+
12491290
- check installed packages
12501291
12511292
```
@@ -1641,8 +1682,8 @@
16411682
sudo tar -xvf go$VERSION*.$OS*-$ARCH*.tar.gz
16421683
sudo mv go /usr/local
16431684
# add the following to ~/.bashrc
1644-
export GOROOT=/usr/local/go
1645-
export GOPATH=$HOME/go
1685+
export GOROOT="${GOROOT:-$(type -p go|xargs greadlink -f 2>/dev/null|xargs dirname|xargs dirname)}"
1686+
export GOPATH=${HOME}/go
16461687
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
16471688
# test go
16481689
go version
@@ -1811,6 +1852,39 @@
18111852
18121853
18131854
1855+
<br/><a name="vbox-setup"></a>
1856+
## VirtualBox Setup and Network
1857+
1858+
### Install and Setup
1859+
1860+
```
1861+
brew install virtualbox
1862+
```
1863+
1864+
### Network
1865+
1866+
VBox's implementation of NAT only supports TCP & UDP among all transport layer protocols [[1]](https://www.virtualbox.org/manual/ch06.html#nat-limitations), so VPN via PPTP won't work. As support for bridged networking with wireless interfaces is also limited [[2]](https://www.virtualbox.org/manual/ch06.html#network_bridged). Consider the followings alternative.
1867+
1868+
**Host-only network with Internet** can be achieved with IP routing by host. Good with Windows/Ubuntu host and guests. It should work for MacOS too.
1869+
1870+
In OSX host (e.g. 192.168.8.109), enable ip routing by
1871+
1872+
```
1873+
sudo sysctl -w net.inet.ip.forwarding=1
1874+
```
1875+
1876+
In Win10 guest with host-only adapter (e.g. 192.168.56.10), set default gateway to OSX (e.g. 192.168.56.1), set DNS to router.
1877+
1878+
In router (e.g. 192.168.8.1), add static route via web interface or SSH
1879+
1880+
```
1881+
route add -net 192.168.56.0/24 gw 192.168.8.109
1882+
```
1883+
1884+
Read this [lab manual](http://www.cs.dartmouth.edu/~sergey/cs60/lab3/vm-networking.pdf) (courtesy of CS@Dartmouth) for setting up internet in VBox guest with Host-only Adapter and native NAT by MacOS host.
1885+
1886+
1887+
18141888
<br/><a name="online-tools"></a>
18151889
## Online tools
18161890

tools/bashrc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ alias hide='chflags hidden'
104104
alias hs='history | grep'
105105
alias ip='echo $(ipconfig getifaddr en0) $(dig +short myip.opendns.com @resolver1.opendns.com)'
106106
alias ipwan='dig +short myip.opendns.com @resolver1.opendns.com # or `curl -s icanhazip.com`'
107+
alias javaenv='java -version && echo JAVA_HOME='`echo ${JAVA_HOME}`
107108
alias ll='ls -al'
108109
alias lll='ls -al -T | sort -f -k9,9' # --time-style=full-iso
109110
alias lln='ls -al | sort -f -k9,9'

0 commit comments

Comments
 (0)