Skip to content

Instantly share code, notes, and snippets.

View mihaichris's full-sized avatar
🤓
Working !

Mihai Fagadau mihaichris

🤓
Working !
View GitHub Profile
@mihaichris
mihaichris / CharacterSearch.java
Last active January 20, 2023 19:14
An example of a Java program that uses a while loop to check if a character is in a string of no more than 20 characters, and allows the user to continue searching for other characters or finish the process. The class is tested using two functional testing techniques: Equivalence Partitioning, Boundary Value Analysis and Category Partition.
View CharacterSearch.java
import java.util.Scanner;
public class CharacterSearch {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String inputString;
char searchChar;
String searchAgain = "y";
@mihaichris
mihaichris / SignChecker.java
Created January 14, 2023 09:47
A simple Java function that uses equivalence partitioning to test a function that takes an integer input and checks if it's positive, negative or zero.
View SignChecker.java
import org.junit.Test;
import static org.junit.Assert.*;
public class SignChecker {
public String checkSign(int num) {
if (num > 0) {
return "Positive";
} else if (num < 0) {
return "Negative";
@mihaichris
mihaichris / CoffeeMachine.scala
Created January 1, 2023 22:01
Example of supervisor actor in Scala
View CoffeeMachine.scala
import actor.CappuccinoActor.{Cappuccino, CappuccinoActor, CappuccinoInit, CappuccinoMsg}
import actor.TeaActor.{Tea, TeaActor, TeaInit, TeaMsg}
import actor.UserInteractionActor.{AskAgainForBeverage, UserInteractionActor}
import akka.actor.{Actor, ActorSystem, Props}
import exception.ExceptionProcessingOrder
object CoffeeMachine extends App {
val system = ActorSystem("CoffeeMachineSupervisor")
val coffeeMachine = system.actorOf(Props(new CoffeeMachine()), "CoffeeMachineSupervisor")
@mihaichris
mihaichris / atelier-toolbox.json
Created November 27, 2022 15:21
Atelier toolbox Scoop manifest
View atelier-toolbox.json
{
"version": "0.3.2",
"license": "MIT",
"description": "Tools for various automations 🧰",
"homepage": "https://github.com/mihaichris/atelier-toolbox",
"url": "https://github.com/mihaichris/atelier-toolbox/releases/download/v0.3.2/atelier-toolbox_0.3.2_windows_amd64.zip",
"hash": "ae01ec165f11d3064e0fdfab02b8759d5bb72427f3dd21d25f5615ac7a5a0e0b",
"bin": "toolbox.exe",
"checkver": {
"github": "https://github.com/mihaichris/atelier-toolbox"
@mihaichris
mihaichris / Dockerfile
Created October 23, 2022 06:42
Example of Poetry setup in Dockerfile
View Dockerfile
FROM python:3.10.8-bullseye
ARG USERNAME=beaver
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
@mihaichris
mihaichris / opensearch_operations_sample.py
Last active October 1, 2022 13:15
This file is designed to capture a few useful commands to do actions with the OpenSearch engine.
View opensearch_operations_sample.py
from opensearchpy import OpenSearch
host = 'localhost'
port = 9200
auth = ('admin', 'admin') # For testing only. Don't store credentials in code.
# Create the client with SSL/TLS enabled, but hostname and certificate verification disabled.
client = OpenSearch(
hosts=[{'host': host, 'port': port}],
http_compress=True, # enables gzip compression for request bodies
@mihaichris
mihaichris / params.txt
Last active August 2, 2022 11:50
Apache OpenNLP Training Params file
View params.txt
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@mihaichris
mihaichris / blockchain.py
Created July 30, 2022 10:16
Blockchain Node in Python
View blockchain.py
# Blockchain Pandora
'''
Listare API Pandora
User:
http://127.0.0.1:port/user/set_receiver -> Seteaza un nou utilizator al acestei retelei.
Block:
http://127.0.0.1:port/block/mine_block -> Mineaza un block nou pe care il adauga la retea.
@mihaichris
mihaichris / hello.php
Last active January 7, 2023 12:31
Pest Unit Test
View hello.php
<?php
namespace GoodDay;
use Greetings\HelloWordService;
beforeEach(function () {
$this->helloService = new HelloWordService();
});
it('should say Hello World!', function () {