Skip to content

Instantly share code, notes, and snippets.

View sallos-cyber's full-sized avatar

Dr. I. Markelic sallos-cyber

View GitHub Profile
@sallos-cyber
sallos-cyber / anwers_to_programming_questions_markelic.ipynb
Created March 6, 2024 16:32
Answers to programming questions "probabl"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sallos-cyber
sallos-cyber / Beta_Using_Uniforms.ipynb
Created June 21, 2023 08:50
Create a random variable with a Beta distribution using only draws from the Uniform distribution
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sallos-cyber
sallos-cyber / pyspark_streaming_from_and_to_file.py
Created April 8, 2022 08:40
Pyspark streaming from and to file
from pyspark.sql.functions import explode
from pyspark.sql.functions import split
from pyspark.streaming import StreamingContext
from pyspark.sql import SparkSession
import time
spark = SparkSession.builder \
.appName('Streaming') \
.getOrCreate()
@sallos-cyber
sallos-cyber / server.js
Created March 20, 2022 14:40
to use node.js as http server
const express = require('express')
const path = require('path')
const httpPort = 1026
const app = express()
app.use(express.static(path.join(__dirname, './')))
app.get('/', function(req, res) {
def callPreprocessData(fn='/home/someusr/Downloads/flows.csv'):
data=pd.read_csv(fn)
print(data.head(3))
data['Bytes']=data['Bytes'].fillna(0)
data['Bytes']=data['Bytes'].astype(str)
#silly nfdump writes bytes as integer but sometimes it converts it to
#mb. The following finds those entries and converts them into bytes.
data.loc[data['Bytes'].str.contains('M'),'Bytes'] = data[data['Bytes'].str.contains('M')]['Bytes'].apply(lambda x: float(x[1:-2])*1024*1024)
data['Bytes']=data['Bytes'].astype(int)
@sallos-cyber
sallos-cyber / pointers_program.c
Created February 19, 2022 14:45
Pointer and reference in C
/**
* C program to explain address, pointer, reference, and dereference
* You can compile this with
* 'g++ pointers_program.c -o pointers' and then call it by typing
* './pointers' in your shell.
*/
#include <stdio.h>
int main()