2017年8月5日 星期六

San Jose activity search


San Jose, CA - Official Website - Volunteer Opportunities
http://www.sanjoseca.gov/Index.aspx?NID=211

Creek Connections Action Group
http://www.cleanacreek.org/

Don Edwards San Francisco Bay National Wildlife Refuge - Alviso Events | Eventbrite
https://www.eventbrite.com/o/don-edwards-san-francisco-bay-national-wildlife-refuge-alviso-6363846263

San Francisco Bay Trail – A 500-Mile Trail Around the Bay
http://baytrail.org/

Story Night in San Francisco Downtown Hostel Tickets, Mon, Aug 28, 2017 at 6:30 PM | Eventbrite
https://www.eventbrite.com/e/story-night-in-san-francisco-downtown-hostel-tickets-31953351334?aff=es2


2017年7月25日 星期二

List Linux network interface driver in all the network namespaces

Linux: How to find the device driver used for a device? - Unix & Linux Stack Exchange
https://unix.stackexchange.com/questions/41817/linux-how-to-find-the-device-driver-used-for-a-device
networking - How do I find what kernel module is behind a network interface? - Ask Ubuntu
https://askubuntu.com/questions/216110/how-do-i-find-what-kernel-module-is-behind-a-network-interface

Improved driver finding and output format:

