Default

Python Code Cookbook

2018-07-01. Category & Tags: Default Python, Reuse, Import, Include

See also: LearnPython, the Language Pandas # Get column_nr in pandas/numpy. if isinstance(X, pd.DataFrame): X_is_df = True row_nr = X.shape[0] column_nr = X.shape[1] if isinstance(X.columns, pd.core.index.MultiIndex): df_columns_is_multi_index = True else: df_columns_is_multi_index = False else: # non-DF X_is_df = False row_nr = np.shape(X)[0] column_nr = np.shape(X)[1] use dataframe directly against spark # lib Optimus from optimus import Optimus op = Optimus(master="local") df = op.create.df(<some data>) ... Sourcing/Importing # execfile or os.system # execute the other python file in place: ...

Python Code Reuse

2018-07-01. Category & Tags: Default Python, Reuse, Import, Include

execfile or os.system # execute the other python file in place: execfile("/path/to/my/lib/mylib.py") or: import os os.system("python /path/to/my/lib/mylib.py") import # import sys import os sys.path.append(os.path.abspath("/path/to/my/lib")) import mylib ref # See other methods here.

Steps to Check Netwok Interface Card (NIC) Configurations

2018-06-13. Category & Tags: Default Network, NIC

UBUNTU 20.04 # New command: ip & ss. ubuntu.com check & setup nic in cli # check hardware info (canNOT guarantee it is up?): ethtool -i wlp4s0 config ip & gateway: ip link set dev wlp4s0 up dhclient wlp4s0 ip route add 192.168.50.1 dev wlp4s0 ip route add default via 192.168.50.1 UBUNTU 18.04 dated # Check the physical NIC is connected. lspci Note: The NIC will be shown regardless if drivers are installed, this is a PCI feature. ...

VirtualBox Network and Skills

2018-04-14. Category & Tags: Default VirtualBox, Network

OBS: cloning a VM with the status of pause (not powered-off), it canNOT re-initialize the MAC address. Thus, it is necessary to disconnect the cable and poweroff to re-initialize the MAC and then boot. INSTALL ON UBUNTU # Tested on v18.04. sudo apt-get update && \ sudo apt-get -y install virtualbox (sometimes, maybe need to prepare the env before installation:) sudo apt-get update && \ sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms && \ wget -q https://www. ...

Licenses

2017-07-24. Category & Tags: Default License, Apache, MIT, BSD, GPL, AGPL

授权协议之间的关系 (@Sunny) # 不严格的(商业友好的) # MIT(Massachusetts Institute of Technology)许可:几乎没有限制,可以修改和闭源然后商用,只要程序的开发者在修改后的源代码中保留原作者信息和许可协议即可,因此普遍被商用。 BSD(Berkeley Software Distribution,伯克利软件发行版)许可:≈ MIT + 不得使用原上游开源项目作为自己的广告,也普遍被商业软件所使用。 Apache2 许可证(Apache License)许可协议:≈ BSD + 所有的文件加声明。现在热门的 Apache Hadoop、Apache HTTP Server 等项目都是基于该许可协议研发的。也被商业软件所使用。 Apache2 modified with Common Clauses(Apache2 CC,增加通用条款的 Apache2 许可):≈ Apache2 + 禁止 Service ≈ SSPL,禁止作为服务进行商业使用。 严格的 # GPL(GNU General Public License,GNU 通用公共许可):软件中哪怕只有一点使用/链接(link)了遵循 GPL 协议的产品或代码,分发时就必须也遵循 GPL 许可协议,完全开源、免费(即“强传染性*”),因此这个协议并不适合商用软件。遵循该协议的开源软件数量极其庞大,包括 Linux 系统在内的大多数的开源软件都是基于这个协议的。 注意:GPL 没有禁止商用/收费,但要求开源。GPL 的边界,一般以进程为准,同一个进程内会受到 GPL 传染。 LGPL(Lesser General Public License)许可:≈ GPL-link。修改的文件需要开源,但是调用 GPL 的自己创建的新文件不用开源。 AGPL(Affero-GPL)许可:≈ GPL + 普通用户和服务器端的 AGPL 许可的新软件进行了交互(直接/间接?不清),则新软件需要完全开源。 SSPL(Server Side Public License,服务器端公共许可): ≈ AGPL + 明确但凡服务用到了SSPL 的软件,就必须完全开源或者付费购买商业许可。 How to Choose a License # ref-cn: 一张图弄懂开源协议-GPL、BSD、MIT、Mozilla、Apache 和 LGPL 之间的差别 ( ref-cn-ref) ...

Hadoop HDFS

2017-06-19. Category & Tags: Default Hadoop, HDFS

(updated: tested hadoop 3.1.3 on Ubuntu 1804) Install # sudo mkdir -p /usr/lib/jvm sudo tar -zxvf ./jdk-8u162-x64.tar.gz -C /usr/lib/jv vim ~/.bashrc export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_162 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # new terminal java -version echo $JAVA_HOME sudo tar -zxf hadoop-3.1.3.tar.gz -C /usr/local sudo mv /usr/local/hadoop-3.1.3/ /usr/local/hadoop sudo chown -R hadoop:hadoop /usr/local/hadoop /usr/local/hadoop/bin/hadoop version Config (pseudo-distributed 伪分布式配置) # cd /usr/local/hadoop 注:一旦添加了 core-site.xml 以下配置,则无法进行 stand-alone 单机运行?。 gedit ./etc/hadoop/core-site.xml <configuration> <property> <name>hadoop.tmp.dir</name> <value>file:/usr/local/hadoop/tmp</value> <description>Abase for other temporary directories. ...

DHCP

2017-05-16. Category & Tags: Default DHCP, DHCP Server, DHCPD

Install & Basic Config # install # sudo apt-get install isc-dhcp-server interfaces # vi /etc/default/isc-dhcp-server INTERFACES="eth0 eth1 eth2" config network param # vi /etc/dhcp/dhcpd.conf # ns servers separated by comma "," ! ! ! option domain-name-servers 10.0.0.1, 10.0.0.2; # lease time in sec: -1 for infinity. default-lease-time -1; max-lease-time -1; # a very basic subnet declaration: subnet 10.0.0.0 netmask 255.255.255.0 { interface enp0s3; # optional range 10.0.0.150 10.0.0.254; # separated by space " " option routers 10. ...

Moving Blog

2016-05-04. Category & Tags: Default Default

Firstly, address changed: DMML.nu Secondly, reason. I thought high price lead to good service, but I was wrong: Four days host failure, and I lost all files. Fortunately, I have backups. Besides, wordpress is too heavy, I need a light weighted platform.

g+ digest 更新 2013/07/05

2013-07-05. Category & Tags: Default Default, Music

[04.07.2013 21:19 (fr. gplus)] [![](https://lh5.googleusercontent.com/proxy/tygbzAPl0Eb07JWuIU15RL63UlG-MAHAFXEDIkCc3nJhXNCmBFRR-d2opHL7KRlb2seb7dNdVwfPmmjve3S4=w125-h125)<p class='attachment_article_content'>Wiktionary RDF extraction. Currently available languages: English, German, French, Russian In the works: Greece, Vietnamese Need data from other languages? Help us creating wrappers for each language editions (if you know Regex, XML and Wiktionary, an initial wrapper can be created in less than ... ](http://wiki.dbpedia.org/Wiktionary?show_files=1) Digest powered by RSS Digest