Powershell Upload Files to AWS S3

s3

Link to github for a better code reading experience GITHUB

This one writes files to AWS S3. Takes some input parameters. The variable $bucketName, can also be configured as an external parameter, our S3, only has a single bucket for these files, and they get stored under different keys, so this hard coded solution works better for us. The time parameters are only so files, that get corrected the next day get uploaded as yesterdays files to improve idempotency in our use case.

Powershell Write File To UTF-8

powershell

Just a simple program that re-writes files in a folder to UTF-8. A production server I work on had an old version of Powershell running on it and a file needed to be in UTF-8 for it to be read by a Golang-script, so this was created.

This can be run from the terminal by calling the script and passing the logPath and pathToFiles parameters to the Script.

Doesn't write a BOM (Byte Order Mark) on the file, due to the Golang Script reading the file.

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

Breakout

As my final project on my Spring Boot / Full Stack-course, I decided to create a game of breakout. Link to game provided below as well as a link to the git-page with all the source code for the application. The game uses the internal, temporary h2 database, due to personal time constraints.

https://herokuapp.pongproject.com

https://github.com/JoonasPit/course

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

Convert .doc files to .txt using Windows Powershell

This simple script converts Microsoft Word .doc files to .txt files for my txt/log file scan through script to sift through. 

 

Code available in better format @ https://github.com/JoonasPit/powershellstuff/blob/master/wordtotxt.ps1

# Run through all doc-type files in a folder and convert them in to .txt-files

 

function wordConversion{

 

# Specify location

$location = Get-Location

# Get all doc-files

Powershell text search tool

Text search tool in Powershell

Wrote a quick search tool for Windows that uses some cmdlets from Powershell to search through txt-files,finds certain key words and writes them in a easily readable format inside a potentially user defined outfile. (github)

The tool ask for the file being searched for and the word that the user wants to search these files for.

 

 

A game of snake

snäke

A game of snake

As the last assignment of our java-course we had to create any kind of java based project that used a servlet based web-programming structure. The project had to include a database connection and a full create, read, update and delete that creates a table off the stored data in the database. 

Java homework part 5.

kuppi

Been a while since my last post. Some of my homework has been really simple so I didn't find them post worthy but the previous week we dove into exceptions and maps/hashmaps.

I found exception handling to be extremely interesting and probably really valuable information when it comes to my future with coding. the program I will be going through below is the the last exercise of 4 utilizing both hashmaps and exception handling.