#!/bin/bash
for f in /sys/class/net/*; do
    dev=$(basename $f)
    driver=$(ethtool -i $dev 2>/dev/null | grep driver: | cut -c 9-)
    addr=$(cat $f/address)
    operstate=$(cat $f/operstate)
    printf "%020s [%017s]: %015s (%s)\n" "$dev" "$addr" "$driver" "$operstate"
done
 Save the above script as test.sh.

Enumerate all the interface in all the network namespaces
echo === NameSpace: Global ===
sh test.sh
for a in $(ip netns list | sed -e 's/(.*$//g') ; do
echo
echo === NameSpace: $a ===
    ip netns exec $a sh test.sh
done

2017年6月29日 星期四

主題 垃圾


公共電視 我們的島-漂流地圖
https://www.youtube.com/watch?v=e3vDzAr2hbk#action=share
http://ourisland.pts.org.tw/content/%E6%BC%82%E6%B5%81%E5%9C%B0%E5%9C%96-0#sthash.cBAykbIP.dpbs

一個垃圾的旅行 - 每日頭條
https://kknews.cc/travel/ae9enoj.html

乘著海漂垃圾去旅行——日本海洋廢棄物高峰會 | 荒野保護協會
https://www.sow.org.tw/blog/37/20161210/5122

「你知道為什麼日本會那麼乾淨嗎?」從設置垃圾桶反思的國際觀 | 楊宗翰/空屋筆記 | 換日線 Crossing
https://crossing.cw.com.tw/blogTopic.action?id=535&nid=7502

全球塑膠生產總量分析 揭83億噸的「重量級」傷害 | 台灣環境資訊協會-環境資訊中心
http://e-info.org.tw/node/206322

2017年4月23日 星期日

undefined reference to `rpl_malloc'


undefined reference to `rpl_malloc'
http://www.linuxquestions.org/questions/linux-software-2/undefined-reference-to-%60rpl_malloc%27-587256/

ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld


2017年3月27日 星期一

MaaS

https://docs.ubuntu.com/static/maas-1.9/orientation_architecture-diagram.png

https://github.com/opencord/maas/blob/master/API.md

Debugging ephemeral image
Troubleshooting | MAAS | MAAS documentation
https://docs.ubuntu.com/maas/2.1/en/troubleshoot-faq#debugging-ephemeral-image

MaaS images at
/var/lib/maas/boot-resources/*/*/*/*/*/*/root-image

Running JNLP on Ubuntu 16.04 Firefox

firefox - Why can't I run Java Web Start Applications? - Ask Ubuntu
http://askubuntu.com/questions/259819/why-cant-i-run-java-web-start-applications
sudo apt install icedtea-8-plugin

2017年3月13日 星期一

iPhone on Google Spreadsheets


Iphone users not able to edit google spreadsheets - Google Product Forums
https://productforums.google.com/forum/#!topic/docs/h3T-a8FVslE

add Googlesheets:// in front of the file name or full sheet URL to force it to open in App.

2017年2月28日 星期二

[node.js] phantomjs doesn't has arm64 support

not recognizing arm64. · Issue #579 · Medium/phantomjs
https://github.com/Medium/phantomjs/issues/579

Unexpected platform or architecture: linux/arm64
It seems there is no binary available for your platform/architecture
Try to install PhantomJS globally
Phantomjs doesn't has arm64 support. Need to rebuild it manually.

Build | PhantomJS
http://phantomjs.org/build.html

2017年2月3日 星期五

ssh port forward

Local Port Forward
(On MYPC) ssh -L A:B:X:Y HOST
On  MYPC, map A:B to access X:Y via HOST
A is usually 0.0.0.0, 127.0.0.1, or any existing IP on HOST

ssh -L 8080:localhost:80 prod -o GatewayPorts=yes
ssh -L 0.0.0.0:8080:localhost:80 prod

Remote Port Forward
(On MYPC) ssh -R A:B:X:Y HOST
On HOST, map A:B to access X:Y via MYPC
A is usually 0.0.0.0, 127.0.0.1, or any existing IP on MYPC



tunnel - Reverse port tunnelling - Ask Ubuntu
http://askubuntu.com/questions/50064/reverse-port-tunnelling

Why can I not connect to a reverse SSH tunnel port remotely, even with GatewayPorts enabled? - Super User
http://superuser.com/questions/767524/why-can-i-not-connect-to-a-reverse-ssh-tunnel-port-remotely-even-with-gatewaypo

networking - How does reverse SSH tunneling work? - Unix & Linux Stack Exchange
http://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work

Setup local APT repo

How to create a local APT repository? - Ask Ubuntu
http://askubuntu.com/questions/170348/how-to-create-a-local-apt-repository


sudo apt-get install dpkg-dev
sudo mkdir -p /usr/local/mydebs
cd /usr/local/mydebs
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz


Add a line to /etc/apt/source.list, or source.list.d

deb [ trusted=yes ] file:/usr/local/mydebs ./
Adding the trusted=yes to avoid --force-yes.

2017年1月9日 星期一

gmail search


Selecting all inbox emails and removing a particular label if they have that label - Google Product Forums
https://productforums.google.com/forum/#!topic/gmail/wyS1AR6WT1E

in:inbox label:label-a

Finding Gmail Messages with No Label | Raised by TurtlesRaised By Turtles
http://raisedbyturtles.org/view-unlabeled-gmail
-has:userlabels -in:sent -in:chat -in:draft -in:inbox

2016年12月31日 星期六

juju

Juju | Cloud | Ubuntu
https://www.ubuntu.com/cloud/juju

Getting started with Juju | Documentation | Juju
https://jujucharms.com/docs/stable/getting-started

Charm hooks | Documentation | Juju
https://jujucharms.com/docs/stable/authors-charm-hooks

Dealing with errors encountered by charm hooks | Documentation | Juju
https://jujucharms.com/docs/devel/authors-hook-errors

Debugging Juju charm hooks | Documentation | Juju
https://jujucharms.com/docs/1.25/authors-hook-debug

Charm Tools | Documentation | Juju
https://jujucharms.com/docs/1.25/tools-charm-tools

juju debug-hooks _unit_ _hooks_
juju resolved _unit_

gradle

Installing Gradle - Gradle User Guide Version 3.2.1
https://docs.gradle.org/current/userguide/installation.html

Build Script Basics - Gradle User Guide Version 3.2.1
https://docs.gradle.org/current/userguide/tutorial_using_tasks.html

2016年12月27日 星期二

ansible

Installation — Ansible Documentation
http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible

Getting Started — Ansible Documentation
http://docs.ansible.com/ansible/intro_getting_started.html
/etc/ansible/hosts

Intro to Playbooks — Ansible Documentation
http://docs.ansible.com/ansible/playbooks_intro.html

Playbook Roles and Include Statements — Ansible Documentation
http://docs.ansible.com/ansible/playbooks_roles.html



Tags — Ansible Documentation

http://docs.ansible.com/ansible/playbooks_tags.html

Playbook Debugger — Ansible Documentation
https://docs.ansible.com/ansible/playbooks_debugger.html

An Ansible Tutorial - Servers for Hackers
https://serversforhackers.com/an-ansible-tutorial


2016年12月24日 星期六

Linux Google Drive

sudo apt-get install golang git mercurial
go get -u github.com/odeke-em/drive/cmd/drive
drive init


drive list
drive pull
drive push

An Official Google Drive for Linux is Here, Sort Of — Maybe This Is All We’ll Ever Get
http://www.howtogeek.com/196635/an-official-google-drive-for-linux-is-here-sort-of-maybe-this-is-all-well-ever-get/

GitHub - odeke-em/drive: Google Drive client for the commandline
https://github.com/odeke-em/drive#requirements

GitHub - tools/godep: dependency tool for go
https://github.com/tools/godep

2016年11月16日 星期三

Setting PCIe MPS/MRRS with setpci

setpci(8): configure PCI devices - Linux man page
https://linux.die.net/man/8/setpci

PCI express maximal payload size: Finding it and its impact on bandwidth
http://billauer.co.il/blog/2011/05/pcie-pci-express-linux-max-payload-size-configuration-capabilities-tlp-lspci/

Intel Ethernet Drivers and Utilities / Mailing Lists
https://sourceforge.net/p/e1000/mailman/message/30249072/

Intel PCI Express base 1.0 spec.pdf
http://teacher.en.rmutt.ac.th/ktw/MicroProcessor/buses/Intel%20PCI%20Express%20base%201.0%20spec.pdf
p337, ch7.8.3. Device Capabilities Register (Offset 04)
p341, ch7.8.4. Device Control Register (Offset 08h)

dev=0002:01:02.2

setpci --dumpregs

setpci -v -s $dev CAP_EXP.l
#display the first 4-byte of CAP_EXP...
for a in $(lspci | cut -d' ' -f1 ); do echo $a ----; --;setpci -v -s $a CAP_EXP.l 2>&1 ; done | less

#Show Device Capabilities Register
setpci -v -s $dev CAP_EXP+4.l
#Show Device Control Register
setpci -v -s $dev CAP_EXP+8.l

#Set value to Device Control Register 
setpci -v -s $dev CAP_EXP+8.l=aabbccdd

2016年11月9日 星期三

btrfs


Installing btrfs as boot drive on Ubuntu 14.04 - James DiGioia
http://jamesdigioia.com/installing-btrfs-boot-drive-ubuntu-14-04/

btrfs - Community Help Wiki
https://help.ubuntu.com/community/btrfs#Converting_Ubuntu_12.10_ext4_root_filesystem

How to Create and Manage Btrfs Snapshots and Rollbacks on Linux (part 2) | Linux.com | The source for Linux information
https://www.linux.com/learn/how-create-and-manage-btrfs-snapshots-and-rollbacks-linux-part-2

How to Manage Btrfs Storage Pools, Subvolumes And Snapshots on Linux (part 1) | Linux.com | The source for Linux information
https://www.linux.com/learn/how-manage-btrfs-storage-pools-subvolumes-and-snapshots-linux-part-1

2016年11月1日 星期二

MCORD: No module named translator.toscalib.tosca_template

CORD build info is in here:
http://mkl-note.blogspot.com/2016/10/cord-in-box-quick-start-guide-target.html
https://gerrit.opencord.org/vBBU faab9e27521d0c2cdf34c36cd99b6327760d56eb
https://gerrit.opencord.org/vPGWC faab9e27521d0c2cdf34c36cd99b6327760d56eb

M-CORD Developer Environment - CORD - CORD Wiki
https://wiki.opencord.org/display/CORD/M-CORD+Developer+Environment

The following error occurs when building MCORD step "make xos":
    ImportError: No module named translator.toscalib.tosca_template

bash /home/ubuntu/service-profile/common/wait_for_xos_port.sh 80
Waiting for XOS to start listening on port 80
.......................XOS is ready
[PODCONFIG]
python /home/ubuntu/service-profile/common/run_tosca.py 80 padmin@vicci.org letmein setup.yaml
ERR: recieved status 500
Traceback (most recent call last):
  File "/opt/xos/api/utility/toscaapi.py", line 43, in post_run
    from tosca.engine import XOSTosca
  File "/opt/xos/tosca/engine.py", line 3, in
    import resources
  File "/opt/xos/tosca/resources/__init__.py", line 27, in
    module = __import__(fn[:-3])
  File "/opt/xos/tosca/resources/VPGWCComponent.py", line 6, in
    from translator.toscalib.tosca_template import ToscaTemplate
ImportError: No module named translator.toscalib.tosca_template
According to the following, the TOSCA parser is updated, but most of the import
is unnecessary. This patch remove those unnecessary import.

XOS Service Developers - please review imports in xos/tosca/resources/*.py - Google Groups
https://groups.google.com/a/opencord.org/forum/#!msg/cord-dev/eIemZc-BuUk/MhzlDuIhBQAJ
TOSCA parser in XOS core will be updated, and many services unnecessarily import the old TOSCA parser (along with other unneeded imports) in a way that will break your service after this update is merged.

Remove the line import ToscaTemplate from the following 4 files:
  1. vBBU/xos/tosca/resources/mcordservice.py
  2. vBBU/xos/tosca/resources/vbbucomponent.py
  3. vPGWC/xos/tosca/resources/VPGWCService.py
  4. vPGWC/xos/tosca/resources/VPGWCComponent.py

@@ -3,7 +3,7 @@ import pdb
 import sys
 import tempfile
 sys.path.append("/opt/tosca")
-from translator.toscalib.tosca_template import ToscaTemplate
+#from translator.toscalib.tosca_template import ToscaTemplate
 import pdb


You need to remove the existing docker image for the changes to take effect:
cd ~/service-profile/mcord/
make stop
make cleanup
sudo docker rm -f $(docker ps -aq)

make xos

2016年10月31日 星期一

CORD-in-a-Box Quick Start Guide: Target Server on CloudLab

ClouldLab, OnePC-Ubuntu14.04.4
https://github.com/opencord/cord/blob/master/docs/quickstart.md
https://github.com/opencord/cord.git  b5796fb8a34b779885abc9e8809e361d3463cde9
https://github.com/opencord/platform-install.git   b5796fb8a34b779885abc9e8809e361d3463cde9
bash ~/cord-in-a-box.sh -t | tee ~/install.out
Host Ubuntu 14.04
20161031
(Why so detail? because there's no guarantee it always work with the same environment)

mkl Note: CORD: LC_ALL not configured cause postgresql default cluster not created
http://mkl-note.blogspot.com/2016/10/cord-lcall-not-configured-cause.html

With the new script, I only encounter the above issue. Then I can finally see the holy X "BUILD SUCCESSFUL".

  1. Ensure no password sudo:
    sudo visudo -f /etc/sudoers.d/90-clouding-ubuntu
    Add the following line:
    user_name ALL=(ALL) NOPASSWD:ALL
  2. On your HOST, do not forward your locale to remote server by editing /etc/ssh/ssh_config and comment out SendEnv LANG LC_* line.
    sudo sed -e '/SendEnv/ s/^#*/#/' -i /etc/ssh/ssh_config
    Set the locale, then log out.
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    exit
    Log in again and try printing the LC_ALL
    printenv | grep LC
    => LC_ALL=en_US.UTF-8

  3. Install the required package (curl I understand, but juju....)
    sudo apt-get update
    sudo apt-get install -y build-essential curl juju git vim tmux
  4. Download the installation script and run. No sudo running the script.
    curl -o ~/cord-in-a-box.sh https://raw.githubusercontent.com/opencord/cord/master/scripts/cord-in-a-box.sh
    mv  -v --backup=numbered ~/install.out ~/install.out.bak; time bash ~/cord-in-a-box.sh -t 2>&1 | tee ~/install.out

