Skip to main content

Posts

Showing posts with the label Python

Lambdas

 A Lambda is an anonymous function. Places like AWS have services set up entirely just to host these simple functions that don't require a ton of code or backend. To run the Python here, I go back to Google Colaboratory; Check out my Lambda book here   Ex. 1   g =  lambda  x:  3 *x +  2 g( 3 )     Simple.  Ex. 2   full_name =  lambda  fn, ln: fn.strip().title() +  " "  + ln.strip().title() full_name( "   Ember" ,  "Serros" )     Notice the spaces in front of the first name (' Ember')      Ex. 3     def   func ( x , y ):    """Does things"""   func2 =  lambda  x: x + y+ 3 print (func( 2 , 7 ))   Using def seems to be hit or miss. This returns None, which technically is correct,  but I'm expecting a number (12). It's missing a return statement;   return  func2(x) +  3       Ex. 4   def   func ( x , y ):   funct2 =  lambda  x: x+y+ 5    return  funct2(x) +  6 print (func( 3 , 78 ))   Works just fine.      E

Building AWS Infrastructure with Python (+ Learning the Code)

Follow along with more DevOps stuff! It's not only CloudFormation and YAML we can use to build infrastructure in AWS - The ever-popular Python is here. I like how the docs say it should take around 6 minutes, and I'm here on maybe...minute 34 waiting for packages to finish installing. I'm sure it doesn't account for setup, but for a while, I was concerned I had misconfigured something. No, there are just a ton of packages to download.   Node.js had to not only open Powershell, but update my chocolatey and some VS Code components. Importing Python packages happens in consoles/terminals . You have to import them each session.  So, I open a terminal in VS Code to install this Pipenv Virtual Environment Package in theory. The hardest part is always installing Python packages, as I never remember what command works in Windows Terminal.  It's never pip install or apt-get, but 'python -m pip install [package], when you are not in the Python prompt. Now, into the cmd

Winning Multiple Data Scholarships

  In April, I was selected - 1 of 1000, out of 10,000 - by the Blacks in Technology Foundation for Python for Data Science. I used SQL to parse and analyze data. Truth - Python isn't my favorite - but I want to learn to tolerate it - I told them this and was still selected. So glad to see an organization accept honesty! In June, the train kept rolling with Intro to Data Science - Granted to me by Women in Cloud, though a partnership with Microsoft. While I didn't make it to the second round of the BiT scholarship, the first part encouraged me to learn more about data and python on my own. It certainly wasn't a waste. If there are any other data scholarships you know of that are open to people out of school, transitioning industries, or just with a curiosity, please let me know - I'm happy to share them!

A look at Google Colaboratory (While Building a Stock Portfolio)

    After the group effort heard 'round the world in 2021, stocks are on everyone's minds. I didn't have money in GameStop, but I did have money in AMC from 2020. I bought it right as most theaters were closing from the Coronavirus pandemic and it was extremely cheap.   Why? I like the moviegoing experience! As of March 6th 2021, many AMC Theaters in New York City and State are reopening at 25% capacity. I'm still holding onto the stock - It never rose as high as GameStop's - but you won't see me at any theaters so soon. Onto today's topic: Google Colaboratory is a cool tool, allowing you to run Python scripts right in the browser.  You can even install things into the environment! Is it a little container environment running my program? 

ipaddress Module in Python

Article Helpful for quickly seeing the broadcast address, number of hosts, if an IP address is link-local or not. I wonder how this can work with SDN. You do have to import it to your version of Python. #of hosts in a range. I wanted to see if it knew to move onto the next octet when over the 255 limit; It's all outlaid in the linked article, not much for me to explain. Just a neat tool I wanted to share (and bookmark). Because, in the real world, your employer doesn't care how you subnet, just that you do.

Sending E-Mail Through Command Line With Python

From "Automate The Boring Stuff With Python", here , and the matching course on Wireshark. Going through the course, I saw 'Email' as an option, and was immediately excited to see how we can send automated emails with Python sans using a fancy SaaS with sparkling GUI.  I'm not going to copy the article listed above verbatim, but talk about things that are new to me.  One of the commands is type([]), which shows us the kind ('type') of argument.  You can put in three things and it makes a new type object; type(brachius, 53, phelonious)  Since this is port 587, we need TLS (Transport Layer Security, symmetric key!) encryption;  I wonder what the b'2.0.0 means. Otherwise, the server is ready. In an era where 2-Factor Authentication is all the rage (For good reason), how will logging into an email account via the command line work with that? I'm getting a 'Bad Credentials' Error message - is it just me? Maybe,

It's a Twitter Bot [ft. Dev Ed][Temp]

Man, and this is a beginner's bot. Imagine what you can do with advanced Python knowledge! What this does - Using Firefox, this bot Automatically like tweets that fit a criteria of words to hopefully make people look at and follow you.

Learn Statistics With Python

I can program in Python, though it doesn't feel as easy to me as JavaScript. SD-WAN is great and indicative of the future. When I found that we could use Python in Statistics - The only math class I genuinely enjoyed - I was over the moon. We start with the basics; mean, median, mode. Then Variance. Histograms. Quar and Quantiles. There's not much for me to put on display here, but to say that I took the course, completed it entirely, enjoyed it, am learning more, and have something to put on a resume. EMPLOYERS : This is me learning a new skill. One class in college I really enjoyed was Statistics. The other was Theater.

Welcome to GitHub

So still on our APIC-EM with Python for Cisco roll, I made a GitHub ! And made a Get-Host-API program that I'm not 100% sure if said code is functional. But you can check it out and read the comments.

REST with SDN

I came across a nifty site - Cisco DevNet , helping developers learn how to work with Software-Defined Networking, and I wanted to jump in feet first. Luckily, the idea is to program in Python.