Skip to content

Instantly share code, notes, and snippets.

View lnrsoft's full-sized avatar
🎯
Focusing

lnrsoft lnrsoft

🎯
Focusing
View GitHub Profile
@lnrsoft
lnrsoft / factorials.cpp
Created November 19, 2015 20:40
You are given an integer n. Determine the factorial of this number.
#include <vector>
#include <iostream>
int main()
{
std::vector<int> factorials;
factorials.push_back(1);
int n;
std::cin >> n;
for (auto i = 1; i <= n; i++)
@lnrsoft
lnrsoft / astylerc
Last active November 22, 2015 16:14
My astyle configuration
--style=stroustrup -A4
--indent=spaces
--add-brackets -j
--max-code-length=80
--mode=c
--close-templates -xy
--align-pointer=name -k3
--align-reference=name -W3
--delete-empty-lines -xe
--unpad-paren -U
@lnrsoft
lnrsoft / Angry_Professor.cpp
Last active September 6, 2016 23:28
HackerRank Challenges & Solutions
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <sstream>
int main()
{
std::vector<int> NBuffer;
std::vector<std::string> AnswerBuffer;
std::string Nline;
@lnrsoft
lnrsoft / Alternating_Characters.cpp
Last active September 6, 2016 23:29
HackerRank Challenges & Solutions
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <sstream>
int alter(std::string Nline)
{
std::vector<int> NBuffer;
std::vector<int> lister;
std::vector<char> AnswerBuffer(Nline.begin(), Nline.end());
@lnrsoft
lnrsoft / library_fine.cpp
Created September 9, 2016 18:54
Library Fine
// This source code written by Roland Ihasz
#include <vector>
#include <iostream>
int rdn(int y, int m, int d)
{
if (m < 3)
{
y--, m += 12;
}
@lnrsoft
lnrsoft / chocolate_feast.cpp
Created September 9, 2016 19:32
Chocolate Feast HackerRank Solution in C++
// This source code written by Roland Ihasz
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
std::vector<int> vec;
void chockFunc(int nu, int co, int mn)
@lnrsoft
lnrsoft / mysql-reset-root-pw.sh
Last active October 25, 2016 01:24 — forked from sorohan/mysql-reset-root-pw.sh
Reset mysql root password on unix without needing old password.
#!/bin/bash
MYSQL_ROOT_PASSWORD=$1
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
echo 'Missing required $1 (password).'
exit 1
fi
# check if mysql is running now.
@lnrsoft
lnrsoft / evenOrOdd.cpp
Last active January 21, 2017 21:33
There is a simple method to determinate whether a number is even or odd in C++
// This source code written by Roland Ihasz
#include<iostream>
using namespace std;
bool evenOrOdd(int integer)
{
if (integer % 2==0)
return true;
else
return false;
@lnrsoft
lnrsoft / absolutePath.py
Last active January 21, 2017 21:37
Determinate the absolute path of a file in Python
import os
def getcurrentloc(fileName):
isfile = os.path.isfile(fileName)
notfound = (str(fileName) + " does not exist")
if isfile: # if (True) file exist return the path
return os.path.abspath(fileName)
else:
print notfound
@lnrsoft
lnrsoft / factorize.cpp
Created July 27, 2014 10:34
Number Factorizer. Enter a number to factorize. (long double)
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <iomanip> // std::setprecision
using namespace std;
int main()
{