The last part of the log:
test-exampleservice : Install curl in testclient ----------------------- 29.69s
maas-test-client-install : Install software ---------------------------- 27.43s
test-vsg : Create a sample CORD subscriber ------------------------------ 3.58s
maas-test-client-install : Install PIP packages ------------------------- 3.16s
test-vsg : Re-run 'make vtn' (work around bug in synchronizer) ---------- 3.07s
test-vsg : Test external connectivity in test client -------------------- 3.04s
test-exampleservice : Re-run 'make vtn' (work around bug in synchronizer) --- 3.02s
setup ------------------------------------------------------------------- 2.49s
setup ------------------------------------------------------------------- 2.14s
test-exampleservice : Get mgmt IP of VM --------------------------------- 2.02s
test-exampleservice : Get public IP of VM ------------------------------- 1.93s
test-vsg : Get mgmt IP of VM -------------------------------------------- 1.81s
test-vsg : Wait for vSG VM to come up ----------------------------------- 1.81s

BUILD SUCCESSFUL

Total time: 29 mins 7.094 secs
Connection to 192.168.121.252 closed.
+ [[ 0 -eq 1 ]]
+ exit 0

real    204m41.956s
user    2m18.897s
sys    0m34.802s
Yes, it's almost 3.5hr, with CloudLab's server.....

