Working with NumPy
pandas provides DataFrames and tools for working with tabular data. But once the need for labels and column names is removed, there are tools which can offer better support - such as NumPy. We’ll highlight how to work with arrays from NumPy, and show off where NumPy arrays are the appropriate tool for the job.
#numpy #microsoftdeveloper #learntocode
cluster-ssh-tools - a collection of cluster ssh tools
I often work on clusters of machines where I need to do the same operation to many hosts at the same time. I started out with regular shell loops:
for i in `seq -f '%02g' 1 20` do ssh root@hostname$i.dc.domain.com reboot done
This worked fine for about half a day. Then I looked at DSH and simlar tools available and easy to find in 2007. Over the course of time I built up cl-run.pl and a couple copies like cl-rsync.pl and cl-psgrep.pl. It didn't take long and I split all the common bits out to a module and made it a bit more generic. Then the rest of the tools were pretty trivial to throw together as I needed them.
That's all to say, these tools work well for me but are not good examples of perl coding nor are they good for everybody.
I've had good luck using most of these tools on 300+ hosts at a time from a bastion host with 8G of RAM and plenty of available CPU cycles. Currently I run these all the time from a smallish Linux VM (2G RAM, 2 vcpus), my workstation, and my Macbook Air and haven't ever had a problem with performance.
cl-run.pl # run a command or script cl-rsync.pl # parallel rsync cl-sendfile.pl # push a file out cl-gatherfile.pl # pull a file in (sorted by hostname) cl-ping.pl # ping hosts cl-killall.pl # kill a process on hosts with a regular expression cl-psgrep.pl # look for processes across the cluster cl-netstat.pl # a distributed network I/O display nssh.rb # ssh wrapper that sets screen title & other things
$> cat > ~/.dsh/machines.nosqldb-dev <<EOF nosqldb-dev12.tobert.org nosqldb-dev11.tobert.org nosqldb-dev10.tobert.org nosqldb-dev9.tobert.org nosqldb-dev8.tobert.org nosqldb-dev7.tobert.org nosqldb-dev6.tobert.org nosqldb-dev5.tobert.org nosqldb-dev4.tobert.org nosqldb-dev3.tobert.org nosqldb-dev2.tobert.org nosqldb-dev1.tobert.org EOF # set default list to save typing, I generally do not use this $> ln -sf ~/.dsh/machines.nosqldb-dev ~/.dsh/machines.list # set up a user account (cheezy example, assumes user@localhost has root@remotehost keys set up) $> cl-run.pl --root -c "useradd -m tobert" $> cl-rsync.pl --root -l ~/.ssh -r /home/tobert $> cl-run.pl --root -c "chown -R tobert /home/tobert" $> cl-run.pl --root -c "(grep -q '^tobert' /etc/sudoers) || echo 'tobert ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" $> cl-run.pl --list nosqldb-dev.pl -c "uname -a" nosqldb-dev12.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev1.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev11.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev5.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev2.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev4.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #36-Ubuntu SMP Fri Jul 8 18:12:30 UTC 2011 x86_64 GNU/Linux nosqldb-dev6.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #36-Ubuntu SMP Fri Jul 8 18:12:30 UTC 2011 x86_64 GNU/Linux nosqldb-dev10.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev3.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #36-Ubuntu SMP Fri Jul 8 18:12:30 UTC 2011 x86_64 GNU/Linux nosqldb-dev8.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev9.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux nosqldb-dev7.tobert.org: Linux ip-xx-xx-xx-xx 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux $> cl-run.pl -c "sudo nohup dd if=/dev/zero of=/dev/null bs=1M &" $> cl-netstat.pl --list nosqldb-dev --device md3 hostname: eth0_total eth0_recv eth0_send read_iops write_iops 1min 5min 15min -------------------------------------------------------------------------------------------------------------- nosqldb-dev12: 864 121 743 0/s 0/s 0.00 0.00 0.00 nosqldb-dev11: 864 121 743 0/s 0/s 0.00 0.00 0.00 nosqldb-dev10: 846 121 725 0/s 0/s 0.00 0.00 0.00 nosqldb-dev9: 840 128 712 0/s 111,608/s 1.00 1.01 1.00 nosqldb-dev8: 827 117 710 0/s 120,828/s 1.04 1.03 1.00 nosqldb-dev7: 999 175 824 0/s 93,479/s 1.02 1.03 1.00 nosqldb-dev6: 1,674 201 1,473 0/s 0/s 0.00 0.00 0.00 nosqldb-dev5: 947 136 811 0/s 0/s 0.00 0.00 0.00 nosqldb-dev4: 1,674 201 1,473 0/s 0/s 0.00 0.00 0.00 nosqldb-dev3: 961 136 825 0/s 0/s 0.00 0.00 0.00 nosqldb-dev2: 961 136 825 0/s 0/s 0.00 0.00 0.00 nosqldb-dev1: 967 136 831 0/s 0/s 0.00 0.00 0.00 Total: 12,424 Recv: 1,729 Send: 10,695 (0 mbit/s) | 0 read/s 325,915 write/s Average: 12,828 Recv: 151 Send: 917 (0 mbit/s) | 0 read/s 129,660 write/s
nssh.rb does a few nice things around sshing inside GNU screen. In the original version, all it did was set the screen title automatically by grabbing the hostname off the args. Now it does quite a bit more, including letting you create a bunch of new named sessions in screen without a lot of typing.
It also tries to flip CNAME's to A names automatically while still setting your screen title to the CNAME. This can be pretty handy when working with lots of EC2 hosts where you may not necessarily have set up all the CNAME's in ~/.ssh/config.
By default, GNU screen has MAXWIN at 40. I almost always run a rebuilt version from the git head with MAXWIN 512.
$> nssh.rb hostname.tobert.org # in screen, ctrl-a c, then $> nssh.rb reset $> nssh.rb next --list nosqldb-dev # ctrl-a c $> nssh.rb next --list nosqldb-dev # ctrl-a c # etc. ...
And finally, the latest incarnation of my screenrc generation script is included. At the moment, I hard-code a list of clusters I want to connect to at screen startup so I can do something like the following after reboots:
$> ssh-add $> generate-screen-config.rb $> screen -c ~/.screenrc-main -S main -T xterm-color -U
This repo includes .screenrc-main based on what I use all the time.
Base perl with Tie::IxHash for most of the tools. cl-netstat.pl requires Net::SSH2 built against a fairly modern libssh2. The ruby utils are probably fine with a base system ruby 1.8 or 1.9.
SSH agent support requires Net::SSH2 >= 0.40.
I usually symlink all these files into ~/bin, which my ~/.profile sets to be in my PATH.
$> mkdir ~/bin ~/src $> cd ~/src $> git clone https://github.com/tobert/perl-ssh-tools.git $> ln -s ~/src/perl-ssh-tools/* ~/bin/ $> export PATH=~/bin:$PATH
You'll need libssh2 and the perl modules. If you're using Macports:
$> sudo port install perl $> sudo port install libssh2 $> sudo /opt/local/bin/perl -MCPAN -e 'install Net::SSH2' $> sudo /opt/local/bin/perl -MCPAN -e 'install Tie::IxHash'
The docs for common options are in DshPerlHostLoop.pm.
All of the utilities have their own POD and use Pod::Usage.
Al Tobey <email@example.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2007-2013 by Al Tobey.
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. (Note that, unlike the Artistic License 1.0, version 2.0 is GPL compatible by itself, hence there is no benefit to having an Artistic 2.0 / GPL disjunction.) See the file LICENSE for details.
Source Code: https://github.com/tobert/perl-ssh-tools
At the end of 2019, Python is one of the fastest-growing programming languages. More than 10% of developers have opted for Python development.
In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.
Table of Contents hide
The Size and declared value and its sequence of the object can able to be modified called mutable objects.
Mutable Data Types are list, dict, set, byte array
The Size and declared value and its sequence of the object can able to be modified.
Immutable data types are int, float, complex, String, tuples, bytes, and frozen sets.
id() and type() is used to know the Identity and data type of the object
a**=str(“Hello python world”)****#str**
Numbers are stored in numeric Types. when a number is assigned to a variable, Python creates Number objects.
Python supports 3 types of numeric data.
int (signed integers like 20, 2, 225, etc.)
float (float is used to store floating-point numbers like 9.8, 3.1444, 89.52, etc.)
complex (complex numbers like 8.94j, 4.0 + 7.3j, etc.)
A complex number contains an ordered pair, i.e., a + ib where a and b denote the real and imaginary parts respectively).
The string can be represented as the sequence of characters in the quotation marks. In python, to define strings we can use single, double, or triple quotes.
# String Handling
#single (') Quoted String
# Double (") Quoted String
# triple (‘’') (“”") Quoted String
In python, string handling is a straightforward task, and python provides various built-in functions and operators for representing strings.
The operator “+” is used to concatenate strings and “*” is used to repeat the string.
'Output : Python python ’
#python web development #data types in python #list of all python data types #python data types #python datatypes #python types #python variable type
If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.
If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.
In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.
#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition
What exactly is Big Data? Big Data is nothing but large and complex data sets, which can be both structured and unstructured. Its concept encompasses the infrastructures, technologies, and Big Data Tools created to manage this large amount of information.
To fulfill the need to achieve high-performance, Big Data Analytics tools play a vital role. Further, various Big Data tools and frameworks are responsible for retrieving meaningful information from a huge set of data.
The most important as well as popular Big Data Analytics Open Source Tools which are used in 2020 are as follows:
#big data engineering #top 10 big data tools for data management and analytics #big data tools for data management and analytics #tools for data management #analytics #top big data tools for data management and analytics
Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.
Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is
Syntax: x = lambda arguments : expression
Now i will show you some python lambda function examples:
#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map