Tags » Python

First website project for FreeCodeCamp & Python.

I finished the website that I made for the first assignment on FCC, I still need to have it tested to see if it passes but I am pretty sure I hit all the points that it wanted  me to include. 227 more words

#List[ ] in Python


#Sequential, ordered, mutable(can update/change).
# [ ], values/item, represented comma separated
#max… 31 more words

Python - Performance Tuning with Nvidia

Step 1:
Read this first

Step 2: Install NVidia in Mac

>brew tap caskroom/drivers
>brew cask install nvidia-cuda

Then you also need to add the following to your file ~/.bash_profile: 185 more words


Port Scanner

Another simple port scanner written in Python, for testing. Implements threading.

import threading
import socket

target = ''
target = 'pythonprogramming.net'
#ip = socket.gethostbyname(target)

def portscan(port):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        con = s.connect((target,port))
        print('Port :',port,"is open.")
r = 1 
for x in range(1,100): 
    t = threading.Thread(target=portscan,kwargs={'port':r}) 
    r += 1     

$ ./a.py 
('Port :', 22, 'is open.')
('Port :', 80, 'is open.')

Pattern Matching

Test pattern matching using Python

import re

filepath = 'data.txt' 
prog = re.compile('+(?:\.+){3}:+')

with open(filepath) as fp: 
  line = fp.readline()
  cnt = 1
  while line:
    print("Line {}: {}".format(cnt, line.strip()))
    line = fp.readline()
    if prog.match(line):
      print 'matched'
      print 'not matched'
    cnt += 1

$ cat data.txt

$ ./b.py
Line 1:
Line 2:
not matched

Automation: Pythonista, Reports, and Graphs

I had a bit of free time this evening and tried my hand at reporting on iOS using Pythonista. I had heard from various blog posts about the idea of using a Python script to massage and process data in a way that would be easier than the lower-code options of… 451 more words


Data Analysis & Interpretation 2.2

Week 2

Run a Chi-Square Test of Independence. The null hypothesis is that the relative proportions of one variable are independent of the second variable; in other words, the proportions of one variable are the same for different values of the second variable. 305 more words

Data Analytics