python3

Python Splunk Forwarder

Splunk

This is just a very simple Splunk data forwarder created for POC purposes and to present basic functionality. Some variables have been removed so you need to implement them on your own for this to work. The code includes a simple HTTP post, that uploads the event to a Splunk HEC URL of your choice
The code can also be found on my github

import json

import requests

Simple data visualisation in python

Some easy Python

Using some sample data from a course I'm enrolled in I decided to try my hand creating a visualization model with python. I had some prior experience being enrolled on a machine learning class, but because I feel I'm barely a beginner at this stuff I decided to practice with this data set.

The file I used for the data can be found on my Github.

The data is in a csv file and contains the following columns

Solving the quadratic equasion with python

Python

I started a new python data mining course that started from python basics. Won't be posting the basic stuff here until I get to the more interesting stuff with pandas, numpy, sckit-learn and matpilotlib. Just a fun little way to solve the quadratic function

# Solves the quadratic equasion

def quadSol(a,b,c):

v = (b**2) - (4*a*c)

xplu = -b-(m.sqrt(v))/2*a

xm = (-b+m.sqrt(v))/(2*a)

print("(" + str(xplu)+ " , " + str(xm) + ")")

def main():

a = 1

b = 5

c = 6

Python homework part.3

Pythonlogo

Soooo... I sort of got lost in doing the exercises and completed 15 exercises since the last one. I think I'll just post the more demanding ones so there will be between one to two examples of what I did per subject. I'll include some screenshots again on how the programs functioned. I've only got two subjects left after these ones. I hope I can manage to complete them today. First up is sub-functions.

Python homework part.2

Pythonlogo

 

This time we only had four exercises dealing with the reading, writing in, overwriting and searching documents with python.

I managed to complete all of these quite quickly and only found a challenge in the exercise 3/4 which you can see below. I'll ad some screenshots to these too from here on.

1/4

Read a document called faktat.txt and print what it said.

faktatpy

Python3 programming part 1

Pythonlogo

 

I enrolled in a python3 beginner course and will also be posting some work I've done for the course. I'll skip some of the more basic stuff. Some things written here like certain bits of console output will be in Finnish again due to some course requirements. The VIOPE system that we submit our code in to expects everything to be word for word the same as has been put in it.

Hello World in Python3

 

print("Hei Maailma!")

An old lab-exercise (h7).

Last homework assignment

Our last homework assignment was to select a old lab-exercise. The exercise consisted of creating some users with different authority levels for an imaginary company, creating some metapackages and some other lesser stuff. A link to said exercise can be found below.

I decided to not do this on my own computer and instead used my xubuntu 18.04 LTS live-usb. I made as the first homework assignment for the course.

"Hello World" in three different languages h6

Hello World

The goal of this excersize was to first write Hello World in three different programming languages and after that write a simple program that has some kind of functionality, for example user input = Hello + the name of the current user

Python3

So I Was quite the respectable beginner with python3 and decided to start with that, I already had the necessary tools for python3 on my laptop, but if needed heres how to install python 3