CORD: LC_ALL not configured cause postgresql default cluster not created

ClouldLab, OnePC-Ubuntu14.04.4
bash ~/cord-in-a-box.sh -t | tee ~/install.out
When installing maas, the script failed. Running "sudo apt-get install maas" manually get the following error:

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

It says there's no sql server listening at port 5432. "sudo apt-get install postgresql" shows the postgresql is already installed, but no default sql clusters created:
# pg_lsclusters
Ver Cluster Port Status Owner    Data directory    Log file
FIX1:
Setting a custom data directory for a new PostreSQL installation on Linux | Open Geospatial Technologies
http://geospatial.commons.gc.cuny.edu/2016/10/10/setting-a-custom-data-directory-for-a-new-postresql-installation-on-linux/

Let's create one:
sudo mkdir /data/sql-cluster -p
sudo pg_createcluster -d /data/sql-cluster --start 9.3 main
And you should see:
# pg_lsclusters
Ver Cluster Port Status Owner    Data directory    Log file
9.3 main    5432 online postgres /data/sql-cluster /var/log/postgresql/postgresql-9.3-main.log
Then install maas again:
sudo apt-get install maas

FIX2:
The default sql cluster is not created because the LC_ALL not configured.
command line - How do I fix my locale issue? - Ask Ubuntu
http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue

  1. At you ssh client, do not forward your locale to remote server by editing /etc/ssh/ssh_config and comment out SendEnv LANG LC_* line. Or run the following:
    sed -e '/SendEnv/ s/^#*/#/' -i /etc/ssh/ssh_config
  2. Connect to remote server, and:
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
  3. Then log-out and log-in again, LC_ALL should be there.
    # printenv | grep LC
    LC_ALL=en_US.UTF-8
Then if you do "sudo apt-get install postgresql", you should see the default cluster is created.
(........................)

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-9.3 (9.3.14-0ubuntu0.14.04) ...
Creating new cluster 9.3/main ...
  config /etc/postgresql/9.3/main
  data   /var/lib/postgresql/9.3/main
  locale en_US.UTF-8
  port   5432
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * Starting PostgreSQL 9.3 database server                               [ OK ]
Setting up postgresql (9.3+154ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...

$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log
Thus cord-in-a-box.sh won't failed here.