You can use the DataFrame's randomSplit function
split dataframe
You can use the DataFrame's randomSplit function
split dataframe
git diff-tree -p COMMIT
command to show code change in given commit
git show COMMIT --compact-summary
command to show code change in given commit
git diff <root_commit>^!
command to show code change of one commit: git diff <root_commit>^ git diff <root_commit>^!
The Tank Man
Tiananmen Event
Spark properties mainly can be divided into two kinds: one is related to deploy, like “spark.driver.memory”, “spark.executor.instances”, this kind of properties may not be affected when setting programmatically through SparkConf in runtime, or the behavior is depending on which cluster manager and deploy mode you choose, so it would be suggested to set through configuration file or spark-submit command line options; another is mainly related to Spark runtime control, like “spark.task.maxFailures”, this kind of properties can be set in either way.
spark properties
__init__.py is required to import the directory as a package, and should be empty.
to import the directory as a package
job.local.dir
to save data by spark
list(word_freq.items())
create list with dict.items()
{k: v for k, v in sorted(x.items(), key=lambda item: item[1])}
the best way to sort dict in python
for c in ax.containers: # set the bar label ax.bar_label(c, fmt='%.0f', label_type='edge', padding=1)
Add bar label for multiple sub-bars
profit_color = [{p<0: 'red', 0<=p<=2: 'orange', p>2: 'green'}[True] for p in profit]
color bar based on value
How to Change Colors on LS in Bash
How to set LS_COLORS
jupyter nbconvert --to FORMAT notebook.ipynb
convert jupyter notebook to other format by command
To create a new theme, copy an existing theme file to a new name in the same directory, reload Notepad++, and use the Style Configurator to edit the color and font settings (or edit the XML file directly, and reload).
To create notepad++ theme
You can close the single quotes before starting the double quotes and do the reverse at the end of that inner section to achieve what you want:
This is how to use variable in single quotes. It works well also for tcsh.
The result from the above request includes a _scroll_id, which should be passed to the scroll API in order to retrieve the next batch of results.
This is the way to use scroll.
Use with caution!
Using regular expression in this way might cause "Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]", especially when together with "query?scroll=1m"
To create a UI theme, do the following:
create atom theme
type
this is the way to check if command is available or not in bash
GIT_INDEX_FILE is the path to the index file (non-bare repositories only).
export GIT_INDEX_FILE=".git/index.linux" if you are working on Linux
export GIT_INDEX_FILE=".git/index.windows" if you are working on Linux
What worked for me was to use the following command to send the VT320 "unhide" command sequence:
unhide the cursor in terminal
To change your prefix from C-b to C-a, simply add following lines to your tmux.conf:
The NFS version 3 protocol is designed to allow servers to be as simple and general as possible. Sometimes the simplicity of the server can be a problem, if the client implements complicated file system semantics. For example, some operating systems allow removal of open files. A process can open a file and, while it is open, remove it from the directory. The file can be read and Callaghan, el al Informational [Page 96] RFC 1813 NFS Version 3 Protocol June 1995 written as long as the process keeps it open, even though the file has no name in the file system. It is impossible for a stateless server to implement these semantics. The client can do some tricks such as renaming the file on remove (to a hidden name), and only physically deleting it on close. The NFS version 3 protocol provides sufficient functionality to implement most file system semantics on a client.
Öppettider & Hitta HIT
Chris Hoffman is Editor-in-Chief of How-To Geek. He oversees all How-To Geek's content to ensure it's as accurate and in-depth as possible. Since 2011, Chris has personally written over 2,000 articles that have been read nearly one billion times---and that's just here at How-To Geek.
A Good Editor had many helpful articles.
The tree obtained is the logical structure of the program, which is then converted to bytecode (.pyc or .pyo).
Python is often used as the programming language for many small-form devices, such as the Raspberry Pi and other microcontrollers
The Python programming language was created by Guido Von Rossum in 1991 and started with a previous language called ABC.
Here is a list of some open data available online. You can find a more complete list and details of the open data available online in Appendix B.
DataHub (http://datahub.io/dataset)
World Health Organization (http://www.who.int/research/en/)
European Union Open Data Portal (http://open-data.europa.eu/en/data/)
Amazon Web Service public datasets (http://aws.amazon.com/datasets)
Facebook Graph (http://developers.facebook.com/docs/graph-api)
Healthdata.gov (http://www.healthdata.gov)
Google Trends (http://www.google.com/trends/explore)
Google Finance (https://www.google.com/finance)
Google Books Ngrams (http://storage.googleapis.com/books/ngrams/books/datasetsv2.html)
Machine Learning Repository (http://archive.ics.uci.edu/ml/)
As an idea of open data sources available online, you can look at the LOD cloud diagram (http://lod-cloud.net ), which displays the connections of the data link among several open data sources currently available on the network (see Figure 1-3).
If this time is very small (say less than 0.2 seconds), it is probably very inaccurate, and it may be better to run your code many times to get a more accurate time. For this, you can use timeit (https://docs.python.org/3/library/timeit.html).
After you work with scikit-learn, you may take your AI programming using Python to the next level and explore k-means clustering.
Flertusenårig historia
This shift is largely due to technology: The average American child is said to spend 4 to 7 minutes a day in unstructured play outdoors, and over 7 hours a day in front of a screen.
"7 hours" is much longer than the time which my son spent in front of screen.
It is crucial to ensure that your child develops, maintains, and enjoys other, non-screentime activities.
To have other interests is important for child.
chrome://extensions/shortcuts
This is how to customize shortcut keys of Google chrome extensions.
echo -e "\e[2 q"
This is the workaround to disable blink cursor in windows terminal
To meet this goal, the path validation process verifies, among other things, that a prospective certification path (a sequence of n certificates) satisfies the following conditions
how to validate certificate by trust anchor
Trust Anchor
definition of trust anchor, trust anchor manager, and trust anchor store.
The vendor assigns this form of DUID to the device.
How to assign?
Clients listen for DHCP messages on UDP port 546. Servers and relay agents listen for DHCP messages on UDP port 547.
DHCPv6 Server and Client Ports.
Enable IPv6 support
How to enable IPv6 for Docker
M = 0, O = 1 : Client gets stateless address from RA. DHCPv6 only assign other configuration settings to client. This combination is known as DHCPv6 stateless.
DHCPv6 stateless
When a router sends an RA with ‘O’ bit set, but does not set the ‘M’ bit, the client can do Stateless Address Autoconfiguration (SLAAC) to obtain its IPv6 address, and use DHCPv6 for obtaining additional information. (An example of additional information is DNS). This mechanism is well known as Stateless DHCPv6, because the DHCPv6 server does not need to keep track of the client address bindings.
Explained how SLAAC works.
DHCPv6 M-bit and O-bit
Currently there are two option spaces defined for the DHCPv4 daemon: “dhcp4” (for the top-level DHCPv4 options) and “vendor-encapsulated-options-space”, which is empty by default but in which options can be defined.
How about the option spaces for DHCPv6?
Jsonc is a simplified json format which allows comments and unquoted values delimited by whitespace. A jsonc formatted file can be transformed to a json file. Comments will be stripped out and quotes added.
Good definition of jsonc file.
local physical subnet
how does the client know this "local physical subnet"?
DHCP messages from a client to a server are sent to the 'DHCP server' port (67), and DHCP messages from a server to a client are sent to the 'DHCP client' port (68).
DHCPv4 Ports of Server and Client
GRUB hidden menu change FAQ
details about grub menu hidden and how to enable, access, etc
The GRUB 2 configuration file, grub.cfg, is generated during installation, or by invoking the /usr/sbin/grub2-mkconfig utility, and is automatically updated by grubby each time a new kernel is installed. When regenerated manually using grub2-mkconfig, the file is generated according to the template files located in /etc/grub.d/, and custom settings in the /etc/default/grub file. Edits of grub.cfg will be lost any time grub2-mkconfig is used to regenerate the file, so care must be taken to reflect any manual changes in /etc/default/grub as well.
Explained how grub.cfg file is generated and the relationship to /etc/default/grub and /etc/grub.d
rhgb
Here is the explanation for rhgb: https://web.archive.org/web/20110710233351/http://dailypackage.fedorabook.com/index.php?%2Farchives%2F65-Wednesday-Why-rhgb-Graphical-Boot-Screen.html
The Discoverable Partitions Specification
To read this article
dhcpdump -i eth0
To try this command
tcpdump -i [interface id] -nev udp port 68
tcpdump command to capture packets for dhcp client requests.
pacman --noconfirm -S grub-bios
This command seems mandatory to run.
The x86 "PC" version GNU GRUB 2 has a vbeinfo command for printing out available video modes and vbetest for trying a specific mode. They use a built-in table instead of Funcion 01h. For other platforms, including x86 EFI, they are replaced by the more generic videoinfo and videotest.
The commands vbeinfo and videoinfo can be used to print all supported resolutions. To exit vbetest or videotest in grub, need to send "ctrl+alt+delete" to go back to grub menu list.
When creating a BIOS Boot Partition on a GPT system, you should make sure that it is at least 31 KiB in size.
This is important. If not set this, the OS won't be detected when grub is used with GPT system.
(I started from scratch, and here is everything I ran)
Helpful to fix the problem "No bootable medium found"
The Master Boot Record (MBR) is a small, dedicated section at the beginning of the hard disk which holds the boot information and partition layout for the whole disk. The MBR itself is only a single physical sector in length (512 bytes), but it is required in order to create or maintain partitions on the disk, or even boot the computer.
MBR is very important for OS on disk.
Changing Target Environment at Boot Time
Good to try!
You will need to change BOOTPROTO from dhcp to static and add IPADDR, NETMASK, BROADCAST and NETWORK variables.
To try this to make fedora in virtualbox be accessible from host
local physical subnet
how is this physical subnet is defined or decided? for example, my docker container inet address of eth0 is 172.17.0.2. How 172.17.0 is defined?
Using Kea #1 - DHCP Fundamentals - Carsten Strotmann
This series is very helpful to understand Kea and DHCP.
It is a compile-time error if an enum declaration has the modifier abstract orfinal.
enum is implicitly static and final, no reason to have modifiers final and abstract.
Table 4.1-A. class file format major versions
This is very helpful for troubleshooting
Get-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Good!
This means that the request had pass to the external network but did not come back...
Good to know to check if it works well on proxy in this way: Run below command in one terminal: sudo tcpdump -n -i en0 host 8.8.8.8
And run below command in another terminal: dig @8.8.8.8 www.google.com
To limit the output to only the packages listed on the command line, set the APT::Cache::GivenOnly option.
It works! https://wenijinew.medium.com/debian-package-dependency-in-graph-2472b05ff8b7
After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
The key point is "from the first one that exists and is readable". It won't read and execute all of them but only the first one.
Uninstall old versions
Not necessary to uninstall. Check in advance.
keyword.kwlist
This is to show all keywords in Python
Those thoughts should beseparated from each other with blank lines.
Only use blank lines to separate different thoughts. Don't use it everywhere arbitrarily. Especially, don't use it for every line code.