Skip to content

Instantly share code, notes, and snippets.

View markusrenepae's full-sized avatar

Markus Rene Pae markusrenepae

View GitHub Profile
@markusrenepae
markusrenepae / Client.java
Created April 1, 2017 00:02
Server_project
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
/**
* Created by Markus on 01/04/2017.
*/
public class Client {
public static void main(String[] args) throws IOException {
package CRS;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Objects;
@markusrenepae
markusrenepae / scores.py
Created December 28, 2019 16:31
This gist is for my Medium article and is about using linear regression in scoring systems.
import numpy as np
import matplotlib.pyplot as plt
def average(lst):
return sum(lst) / len(lst)
def findss(lst):
# finds the sum of squares
ss = 0
@markusrenepae
markusrenepae / gifcreator.py
Last active December 29, 2019 21:48
This gist is for my medium article about creating GIF images.
import imageio
import os
import matplotlib.pyplot as plt
lst1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
lst2 = [5, 4, 3, 5, 6, 5, 8, 7, 8, 10, 5, 6]
lst3 = [9, 6, 6, 7, 6, 4, 6, 9, 11, 8, 7, 4]
def createfiles():
@markusrenepae
markusrenepae / symbols.txt
Created December 31, 2019 00:33
List of symbols for medium article
MSFT
AAPL
AMZN
FB
JPM
GOOGL
GOOG
JNJ
V
PG
@markusrenepae
markusrenepae / correlation.py
Created December 31, 2019 01:07
Code for medium correlation article.
import pandas as pd
stocks = []
f = open("symbols.txt", "r")
for line in f:
stocks.append(line.strip())
f.close()
volumes = pd.read_csv("volume.csv")
@markusrenepae
markusrenepae / simulator.py
Created January 2, 2020 22:22
This gist is for another medium article and is about an investment simulator.
import pandas as pd
import numpy as np
import datetime as dt
import math
import warnings
warnings.filterwarnings("ignore")
prices = pd.read_csv("adjclose.csv", index_col="Date", parse_dates=True)
volumechanges = pd.read_csv("volume.csv", index_col="Date", parse_dates=True).pct_change()*100
@markusrenepae
markusrenepae / sudoku.py
Last active September 4, 2020 18:24
This is a sudoku-solving code snippet. Used for my Medium article.
import pyautogui as pag
import time
import copy
sudoku = [[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
@markusrenepae
markusrenepae / mc.py
Created January 16, 2020 22:55
This gist is for MC simulation, at least the basics of it. Usage: Medium article
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import matplotlib.pyplot as plt
from scipy.stats import norm
ticker = 'BA'
data = pd.DataFrame()
data[ticker] = wb.DataReader(ticker, data_source='yahoo', start='2015-1-1')['Adj Close']
plt.figure(figsize=(10,6))
@markusrenepae
markusrenepae / numpy1.py
Created January 18, 2020 00:26
First code snippet for Medium article about Numpy
import numpy as np
import time
length = 10
native_lst = [i for i in range(length)]
numpy_lst = np.array(native_lst)