Skip to content

Instantly share code, notes, and snippets.

View slavaceornea's full-sized avatar

Slava Ceornea slavaceornea

  • Stockholm, Sweden
View GitHub Profile
@slavaceornea
slavaceornea / Clear_bin_and_obj_Folders.bat
Last active June 2, 2016 10:57
Batch script to clear out all obj and bin folders
FOR /F "tokens=" %G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q "%G"
FOR /F "tokens=" %G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%G"
@slavaceornea
slavaceornea / gitCleanSubfolders.bat
Last active June 2, 2016 10:59
This git command cleans all project subfolders so that it re-builds properly.
git clean -x -f -d
@slavaceornea
slavaceornea / CreateExport_SelfSignedCertificate.ps1
Last active June 2, 2016 11:06
Powershell script creates and exports self-signed certificate as .pfx file.
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname selfsignedcertificate.internal
# change Pa$$word with your own
$pwd = ConvertTo-SecureString -String "{Pa$$word}" -Force -AsPlainText
# in between parantheses on the next line use the ID you get by running the first command
Export-PfxCertificate -cert Cert:\localMachine\my\{15034633B1C5D9FB68EAD7984B7816C1D73D27E2} -FilePath c:\temp\selfsignedcertificate.internal.pfx -Password $pwd
@slavaceornea
slavaceornea / JollyJumpers.java
Last active June 2, 2016 14:03
Java class that analyses whether a sequence of integers is a JollyJumper or not.
package jollyjumpers;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;
/**
*
* @author Slava Ceornea
*
@slavaceornea
slavaceornea / matrixDiagonalDifference.java
Last active June 3, 2016 11:57
Java class that calculates the absolute valuefor the difference between the sums of two diagonals of a matrix of size NxN.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
//Java class that calculates the absolute value for the difference between the sums of two diagonals of a matrix of size NxN.
public class matrixDiagonalDifference {
public static void main(String[] args) {
@slavaceornea
slavaceornea / FractionsOfPositivesNegativesAndZeroesInArray.java
Created June 3, 2016 12:45
Java class that prints the fractions of positives, negatives and zeroes in an array.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class FractionsOfPositivesNegativesAndZeroesInArray {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
@slavaceornea
slavaceornea / Staircase.java
Last active June 3, 2016 14:37
Java class outputs a staircase structure of height n that it gets from stdin.
import java.util.Scanner;
/**
*
* @author Slava
*
* Your teacher has given you the task of drawing a staircase structure. Being an expert programmer, you decided to make a program to draw it for you instead. Given the required height, can you print a staircase as shown in the example?
*
* Input
* You are given an integer depicting the height of the staircase.
@slavaceornea
slavaceornea / TimeConversion.java
Last active June 3, 2016 15:32
Given a time in AM/PM format, convert it to military (24-hour) time.
import java.util.Scanner;
/**
*
* @author Slava
*
* Given a time in AM/PM format, convert it to military (24-hour) time.
*
* Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock.
*
@slavaceornea
slavaceornea / SherlockAndTheBeastBruteforce.java
Last active June 6, 2016 19:30
Java class solves the Sherlock And The Beast problem by pure bruteforce approach. The solution is of O(n) complexity. There is a mathematical solution that makes it a O(1) instead.
package sherlockandthebeast;
import java.util.Scanner;
/**
*
* @author Slava
*
* Sherlock and The Beast
*
@slavaceornea
slavaceornea / SherlockAndTheBeast.java
Last active June 6, 2016 19:39
Java class solves the Sherlock And The Beast problem. The solution has O(1) complexity.
package sherlockandthebeast;
import java.util.Scanner;
/**
*
* @author Slava
*
* Sherlock and The Beast
*